@testset "Monotonic Basin Hopping" begin using PlotlyJS println("Testing Monotonic Basin Hopper") # First we test the random mission guess generator println("Testing guess generator function") flybys = [Earth, Venus, Jupiter] launch_window = ( DateTime(2021,12,25), DateTime(2025,12,25) ) max_C3 = 10. max_v∞ = 8. latest_arrival = DateTime(2030,12,25) random_guess = Thesis.mission_guess(flybys, bepi, 12_000., launch_window, max_C3, max_v∞, latest_arrival) @test typeof(random_guess) == Mission_Guess # Then the perturb function println("Testing perturb function") mission_guess = Thesis.perturb(test_mission) @test mission_guess.launch_date != test_mission.launch_date @test mission_guess.launch_v∞ != test_mission.launch_v∞ for i in 1:2 @test mission_guess.phases[i].v∞_in != test_mission.phases[i].v∞_in @test mission_guess.phases[i].v∞_out != test_mission.phases[i].v∞_out @test mission_guess.phases[i].tof != test_mission.phases[i].tof end @test !mission_guess.converged # # Then the inner loop builder function println("Testing inner loop solver function") mission = Thesis.inner_loop_solve(test_mg) @test !mission.converged # For the valid case we need to use a lambert's solver leave, arrive = DateTime(1992,11,19), DateTime(1993,4,1) earth_state = state(Earth, leave) venus_state = state(Venus, arrive) v∞_out, v∞_in, tof = Thesis.lamberts(Earth, Venus, leave, arrive) phase = Phase(Venus, 1.01v∞_in, -1.01v∞_in, tof, 0.01*ones(20,3)) mission_guess = Mission_Guess(bepi, 12_000., leave, v∞_out, [phase]) mission = Thesis.inner_loop_solve(mission_guess) @test mission.converged if !mission.converged println(mission.message) end # Now we're ready to test the whole thing! println("Testing whole thing") flybys = [ Earth, Venus ] start_mass = 12_000. launch_window = DateTime(1997, 10, 1), DateTime(1997, 10, 31) max_C3 = 15. max_v∞ = 20. latest_arrival = DateTime(2001, 1, 1) best, archive = mbh(flybys, bepi, start_mass, launch_window, max_C3, max_v∞, latest_arrival, verbose=true) @test typeof(best) == Mission end