PaGMO  1.1.5
cassini_1.cpp
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 #include <string>
26 
27 #include "cassini_1.h"
28 #include "../exceptions.h"
29 #include "../AstroToolbox/mga.h"
30 
31 namespace pagmo { namespace problem {
32 
34 
41 cassini_1::cassini_1(unsigned int objectives):base(6,0,objectives),Delta_V(6),rp(4),t(6)
42 {
43  if (objectives != 1 && objectives !=2) {
44  pagmo_throw(value_error,"Cassini_1 problem has either one or two objectives");
45  }
46  // Set bounds.
47  const double lb[6] = {-1000, 30, 100, 30 , 400 , 1000};
48  const double ub[6] = {0 , 400, 470, 400, 2000, 6000};
49  set_bounds(lb,lb+6,ub,ub+6);
50 
51  // Set the mgaproblem data
52  problem.type = total_DV_orbit_insertion; //Optimization type
53 
54  int sequence_[6] = {3,2,2,3,5,6}; //Sequence of planets
55  problem.sequence.insert(problem.sequence.begin(), sequence_, sequence_+6);
56 
57  const int rev_[6] = {0,0,0,0,0,0}; //Sequence of clockwise legs
58  problem.rev_flag.insert(problem.rev_flag.begin(), rev_, rev_+6);
59 
60  problem.e = 0.98; // Insertion orbit eccentricity
61  problem.rp = 108950; // Insertion orbit pericenter
62  problem.DVlaunch = 0; // Launcher DV
63 }
64 
67 {
68  return base_ptr(new cassini_1(*this));
69 }
70 
73 {
74  MGA(x,problem,rp,Delta_V,f[0]);
75  if (get_f_dimension() == 2) {
76  f[1] = (x[2]+x[3]+x[4]+x[5]); // + std::max(0.0,f[0] - 20) * 365.25;
77  }
78  }
79 
80 std::string cassini_1::get_name() const
81 {
82  return "Cassini 1";
83 }
84 
85 }}
86 
87 BOOST_CLASS_EXPORT_IMPLEMENT(pagmo::problem::cassini_1)
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
cassini_1(unsigned int=1)
Problem Constructor.
Definition: cassini_1.cpp:41
Base problem class.
Definition: problem/base.h:148
base_ptr clone() const
Clone method.
Definition: cassini_1.cpp:66
void objfun_impl(fitness_vector &, const decision_vector &) const
Implementation of the objective function.
Definition: cassini_1.cpp:72
std::string get_name() const
Get problem's name.
Definition: cassini_1.cpp:80
std::vector< double > fitness_vector
Fitness vector type.
Definition: types.h:42
f_size_type get_f_dimension() const
Return fitness dimension.
Cassini MGA problem.
Definition: cassini_1.h:55
void set_bounds(const decision_vector &, const decision_vector &)
Bounds setter from pagmo::decision_vector.