PaGMO  1.1.5
mga_part.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_PART_H
26 #define PAGMO_PROBLEM_MGA_PART_H
27 
28 #include <string>
29 #include <keplerian_toolbox/planet/gtoc6.h>
30 #include <keplerian_toolbox/astro_constants.h>
31 #include <keplerian_toolbox/epoch.h>
32 
33 #include "../config.h"
34 #include "../serialization.h"
35 #include "../types.h"
36 #include "base.h"
37 
38 
39 
40 namespace pagmo{ namespace problem {
41 
43 
52 class __PAGMO_VISIBLE mga_part: public base
53 {
54  public:
55  mga_part(const std::vector<kep_toolbox::planet::planet_ptr> = construct_default_sequence(),
56  const std::vector<std::vector<double> > tof = construct_default_tofs(),
57  const kep_toolbox::epoch t0 = kep_toolbox::epoch(11000),
58  const kep_toolbox::array3D vinf_in = construct_default_v()
59  );
60  mga_part(const mga_part&);
61  base_ptr clone() const;
62 
63  std::string get_name() const;
64  std::string pretty(const std::vector<double> &x) const;
65 
66  void set_tof(const std::vector<std::vector<double> >&);
67  const std::vector<std::vector<double> >& get_tof() const;
68  void set_t0(const kep_toolbox::epoch&);
69  const kep_toolbox::epoch& get_t0() const;
70  void set_vinf_in(const kep_toolbox::array3D&);
71  const kep_toolbox::array3D& get_vinf_in() const;
72  void set_betas(const std::vector<std::vector<double> >&);
73  std::vector<std::vector<double> > get_betas() const;
74  void set_rps(const std::vector<std::vector<double> >&);
75  std::vector<std::vector<double> > get_rps() const;
76  std::vector<kep_toolbox::planet::planet_ptr> get_sequence() const;
77  protected:
78  void objfun_impl(fitness_vector &, const decision_vector &) const;
79  std::string human_readable_extra() const;
80  private:
81  static const std::vector<kep_toolbox::planet::planet_ptr> construct_default_sequence() {
82  std::vector<kep_toolbox::planet::planet_ptr> retval;
83  retval.push_back(kep_toolbox::planet::gtoc6("europa").clone());
84  retval.push_back(kep_toolbox::planet::gtoc6("europa").clone());
85  retval.push_back(kep_toolbox::planet::gtoc6("europa").clone());
86  return retval;
87  }
88  static const kep_toolbox::array3D construct_default_v() {
89  const kep_toolbox::array3D retval = { {1500.0,2350.0,145.0} };
90  return retval;
91  }
92  static const std::vector<std::vector<double> > construct_default_tofs() {
93  std::vector<std::vector<double> > retval;
94  std::vector<double> dumb(2);
95  dumb[0] = 10;dumb[1] = 40;
96  retval.push_back(dumb);
97  dumb[0] = 10;dumb[1] = 40;
98  retval.push_back(dumb);
99  return retval;
100  }
101  private:
102  friend class boost::serialization::access;
103  template <class Archive>
104  void serialize(Archive &ar, const unsigned int)
105  {
106  ar & boost::serialization::base_object<base>(*this);
107  ar & m_seq;
108  ar & m_tof;
109  ar & m_t0;
110  ar & m_vinf_in;
111  }
112  std::vector<kep_toolbox::planet::planet_ptr> m_seq;
113  std::vector<std::vector<double> > m_tof;
114  kep_toolbox::epoch m_t0;
115  kep_toolbox::array3D m_vinf_in;
116 };
117 
118 }} // namespaces
119 
120 BOOST_CLASS_EXPORT_KEY(pagmo::problem::mga_part)
121 #endif // PAGMO_PROBLEM_MGA_PART_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
A part of the GTOC6 Jupiter Capture Trajectory.
Definition: mga_part.h:52
std::vector< double > fitness_vector
Fitness vector type.
Definition: types.h:42