ax.plot(xe_o, ye_o, ze_o, color=e_color, linestyle=e_linestyle, label=e_label) if __name__ == "__main__": # 算例指定和获取最优个体 case_index = 1 _, _, individual_norm = find_best_spherical_record(case_index, True) _, _, individual = find_best_spherical_record(case_index, False) # 绘制3D坐标轴 fig_norm, ax_norm = plot_util.plot_3D_frame( 'case {} norm frame'.format(case_index), True) fig, ax = plot_util.plot_3D_frame('case {} frame'.format(case_index), False) # 绘制起始点 plot_spherical_initial_point(case_index, ax_norm, True) plot_spherical_initial_point(case_index, ax, False) # 绘制轨迹 plot_spherical_trajectory(case_index, individual_norm, ax_norm, True) plot_spherical_trajectory(case_index, individual, ax, False) # 绘制控制变量坐标系 fig_control, (ax_control_alpha, ax2_alpha, ax_control_beta, ax2_beta) = plot_util.plot_control_frame( 'case {} control frame'.format(case_index))
import ldope import plot_spherical_result import plot_cartesian_result import plot_util cartesian_index = 4 spherical_index = 7 # 获取最优值,计算时间和最优个体(归一化) cartesian_opt_value, cartesian_cost_time, cartesian_individual_norm = \ plot_cartesian_result.find_best_cartesian_record(cartesian_index, True) spherical_opt_value, spherical_cost_time, spherical_individual_norm = \ plot_spherical_result.find_best_spherical_record(spherical_index, True) # 绘制3D坐标轴 fig_c, ax_c = plot_util.plot_3D_frame('cartesian trajectory', True) fig_s, ax_s = plot_util.plot_3D_frame('spherical trajectory', True) # 绘制起始点 plot_cartesian_result.plot_cartesian_initial_point(cartesian_index, ax_c, True) plot_spherical_result.plot_spherical_initial_point(spherical_index, ax_s, True) # 绘制轨迹 plot_cartesian_result.plot_cartesian_trajectory(cartesian_index, cartesian_individual_norm, ax_c, True) plot_spherical_result.plot_spherical_trajectory(spherical_index, spherical_individual_norm, ax_s, True) # 绘制控制变量坐标轴
import plot_util for case_index in range(1, 4): # 获取最优值,计算时间和最优个体 cartesian_opt_value, cartesian_cost_time, cartesian_individual_norm = \ plot_cartesian_result.find_best_cartesian_record(case_index, True) _, _, cartesian_individual = \ plot_cartesian_result.find_best_cartesian_record(case_index, False) spherical_opt_value, spherical_cost_time, spherical_individual_norm = \ plot_spherical_result.find_best_spherical_record(case_index, True) _, _, spherical_individual = \ plot_spherical_result.find_best_spherical_record(case_index, False) # 绘制3D坐标轴 fig, ax = plot_util.plot_3D_frame('case {} frame'.format(case_index), False) # 绘制起始点 plot_spherical_result.plot_spherical_initial_point( case_index, ax, False, p_label='Initial Point P{}'.format(case_index), e_label='Initial Point E{}'.format(case_index)) # 绘制轨迹 plot_cartesian_result.plot_cartesian_trajectory( case_index, cartesian_individual, ax, False,
import seaborn from scipy.integrate import solve_ivp import ldope import plot_spherical_result import plot_cartesian_result import plot_util spherical_opt_value_4, spherical_cost_time_4, spherical_individual_norm_4 = \ plot_spherical_result.find_best_spherical_record(4, True) spherical_opt_value_5, spherical_cost_time_5, spherical_individual_norm_5 = \ plot_spherical_result.find_best_spherical_record(5, True) spherical_opt_value_6, spherical_cost_time_6, spherical_individual_norm_6 = \ plot_spherical_result.find_best_spherical_record(6, True) # 绘制3D坐标轴 fig_p, ax_p = plot_util.plot_3D_frame('pursuer longitude', True) fig_e, ax_e = plot_util.plot_3D_frame('evader longitude', True) # 绘制起始点 plot_spherical_result.plot_spherical_initial_point( 4, ax_p, True, p_color=seaborn.xkcd_rgb['red'], p_label='Initial Position P4', side='p') plot_spherical_result.plot_spherical_initial_point( 5, ax_p, True, p_color=seaborn.xkcd_rgb['green'],