27 #include <boost/integer_traits.hpp>
28 #include <boost/math/constants/constants.hpp>
29 #include <boost/numeric/conversion/bounds.hpp>
30 #include <boost/numeric/conversion/cast.hpp>
36 #include "../exceptions.h"
39 #include "gtoc5_rendezvous.h"
40 #include <keplerian_toolbox/astro_constants.h>
41 #include <keplerian_toolbox/planet/gtoc5.h>
46 namespace pagmo {
namespace problem {
49 gtoc5_rendezvous::gtoc5_rendezvous(
int segments,
int source,
int target,
const double &lb_epoch,
const double &initial_mass,
const double &ctol):
50 base(segments * 3 + 3, 0, 1, 7 + segments, segments,ctol),
51 m_n_segments(segments),m_source(source),m_target(target),m_lb_epoch(lb_epoch),m_initial_mass(initial_mass)
58 ub_v[0] = m_lb_epoch + 356.25 * 10;
66 ub_v[2] = m_initial_mass;
69 for (
int i = 3; i < segments * 3 + 3; ++i)
79 m_leg.set_spacecraft(kep_toolbox::sims_flanagan::spacecraft(m_initial_mass,0.3,3000));
99 const epoch epoch_i(x[0],epoch::MJD), epoch_f(x[1] + x[0],epoch::MJD);
100 array3D v0, r0, vf, rf;
101 m_source.eph(epoch_i,r0,v0);
102 m_target.eph(epoch_f,rf,vf);
103 m_leg.set_leg(epoch_i,sc_state(r0,v0,m_leg.get_spacecraft().get_mass()),x.begin() + 3, x.end(),epoch_f,sc_state(rf,vf,x[2]),ASTRO_MU_SUN);
106 m_leg.get_mismatch_con(c.begin(), c.begin() + 7);
107 for (
int i=0; i<3; ++i) c[i]/=ASTRO_AU;
108 for (
int i=3; i<6; ++i) c[i]/=ASTRO_EARTH_VELOCITY;
109 c[6] /= m_leg.get_spacecraft().get_mass();
111 m_leg.get_throttles_con(c.begin() + 7, c.begin() + 7 + m_n_segments);
119 for (pagmo::decision_vector::size_type i = 0; i<x0.size(); ++i)
129 return "GTOC5 Rendezvous phase";
136 const epoch epoch_i(x[0],epoch::MJD), epoch_f(x[1] + x[0],epoch::MJD);
137 array3D v0, r0, vf, rf;
138 m_source.eph(epoch_i,r0,v0);
139 m_target.eph(epoch_f,rf,vf);
140 m_leg.set_leg(epoch_i,sc_state(r0,v0,m_leg.get_spacecraft().get_mass()),x.begin() + 3, x.end(),epoch_f,sc_state(rf,vf,x[2]),ASTRO_MU_SUN);
142 std::ostringstream oss;
143 oss << m_leg <<
'\n' << m_source <<
'\n' << m_target <<
'\n';
void objfun_impl(fitness_vector &, const decision_vector &) const
Implementation of the objective function.
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base problem.
std::vector< double > decision_vector
Decision vector type.
base_ptr clone() const
Clone method.
gtoc5_rendezvous(int=10, int=1, int=2, const double &=57023, const double &=4000, const double &=1E-5)
Constructor.
void set_sparsity(int &, std::vector< int > &, std::vector< int > &) const
Implementation of the sparsity structure: automated detection.
size_type get_dimension() const
Return global dimension.
std::string pretty(const decision_vector &) const
A nice string representation of a chromosome.
void compute_constraints_impl(constraint_vector &, const decision_vector &) const
Implementation of the constraint function.
std::vector< double > fitness_vector
Fitness vector type.
void estimate_sparsity(const decision_vector &, int &lenG, std::vector< int > &iGfun, std::vector< int > &jGvar) const
Heuristics to estimate the sparsity pattern of the problem.
std::vector< double > constraint_vector
Constraint vector type.
const decision_vector & get_ub() const
Upper bounds getter.
const decision_vector & get_lb() const
Lower bounds getter.
void set_bounds(const decision_vector &, const decision_vector &)
Bounds setter from pagmo::decision_vector.
std::string get_name() const
Get problem's name.