Monotonic Basin Hopping is started

This commit is contained in:
Connor
2021-08-25 23:41:44 -06:00
parent db883187a1
commit 850f05ce38
7 changed files with 107 additions and 13 deletions

View File

@@ -10,7 +10,7 @@
i = rand(0.01:0.01:π/6)
T = 2π*(a^3/μs["Earth"])
prop_time = 2T
n = 50
n = 30
# A simple orbit raising
start = oe_to_xyz([ a, e, i, 0., 0., 0. ], μs["Earth"])
@@ -19,8 +19,8 @@
new_T = 2π*(xyz_to_oe(final, μs["Earth"])[1]^3/μs["Earth"])
# This should be close enough to 0.6
x0 = repeat([0.59, 0., 0.], n)
result = Thesis.single_shoot(start, final, sc, μs["Earth"], 0.0, prop_time, x0)
x0 = repeat([0.55, 0., 0.], n)
result = nlp_solve(start, final, sc, μs["Earth"], 0.0, prop_time, x0)
# Test and plot
@test converged(result)
@@ -29,7 +29,7 @@
path3 = prop(zeros((100,3)), path2[end,:], sc, μs["Earth"], new_T)[1]
path4 = prop(zeros((100,3)), final, sc, μs["Earth"], new_T)[1]
savefig(plot_orbits([path1, path2, path3, path4],
labels=["inital", "transit", "after transit", "final"],
labels=["initial", "transit", "after transit", "final"],
colors=["#FFFFFF","#FF4444","#44FF44","#4444FF"]),
"../plots/find_closest_test.html")
if converged(result)

View File

@@ -0,0 +1,29 @@
@testset "Monotonic Basin Hopping" begin
using Thesis: mbh
# Initial Setup
sc = Sc("test")
a = rand(15000:1.:40000)
e = rand(0.01:0.01:0.5)
i = rand(0.01:0.01:π/6)
T = 2π*(a^3/μs["Earth"])
prop_time = 2T
n = 25
# A simple orbit raising
start = oe_to_xyz([ a, e, i, 0., 0., 0. ], μs["Earth"])
ΔVs = repeat([0.6, 0., 0.]', outer=(n,1))
final = prop(ΔVs, start, sc, μs["Earth"], prop_time)[1][end,:]
new_T = 2π*(xyz_to_oe(final, μs["Earth"])[1]^3/μs["Earth"])
# This should be close enough to 0.6
best, archive = mbh(start, final, sc, μs["Earth"], 0.0, prop_time, n)
# Test and plot
@test converged(best)
for path in archive
@test converged(path)
end
end

View File

@@ -11,6 +11,7 @@ using Thesis
include("propagator.jl")
include("plotting.jl")
include("find_closest.jl")
include("monotonic_basin_hopping.jl")
end
print()