def __init__(self, epoch_bounds=[0, 1000], A1=gtoc7(1), A2=gtoc7(2), single_objective=False, Tmax=0.3, Isp=3000, ms=1500): """ pykep.phasing.lambert_metric(epoch_bounds,A1, A2, max_acc, multi_objective) - epoch_bounds: a list containing the lower and upper bounds in mjd2000 for the launch and arrival epochs - A1: a planet - A2: a planet - Tmax: maximum spacecraft thrust [N] - Isp: specific impulse of the spacecarft propulsion system [s] - ms: spacecraft mass at dparture [kg] - single_objective: if True defines a single objectiove problem (only DV) Example:: lm = planet(epoch_bounds=[0, 1000], A1=gtoc7(1), A2=gtoc7(2), single_objective=False, Tmax = 0.3, Isp = 3000, ms = 1500) """ # First we call the constructor of the base class telling # essentially to pygmo what kind of problem to expect (2 objective, 0 # contraints etc.) super().__init__( 2, 0, 1 + (not single_objective), 0, 0, 0) # then we set the problem bounds (in this case equal for all # components) self.set_bounds(epoch_bounds[0], epoch_bounds[1]) self._ast1 = A1 self._ast2 = A2 self._Tmax = Tmax self._Isp = Isp self._ms = ms self._UNFEASIBLE = 1e+20
def __init__(self, epoch_bounds=[0, 1000], A1=gtoc7(1), A2=gtoc7(2), single_objective=False, Tmax=0.3, Isp=3000, ms=1500): """ pykep.phasing.lambert_metric(epoch_bounds,A1, A2, max_acc, multi_objective) - epoch_bounds: a list containing the lower and upper bounds in mjd2000 for the launch and arrival epochs - A1: a planet - A2: a planet - Tmax: maximum spacecraft thrust [N] - Isp: specific impulse of the spacecarft propulsion system [s] - ms: spacecraft mass at dparture [kg] - single_objective: if True defines a single objectiove problem (only DV) Example:: lm = planet(epoch_bounds=[0, 1000], A1=gtoc7(1), A2=gtoc7(2), single_objective=False, Tmax = 0.3, Isp = 3000, ms = 1500) """ # First we call the constructor of the base class telling # essentially to pygmo what kind of problem to expect (2 objective, 0 # contraints etc.) super(lambert_metric, self).__init__( 2, 0, 1 + (not single_objective), 0, 0, 0) # then we set the problem bounds (in this case equal for all # components) self.set_bounds(epoch_bounds[0], epoch_bounds[1]) self._ast1 = A1 self._ast2 = A2 self._Tmax = Tmax self._Isp = Isp self._ms = ms self._UNFEASIBLE = 1e+20
def run_example6(n_seg=5): """ This example demonstrates the optimization of a multiple randezvous mission (low-thrust). Such a mission (including more asteroids) is also called asteroid hopping The spacecraft performances, as well as the three asteroids visited, are taken from the GTOC7 problem description. """ import pygmo as pg from pykep.trajopt import mr_lt_nep from pykep.planet import gtoc7 from pykep.examples import add_gradient, algo_factory from matplotlib import pyplot as plt # If you have no access to snopt7, try slsqp (multiple starts may be # necessary) algo = algo_factory("snopt7") udp = add_gradient( mr_lt_nep( t0=[9600., 9700.], seq=[gtoc7(5318), gtoc7(14254), gtoc7(7422), gtoc7(5028)], n_seg=n_seg, mass=[800., 2000.], leg_tof=[100., 365.25], rest=[30., 365.25], Tmax=0.3, Isp=3000., traj_tof=365.25 * 3., objective='mass', c_tol=1e-05 ), with_grad=False) prob = pg.problem(udp) prob.c_tol = [1e-5] * prob.get_nc() pop = pg.population(prob, 1) pop = algo.evolve(pop) solution = pop.champion_x if prob.feasibility_x(solution): print("FEASIBILE!!!") ax = udp.udp_inner.plot(solution) else: print("INFEASIBLE :(") ax = None plt.ion() plt.show()