PaGMO  1.1.5
mga_1dsm_tof.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_1DSM_TOF_H
26 #define PAGMO_PROBLEM_MGA_1DSM_TOF_H
27 
28 #include <string>
29 #include <boost/array.hpp>
30 #include <keplerian_toolbox/planet/jpl_low_precision.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 
63 class __PAGMO_VISIBLE mga_1dsm_tof: public base
64 {
65  public:
66  mga_1dsm_tof(const std::vector<kep_toolbox::planet::planet_ptr> = construct_default_sequence(),
67  const kep_toolbox::epoch t0_l = kep_toolbox::epoch(0), const kep_toolbox::epoch t0_r = kep_toolbox::epoch(1000),
68  const std::vector<boost::array<double,2> > = construct_default_tof(),
69  const double vinf_l = 0.5, const double vinf_u = 2.5,
70  const bool mo = false, const bool add_vinf_dep = false, const bool add_vinf_arr = true);
71  mga_1dsm_tof(const mga_1dsm_tof&);
72  base_ptr clone() const;
73 
74  std::string get_name() const;
75  std::string pretty(const std::vector<double> &x, bool extended_output = false) const;
76  void set_tof(const std::vector<boost::array<double,2> >);
77  void set_launch_window(const kep_toolbox::epoch&, const kep_toolbox::epoch&);
78  void set_vinf(const double);
79  std::vector<kep_toolbox::planet::planet_ptr> get_sequence() const;
80  std::vector<std::vector<double> > get_tof() const;
81  protected:
82  void objfun_impl(fitness_vector &, const decision_vector &) const;
83  std::string human_readable_extra() const;
84 
85  private:
86  static const std::vector<kep_toolbox::planet::planet_ptr> construct_default_sequence() {
87  std::vector<kep_toolbox::planet::planet_ptr> retval;
88  retval.push_back(kep_toolbox::planet::jpl_lp("earth").clone());
89  retval.push_back(kep_toolbox::planet::jpl_lp("venus").clone());
90  retval.push_back(kep_toolbox::planet::jpl_lp("earth").clone());
91  return retval;
92  }
93  static const std::vector<boost::array<double,2> > construct_default_tof() {
94  std::vector<boost::array<double,2> > retval;
95  boost::array<double,2> dumb = {{ 50,900 }};
96  retval.push_back(dumb);
97  retval.push_back(dumb);
98  return retval;
99  }
100  private:
101  friend class boost::serialization::access;
102  template <class Archive>
103  void serialize(Archive &ar, const unsigned int)
104  {
105  ar & boost::serialization::base_object<base>(*this);
106  ar & m_seq;
107  ar & const_cast<size_t &>(m_n_legs);
108  ar & m_add_vinf_dep;
109  ar & m_add_vinf_arr;
110  }
111  std::vector<kep_toolbox::planet::planet_ptr> m_seq;
112  const size_t m_n_legs;
113  bool m_add_vinf_dep;
114  bool m_add_vinf_arr;
115 };
116 
117 }} // namespaces
118 
119 BOOST_CLASS_EXPORT_KEY(pagmo::problem::mga_1dsm_tof)
120 #endif // PAGMO_PROBLEM_MGA_1DSM_TOF_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 generic MGA-1DSM Problem (tof encoding)
Definition: mga_1dsm_tof.h:63
std::vector< double > fitness_vector
Fitness vector type.
Definition: types.h:42