@testset "Monotonic Basin Hopping" begin using PlotlyJS: savefig println("Testing Monotonic Basin Hopper") """ The cost function for the mission """ function easy_cost(m::Mission, C3::Float64, v∞::Float64) norm_mass = (m.start_mass - prop(m)[7]) / m.start_mass norm_C3 = ( m.launch_v∞ ⋅ m.launch_v∞ ) / C3 norm_v∞ = norm(m.phases[end].v∞_in) / v∞ return 3norm_mass + norm_C3 + norm_v∞ end # Mission Parameters that won't change (they're very lenient) sc, fuel = bepi, 3_600. c3, v∞ = 100., 20. # Convenience function for these tests Thesis.mbh(fbs, lw, la, sp, dp) = mbh(fbs, sc, fuel, lw, c3, v∞, la, easy_cost, search_patience=sp, drill_patience=dp, verbose=true) # Again, we're going to test a simple case first # This one seems to converge really easily, so we don't run it much launch_window = DateTime(1992,11,1), DateTime(1992,12,1) latest_arrival = DateTime(1993,6,1) planets = [ Earth, Venus ] best, archive = mbh(planets, launch_window, latest_arrival, 2, 3) @test typeof(best) == Mission p = plot(best, title="MBH Test Solution") savefig(p,"../plots/mbh_test_1_phase.html") # Now for a more complicated two-phase mission, with a bigger date range # This is known to have a solution though planets = [Earth, Venus, Mars] launch_window = DateTime(2021,6,1), DateTime(2022,6,1) latest_arrival = DateTime(2024,1,1) best, archive = mbh(planets, launch_window, latest_arrival, 10, 3) @test typeof(best) == Mission p = plot(best, title="MBH Test Solution") savefig(p,"../plots/mbh_test_2_phase.html") end