PaGMO  1.1.5
mga_incipit_cstrs.h
1 /*****************************************************************************
2  * Copyright (C) 2004-2015 The PaGMO development team, *
3  * Advanced Concepts Team (ACT), European Space Agency (ESA) *
4  * *
5  * https://github.com/esa/pagmo *
6  * *
7  * act@esa.int *
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  * This program is distributed in the hope that it will be useful, *
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17  * GNU General Public License for more details. *
18  * *
19  * You should have received a copy of the GNU General Public License *
20  * along with this program; if not, write to the *
21  * Free Software Foundation, Inc., *
22  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
23  *****************************************************************************/
24 
25 #ifndef PAGMO_PROBLEM_MGA_INCIPIT_CSTRS_H
26 #define PAGMO_PROBLEM_MGA_INCIPIT_CSTRS_H
27 
28 #include <string>
29 
30 #include "../config.h"
31 #include "../serialization.h"
32 #include "../types.h"
33 #include "base.h"
34 #include <keplerian_toolbox/planet/gtoc6.h>
35 #include <keplerian_toolbox/epoch.h>
36 
37 
38 namespace pagmo{ namespace problem {
39 
41 
51 class __PAGMO_VISIBLE mga_incipit_cstrs: public base
52 {
53  public:
54  mga_incipit_cstrs(const std::vector<kep_toolbox::planet::planet_ptr> = construct_default_sequence(),
55  const kep_toolbox::epoch t0_l = kep_toolbox::epoch(7305.0),
56  const kep_toolbox::epoch t0_u = kep_toolbox::epoch(11323.0),
57  const std::vector<std::vector<double> > tof = construct_default_tofs(),
58  double Tmax = 365.25,
59  double Dmin = 0.2
60  );
62  base_ptr clone() const;
63 
64  std::string get_name() const;
65  std::string pretty(const std::vector<double> &x) const;
66  void set_tof(const std::vector<std::vector<double> >&);
67  const std::vector<std::vector<double> >& get_tof() const;
68  std::vector<kep_toolbox::planet::planet_ptr> get_sequence() const;
69  protected:
70  void objfun_impl(fitness_vector &, const decision_vector &) const;
71  void compute_constraints_impl(constraint_vector &, const decision_vector &) const;
72  std::string human_readable_extra() const;
73 
74  private:
75  static const std::vector<kep_toolbox::planet::planet_ptr> construct_default_sequence() {
76  std::vector<kep_toolbox::planet::planet_ptr> retval;
77  retval.push_back(kep_toolbox::planet::gtoc6("io").clone());
78  retval.push_back(kep_toolbox::planet::gtoc6("io").clone());
79  retval.push_back(kep_toolbox::planet::gtoc6("europa").clone());
80  return retval;
81  }
82  static const std::vector<std::vector<double> > construct_default_tofs() {
83  std::vector<std::vector<double> > retval;
84  std::vector<double> dumb(2);
85  dumb[0] = 100;dumb[1] = 200;
86  retval.push_back(dumb);
87  dumb[0] = 3;dumb[1] = 200;
88  retval.push_back(dumb);
89  dumb[0] = 4;dumb[1] = 100;
90  retval.push_back(dumb);
91  return retval;
92  }
93  private:
94  friend class boost::serialization::access;
95  template <class Archive>
96  void serialize(Archive &ar, const unsigned int)
97  {
98  ar & boost::serialization::base_object<base>(*this);
99  ar & m_seq;
100  ar & m_tof;
101  ar & const_cast<double &>(m_tmax);
102  ar & const_cast<double &>(m_dmin);
103  }
104  std::vector<kep_toolbox::planet::planet_ptr> m_seq;
105  std::vector<std::vector<double> > m_tof;
106  const double m_tmax;
107  const double m_dmin;
108 };
109 
110 }} // namespaces
111 
112 BOOST_CLASS_EXPORT_KEY(pagmo::problem::mga_incipit_cstrs)
113 #endif // PAGMO_PROBLEM_MGA_INCIPIT_CSTRS_H
Root PaGMO namespace.
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base problem.
Definition: problem/base.h:62
std::vector< double > decision_vector
Decision vector type.
Definition: types.h:40
Base problem class.
Definition: problem/base.h:148
The beginning of the GTOC6 Jupiter Capture Trajectory.
std::vector< double > fitness_vector
Fitness vector type.
Definition: types.h:42
std::vector< double > constraint_vector
Constraint vector type.
Definition: types.h:44