using Thesis using SPICE using LinearAlgebra using Dates using PlotlyJS try furnsh("../../spice_files/naif0012.tls") furnsh("../../spice_files/de430.bsp") catch furnsh("spice_files/naif0012.tls") furnsh("spice_files/de430.bsp") end function cost(m::Union{Mission, Mission_Guess}) norm_mass = (m.start_mass - prop(m)[7]) / m.start_mass norm_C3 = ( m.launch_vāˆž ā‹… m.launch_vāˆž ) / 200. return 3norm_mass + norm_C3 end function get_id(m::Mission) letters = "E" for phase in m.phases letters *= phase.planet.name[1] end letters *= " " letters *= string(cost(m)) return letters end missions = Vector{Mission}() folders = readdir("/home/connor/projects/thesis/archive/EM_3-29", join=true) for folder in folders try push!(missions, ingest(folder * "/mission")) catch e println("Ingestion failure") end end sorted_missions = sort(missions, by=cost) @show get_id.(missions) # long, short = improve.(sorted_missions2[1:2], n=7)#, use_cost=true) best_cost = Vector{Float64}() for i in 1:length(missions) push!(best_cost, minimum(cost.(missions[1:i]))) end p_dots = scatter(;y = cost.(missions), mode="markers") p_best = scatter(;y = best_cost) layout = Layout(;showlegend=false, title=attr( font_color="rgb(0,0,0)", yanchor="top", y=0.95, text="Cost Functions Values of Single MBH run for Earth-Mars Trajectory" ), yaxis_title = "Cost Function Value", ) display(PlotlyJS.plot([p_dots, p_best], layout))