def __init__(self, mass=2000, Tmax=0.5, Isp=3500, Vinf_dep=3, Vinf_arr=2, nseg1=5, nseg2=20): #First we call the constructor for the base PyGMO problem #(dim, integer dim, number of obj, number of con, number of inequality con, tolerance on con violation) super(mga_lt_EVMe,self).__init__(17 + 3 * (nseg1+nseg2), 0, 1, 14 + 1 + nseg1+nseg2 + 3, nseg1+nseg2 + 3, 1e-4) #We then define some data members (we use the double underscore to indicate they are private) from PyKEP import planet_ss, MU_SUN from PyKEP.sims_flanagan import spacecraft, leg self.__earth = planet_ss('earth') self.__venus = planet_ss('venus') self.__mercury = planet_ss('mercury') self.__sc = spacecraft(mass,Tmax,Isp) self.__Vinf_dep = Vinf_dep*1000 self.__Vinf_arr = Vinf_arr*1000 self.__leg1 = leg() self.__leg2 = leg() self.__leg1.set_mu(MU_SUN) self.__leg1.set_spacecraft(self.__sc) self.__leg2.set_mu(MU_SUN) self.__leg2.set_spacecraft(self.__sc) self.__nseg1 = nseg1 self.__nseg2 = nseg2 #And the box-bouds (launch windows, allowed velocities etc.) lb = [3000,100,mass/2] + [-self.__Vinf_dep]*3 + [-6000]*3 + [200,mass/9] + [-6000]*3 + [-self.__Vinf_arr]*3 + [-1,-1,-1] * (nseg1+nseg2) ub = [4000,1000,mass] + [self.__Vinf_dep]*3 + [6000]*3 + [2000,mass] + [6000]*3 + [ self.__Vinf_arr]*3 + [1,1,1] * (nseg1+nseg2) self.set_bounds(lb,ub)
def __init__(self, mass=2000, Tmax=0.5, Isp=3500, Vinf_dep=3, Vinf_arr=2, nseg1=5, nseg2=20): # First we call the constructor for the base PyGMO problem # (dim, integer dim, number of obj, number of con, number of inequality con, tolerance on con violation) super(mga_lt_EVMe, self).__init__(17 + 3 * (nseg1 + nseg2), 0, 1, 14 + 1 + nseg1 + nseg2 + 3, nseg1 + nseg2 + 3, 1e-4) # We then define some data members (we use the double underscore to # indicate they are private) from PyKEP import MU_SUN from PyKEP.planets import jpl_lp from PyKEP.sims_flanagan import spacecraft, leg self.__earth = jpl_lp('earth') self.__venus = jpl_lp('venus') self.__mercury = jpl_lp('mercury') self.__sc = spacecraft(mass, Tmax, Isp) self.__Vinf_dep = Vinf_dep * 1000 self.__Vinf_arr = Vinf_arr * 1000 self.__leg1 = leg() self.__leg2 = leg() self.__leg1.set_mu(MU_SUN) self.__leg1.set_spacecraft(self.__sc) self.__leg2.set_mu(MU_SUN) self.__leg2.set_spacecraft(self.__sc) self.__nseg1 = nseg1 self.__nseg2 = nseg2 # And the box-bounds (launch windows, allowed velocities, etc.) lb = [3000, 100, mass / 2] + [-self.__Vinf_dep] * 3 + [-6000] * 3 + [200, mass / 9] + [-6000] * 3 + [-self.__Vinf_arr] * 3 + [-1, -1, -1] * (nseg1 + nseg2) ub = [4000, 1000, mass] + [self.__Vinf_dep] * 3 + [6000] * 3 + [2000, mass] + [6000] * 3 + [self.__Vinf_arr] * 3 + [1, 1, 1] * (nseg1 + nseg2) self.set_bounds(lb, ub)
def __init__(self, mass=1000, Tmax=0.05, Isp=2500, Vinf=3.0, nseg=20): # First we call the constructor for the base PyGMO problem # (dim, integer dim, number of obj, number of con, number of inequality con, tolerance on con violation) super(mga_lt_earth_mars, self).__init__(6 + nseg * 3, 0, 1, 8 + nseg, nseg + 1, 1e-4) # We then define some data members (we use the double underscore to # indicate they are private) from PyKEP import MU_SUN from PyKEP.planet import jpl_lp from PyKEP.sims_flanagan import spacecraft, leg self.__earth = jpl_lp('earth') self.__mars = jpl_lp('mars') self.__sc = spacecraft(mass, Tmax, Isp) self.__Vinf = Vinf * 1000 self.__leg = leg() self.__leg.set_mu(MU_SUN) self.__leg.set_spacecraft(self.__sc) self.__nseg = nseg self.set_bounds([ 2480, 2400, self.__sc.mass / 10, -self.__Vinf, -self.__Vinf, -self.__Vinf ] + [-1] * 3 * nseg, [ 2490, 2500, self.__sc.mass, self.__Vinf, self.__Vinf, self.__Vinf ] + [1] * 3 * nseg)
def __init__( self, t=[epoch(8.233141758995751e+003), epoch(8.289990617468195e+003)], r=[[-660821073.83843112, -85286653.193055451, -3513417.5052384529], [-660832082.91625774, -85197143.615338504, -3513971.6825616611]], v=[[7873.9701471924709, -16990.277371090539, -58.967610944493998], [7869.0526122101373, -16988.601525093596, -58.937906751346844]], m0=2000, Tmax=0.1, Isp=2000, mu=MU_JUPITER, n_seg=10, high_fidelity=False, optimize_mass=False): """ USAGE: one_lt_leg(t = [epoch(8.233141758995751e+003), epoch(8.289990617468195e+003)], r = [[-660821073.83843112, -85286653.193055451, -3513417.5052384529], [-660832082.91625774, -85197143.615338504, -3513971.6825616611]], v = [[7873.9701471924709, -16990.277371090539, -58.967610944493998], [7869.0526122101373, -16988.601525093596, -58.937906751346844]], m0 = 2000, Tmax = 0.1, Isp = 2000, mu = MU_JUPITER, n_seg = 10, high_fidelity = False) * t: starting and final epochs * r: starting and final position (m) * v: starting and final velocity (m/s) * m0: starting mass (k) * Tmax: maximum allowed thrust (N) * Isp: specific impulse (s) * mu = central body gravity parameter (m^3/s^2) * n_seg = number of segments, * high_fidelity = compute the trajectory in high fidelity mode * optimize_mass = when False the problem is built as a constraint satisfaction problem. When True mass gets optimized """ self.__t = t self.__r = r self.__v = v self.__opt_mass = optimize_mass self.__sc = spacecraft(m0, Tmax, Isp) self.__leg = leg() self.__leg.set_mu(mu) self.__leg.set_spacecraft(self.__sc) self.__leg.high_fidelity = high_fidelity dim = 1 + n_seg * 3 c_dim = n_seg + 7 #First we call the constructor for the base PyGMO problem #As our problem is n dimensional, box-bounded (may be multi-objective), we write #(dim, integer dim, number of obj, number of con, number of inequality con, tolerance on con violation) super(one_lt_leg, self).__init__(dim, 0, 1, c_dim, n_seg, 1e-4) #And we compute the bounds lb = [m0 / 2] + [-1.0] * n_seg * 3 ub = [m0] + [1.0] * n_seg * 3 self.set_bounds(lb, ub)
def __init__(self, t = [epoch(8.233141758995751e+003), epoch(8.289990617468195e+003)], r = [[-660821073.83843112, -85286653.193055451, -3513417.5052384529], [-660832082.91625774, -85197143.615338504, -3513971.6825616611]], v = [[7873.9701471924709, -16990.277371090539, -58.967610944493998], [7869.0526122101373, -16988.601525093596, -58.937906751346844]], m0 = 2000, Tmax = 0.1, Isp = 2000, mu = MU_JUPITER, n_seg = 10, high_fidelity = False, optimize_mass = False ): """ USAGE: one_lt_leg(t = [epoch(8.233141758995751e+003), epoch(8.289990617468195e+003)], r = [[-660821073.83843112, -85286653.193055451, -3513417.5052384529], [-660832082.91625774, -85197143.615338504, -3513971.6825616611]], v = [[7873.9701471924709, -16990.277371090539, -58.967610944493998], [7869.0526122101373, -16988.601525093596, -58.937906751346844]], m0 = 2000, Tmax = 0.1, Isp = 2000, mu = MU_JUPITER, n_seg = 10, high_fidelity = False) * t: starting and final epochs * r: starting and final position (m) * v: starting and final velocity (m/s) * m0: starting mass (k) * Tmax: maximum allowed thrust (N) * Isp: specific impulse (s) * mu = central body gravity parameter (m^3/s^2) * n_seg = number of segments, * high_fidelity = compute the trajectory in high fidelity mode * optimize_mass = when False the problem is built as a constraint satisfaction problem. When True mass gets optimized """ self.__t = t self.__r = r self.__v = v self.__opt_mass = optimize_mass self.__sc = spacecraft(m0,Tmax,Isp) self.__leg = leg() self.__leg.set_mu(mu) self.__leg.set_spacecraft(self.__sc) self.__leg.high_fidelity = high_fidelity dim = 1 + n_seg * 3 c_dim = n_seg + 7 #First we call the constructor for the base PyGMO problem #As our problem is n dimensional, box-bounded (may be multi-objective), we write #(dim, integer dim, number of obj, number of con, number of inequality con, tolerance on con violation) super(one_lt_leg,self).__init__(dim,0,1,c_dim,n_seg,1e-4) #And we compute the bounds lb = [m0/2] + [-1.0] * n_seg * 3 ub = [m0] + [1.0] * n_seg * 3 self.set_bounds(lb,ub)
def __init__(self,mass=1000,Tmax=0.05,Isp=2500,Vinf=3.0,nseg=20): #First we call the constructor for the base PyGMO problem #(dim, integer dim, number of obj, number of con, number of inequality con, tolerance on con violation) super(mga_lt_earth_mars,self).__init__(6 + nseg*3,0,1,8 + nseg,nseg+1,1e-4) #We then define some data members (we use the double underscore to indicate they are private) from PyKEP import planet_ss, MU_SUN from PyKEP.sims_flanagan import spacecraft, leg self.__earth = planet_ss('earth') self.__mars = planet_ss('mars') self.__sc = spacecraft(mass,Tmax,Isp) self.__Vinf = Vinf*1000 self.__leg = leg() self.__leg.set_mu(MU_SUN) self.__leg.set_spacecraft(self.__sc) self.__nseg = nseg self.set_bounds([2480,2400,self.__sc.mass/10,-self.__Vinf,-self.__Vinf,-self.__Vinf] + [-1] * 3 *nseg,[2490,2500,self.__sc.mass,self.__Vinf,self.__Vinf,self.__Vinf] + [1] * 3 * nseg)
def __init__(self, mass=1000, Tmax=0.05, Isp=2500, Vinf=3.0, nseg=20): # First we call the constructor for the base PyGMO problem # (dim, integer dim, number of obj, number of con, number of inequality con, tolerance on con violation) super(mga_lt_earth_mars, self).__init__( 6 + nseg * 3, 0, 1, 8 + nseg, nseg + 1, 1e-4 ) self.earth = jpl_lp('earth') self.mars = jpl_lp('mars') self.sc = spacecraft(mass, Tmax, Isp) self.Vinf = Vinf * 1000 self.leg = leg() self.leg.set_mu(MU_SUN) self.leg.set_spacecraft(self.sc) self.nseg = nseg self.set_bounds( [2480, 2400, self.sc.mass / 10, -self.Vinf, -self.Vinf, -self.Vinf] + [-1]* 3 * nseg, [2490, 2500, self.sc.mass, self.Vinf, self.Vinf, self.Vinf] + [1] * 3 * nseg )
def __init__(self, seq = [planet_ss('earth'),planet_ss('venus'),planet_ss('earth')], n_seg = [10]*2, t0 = [epoch(0),epoch(1000)], tof = [[200,500],[200,500]], vinf_dep=2.5, vinf_arr=2.0, mass=4000.0, Tmax=1.0, Isp=2000.0, fb_rel_vel = 6, multi_objective = False, high_fidelity=False): """ prob = mga_lt_nep(seq = [planet_ss('earth'),planet_ss('venus'),planet_ss('earth')], n_seg = [10]*2, t0 = [epoch(0),epoch(1000)], T = [[200,500],[200,500]], Vinf_dep=2.5, Vinf_arr=2.0, mass=4000.0, Tmax=1.0, Isp=2000.0, multi_objective = False, fb_rel_vel = 6, high_fidelity=False) * seq: list of PyKEP.planet defining the encounter sequence for the trajectoty (including the initial planet) * n_seg: list of integers containing the number of segments to be used for each leg (len(n_seg) = len(seq)-1) * t0: list of PyKEP epochs defining the launch window * tof: minimum and maximum time of each leg (days) * vinf_dep: maximum launch hyperbolic velocity allowed (in km/sec) * vinf_arr: maximum arrival hyperbolic velocity allowed (in km/sec) * mass: spacecraft starting mass * Tmax: maximum thrust * Isp: engine specific impulse * fb_rel_vel = determines the bounds on the maximum allowed relative velocity at all fly-bys (in km/sec) * multi-objective: when True defines the problem as a multi-objective problem, returning total DV and time of flight * high_fidelity = makes the trajectory computations slower, but actually dynamically feasible. """ #1) We compute the problem dimensions .... and call the base problem constructor self.__n_legs = len(seq) - 1 n_fb = self.__n_legs - 1 # 1a) The decision vector length dim = 1 + self.__n_legs * 8 + sum(n_seg) * 3 # 1b) The total number of constraints (mismatch + fly-by + boundary + throttles c_dim = self.__n_legs * 7 + n_fb * 2 + 2 + sum(n_seg) # 1c) The number of inequality constraints (boundary + fly-by angle + throttles) c_ineq_dim = 2 + n_fb + sum(n_seg) # 1d) the number of objectives f_dim = multi_objective + 1 #First we call the constructor for the base PyGMO problem #As our problem is n dimensional, box-bounded (may be multi-objective), we write #(dim, integer dim, number of obj, number of con, number of inequality con, tolerance on con violation) super(mga_lt_nep,self).__init__(dim,0,f_dim,c_dim,c_ineq_dim,1e-4) #2) We then define some class data members #public: self.seq = seq #private: self.__n_seg = n_seg self.__vinf_dep = vinf_dep*1000 self.__vinf_arr = vinf_arr*1000 self.__sc = spacecraft(mass,Tmax,Isp) self.__leg = leg() self.__leg.set_mu(MU_SUN) self.__leg.set_spacecraft(self.__sc) self.__leg.high_fidelity = high_fidelity fb_rel_vel*=1000 #3) We compute the bounds lb = [t0[0].mjd2000] + [0, mass / 2, -fb_rel_vel, -fb_rel_vel, -fb_rel_vel, -fb_rel_vel, -fb_rel_vel, -fb_rel_vel] * self.__n_legs + [-1,-1,-1] * sum(self.__n_seg) ub = [t0[1].mjd2000] + [1, mass, fb_rel_vel, fb_rel_vel, fb_rel_vel, fb_rel_vel, fb_rel_vel, fb_rel_vel] * self.__n_legs + [1,1,1] * sum(self.__n_seg) #3a ... and account for the bounds on the vinfs...... lb[3:6] = [-self.__vinf_dep]*3 ub[3:6] = [self.__vinf_dep]*3 lb[-sum(self.__n_seg)*3-3:-sum(self.__n_seg)*3] = [-self.__vinf_arr]*3 ub[-sum(self.__n_seg)*3-3:-sum(self.__n_seg)*3] = [self.__vinf_arr]*3 # 3b... and for the time of flight lb[1:1+8*self.__n_legs:8] = [el[0] for el in tof] ub[1:1+8*self.__n_legs:8] = [el[1] for el in tof] #4) And we set the bounds self.set_bounds(lb,ub)
def __init__(self, seq = [ganymede,europa], tf = epoch(8.174621347386377e+03), vf = [-1610.7520437617632, 5106.5676929998444, 122.39394967587651], n_seg = [10]*2, m0 = 2000, Tmax = 0.1, Isp = 2000, mu = MU_JUPITER, high_fidelity = False, obj = 'none' ): """ USAGE: mga_incipit_lt(seq = [io,io], t0 = [epoch(7305.0),epoch(11323.0)], tof = [[100,200],[3,200]]) * seq: list of jupiter moons defining the trajectory incipit * t0: list of two epochs defining the launch window * tof: list of n lists containing the lower and upper bounds for the legs flight times (days) * n_seg: list containing the number of segments for each leg * m0: starting mass (k) * Tmax: maximum allowed thrust (N) * Isp: specific impulse (s) * high_fidelity = compute the trajectory in high fidelity mode """ #1) We compute the problem dimensions .... and call the base problem constructor self.__n_legs = len(seq) n_fb = self.__n_legs - 1 # 1a) The decision vector length dim = self.__n_legs * 8 + sum(n_seg) * 3 - 1 # 1b) The total number of constraints (mismatch + fly-by + boundary + throttles c_dim = self.__n_legs * 7 + n_fb * 2 + 1 + sum(n_seg) # 1c) The number of inequality constraints (fly-by angle + throttles) c_ineq_dim = n_fb + sum(n_seg) # 1d) the number of objectives f_dim = 1 #First we call the constructor for the base PyGMO problem #As our problem is n dimensional, box-bounded (may be multi-objective), we write #(dim, integer dim, number of obj, number of con, number of inequality con, tolerance on con violation) super(mga_incipit_lt,self).__init__(dim,0,f_dim,c_dim,c_ineq_dim,1e-4) #2) We then define some class data members #public: self.seq = seq self.obj = obj self.vf = vf self.tf = tf.mjd2000 #private: self.__n_seg = n_seg self.__sc = spacecraft(m0,Tmax,Isp) self.__leg = leg() self.__leg.set_mu(mu) self.__leg.set_spacecraft(self.__sc) self.__leg.high_fidelity = high_fidelity #3) We compute the bounds lb = ( [-4*pi, -pi] + [0, m0 / 1.5, -10000, -10000, -10000, -10000, -10000, -10000] * (self.__n_legs - 1) + [0, m0 / 1.5, -10000, -10000, -10000] + [-1,-1,-1] * sum(self.__n_seg) ) ub = ( [4*pi,pi] + [1, m0, 10000, 10000, 10000, 10000, 10000, 10000] * (self.__n_legs - 1) + [1, m0, 10000, 10000, 10000] + [1,1,1] * sum(self.__n_seg) ) #3a ... and account for the bounds on the starting velocity lb[4:7] = [-3400.0]*3 ub[4:7] = [3400.0]*3 # 3b... and for the time of flight lb[2:2+8*self.__n_legs:8] = [1]*len(seq) ub[2:2+8*self.__n_legs:8] = [700]*len(seq) #4) And we set the bounds self.set_bounds(lb,ub)
def __init__( self, seq=[planet_ss('earth'), planet_ss('venus'), planet_ss('earth')], n_seg=[10] * 2, t0=[epoch(0), epoch(1000)], tof=[[200, 500], [200, 500]], vinf_dep=2.5, vinf_arr=2.0, mass=4000.0, Tmax=1.0, Isp=2000.0, fb_rel_vel=6, multi_objective=False, high_fidelity=False): """ prob = mga_lt_nep(seq = [planet_ss('earth'),planet_ss('venus'),planet_ss('earth')], n_seg = [10]*2, t0 = [epoch(0),epoch(1000)], T = [[200,500],[200,500]], Vinf_dep=2.5, Vinf_arr=2.0, mass=4000.0, Tmax=1.0, Isp=2000.0, multi_objective = False, fb_rel_vel = 6, high_fidelity=False) * seq: list of PyKEP.planet defining the encounter sequence for the trajectoty (including the initial planet) * n_seg: list of integers containing the number of segments to be used for each leg (len(n_seg) = len(seq)-1) * t0: list of PyKEP epochs defining the launch window * tof: minimum and maximum time of each leg (days) * vinf_dep: maximum launch hyperbolic velocity allowed (in km/sec) * vinf_arr: maximum arrival hyperbolic velocity allowed (in km/sec) * mass: spacecraft starting mass * Tmax: maximum thrust * Isp: engine specific impulse * fb_rel_vel = determines the bounds on the maximum allowed relative velocity at all fly-bys (in km/sec) * multi-objective: when True defines the problem as a multi-objective problem, returning total DV and time of flight * high_fidelity = makes the trajectory computations slower, but actually dynamically feasible. """ #1) We compute the problem dimensions .... and call the base problem constructor self.__n_legs = len(seq) - 1 n_fb = self.__n_legs - 1 # 1a) The decision vector length dim = 1 + self.__n_legs * 8 + sum(n_seg) * 3 # 1b) The total number of constraints (mismatch + fly-by + boundary + throttles c_dim = self.__n_legs * 7 + n_fb * 2 + 2 + sum(n_seg) # 1c) The number of inequality constraints (boundary + fly-by angle + throttles) c_ineq_dim = 2 + n_fb + sum(n_seg) # 1d) the number of objectives f_dim = multi_objective + 1 #First we call the constructor for the base PyGMO problem #As our problem is n dimensional, box-bounded (may be multi-objective), we write #(dim, integer dim, number of obj, number of con, number of inequality con, tolerance on con violation) super(mga_lt_nep, self).__init__(dim, 0, f_dim, c_dim, c_ineq_dim, 1e-4) #2) We then define some class data members #public: self.seq = seq #private: self.__n_seg = n_seg self.__vinf_dep = vinf_dep * 1000 self.__vinf_arr = vinf_arr * 1000 self.__sc = spacecraft(mass, Tmax, Isp) self.__leg = leg() self.__leg.set_mu(MU_SUN) self.__leg.set_spacecraft(self.__sc) self.__leg.high_fidelity = high_fidelity fb_rel_vel *= 1000 #3) We compute the bounds lb = [t0[0].mjd2000] + [ 0, mass / 2, -fb_rel_vel, -fb_rel_vel, -fb_rel_vel, -fb_rel_vel, -fb_rel_vel, -fb_rel_vel ] * self.__n_legs + [-1, -1, -1] * sum(self.__n_seg) ub = [t0[1].mjd2000] + [ 1, mass, fb_rel_vel, fb_rel_vel, fb_rel_vel, fb_rel_vel, fb_rel_vel, fb_rel_vel ] * self.__n_legs + [1, 1, 1] * sum(self.__n_seg) #3a ... and account for the bounds on the vinfs...... lb[3:6] = [-self.__vinf_dep] * 3 ub[3:6] = [self.__vinf_dep] * 3 lb[-sum(self.__n_seg) * 3 - 3:-sum(self.__n_seg) * 3] = [-self.__vinf_arr] * 3 ub[-sum(self.__n_seg) * 3 - 3:-sum(self.__n_seg) * 3] = [self.__vinf_arr] * 3 # 3b... and for the time of flight lb[1:1 + 8 * self.__n_legs:8] = [el[0] for el in tof] ub[1:1 + 8 * self.__n_legs:8] = [el[1] for el in tof] #4) And we set the bounds self.set_bounds(lb, ub)
def __init__( self, seq=[ganymede, europa], tf=epoch(8.174621347386377e+03), vf=[-1610.7520437617632, 5106.5676929998444, 122.39394967587651], n_seg=[10] * 2, m0=2000, Tmax=0.1, Isp=2000, mu=MU_JUPITER, high_fidelity=False, obj='none'): """ USAGE: mga_incipit_lt(seq = [io,io], t0 = [epoch(7305.0),epoch(11323.0)], tof = [[100,200],[3,200]]) * seq: list of jupiter moons defining the trajectory incipit * t0: list of two epochs defining the launch window * tof: list of n lists containing the lower and upper bounds for the legs flight times (days) * n_seg: list containing the number of segments for each leg * m0: starting mass (k) * Tmax: maximum allowed thrust (N) * Isp: specific impulse (s) * high_fidelity = compute the trajectory in high fidelity mode """ #1) We compute the problem dimensions .... and call the base problem constructor self.__n_legs = len(seq) n_fb = self.__n_legs - 1 # 1a) The decision vector length dim = self.__n_legs * 8 + sum(n_seg) * 3 - 1 # 1b) The total number of constraints (mismatch + fly-by + boundary + throttles c_dim = self.__n_legs * 7 + n_fb * 2 + 1 + sum(n_seg) # 1c) The number of inequality constraints (fly-by angle + throttles) c_ineq_dim = n_fb + sum(n_seg) # 1d) the number of objectives f_dim = 1 #First we call the constructor for the base PyGMO problem #As our problem is n dimensional, box-bounded (may be multi-objective), we write #(dim, integer dim, number of obj, number of con, number of inequality con, tolerance on con violation) super(mga_incipit_lt, self).__init__(dim, 0, f_dim, c_dim, c_ineq_dim, 1e-4) #2) We then define some class data members #public: self.seq = seq self.obj = obj self.vf = vf self.tf = tf.mjd2000 #private: self.__n_seg = n_seg self.__sc = spacecraft(m0, Tmax, Isp) self.__leg = leg() self.__leg.set_mu(mu) self.__leg.set_spacecraft(self.__sc) self.__leg.high_fidelity = high_fidelity #3) We compute the bounds lb = ([-4 * pi, -pi] + [0, m0 / 1.5, -10000, -10000, -10000, -10000, -10000, -10000] * (self.__n_legs - 1) + [0, m0 / 1.5, -10000, -10000, -10000] + [-1, -1, -1] * sum(self.__n_seg)) ub = ([4 * pi, pi] + [1, m0, 10000, 10000, 10000, 10000, 10000, 10000] * (self.__n_legs - 1) + [1, m0, 10000, 10000, 10000] + [1, 1, 1] * sum(self.__n_seg)) #3a ... and account for the bounds on the starting velocity lb[4:7] = [-3400.0] * 3 ub[4:7] = [3400.0] * 3 # 3b... and for the time of flight lb[2:2 + 8 * self.__n_legs:8] = [1] * len(seq) ub[2:2 + 8 * self.__n_legs:8] = [700] * len(seq) #4) And we set the bounds self.set_bounds(lb, ub)