PaGMO  1.1.5
rosetta.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 "rosetta.h"
28 #include "../AstroToolbox/mga_dsm.h"
29 #include "../AstroToolbox/misc4Tandem.h"
30 
31 namespace pagmo { namespace problem {
32 
33 const int rosetta::sequence[6] = {3, 3, 4, 3, 3, 10};
34 
36 
38 rosetta::rosetta():base(22), problem(rndv,sequence,6,0,0,0,0,0)
39 {
40  //Setting the final comet elements
41  problem.asteroid.keplerian[0] = 3.50294972836275;
42  problem.asteroid.keplerian[1] = 0.6319356;
43  problem.asteroid.keplerian[2] = 7.12723;
44  problem.asteroid.keplerian[3] = 50.92302;
45  problem.asteroid.keplerian[4] = 11.36788;
46  problem.asteroid.keplerian[5] = 0.0;
47  problem.asteroid.epoch = 52504.23754000012;
48  problem.asteroid.mu = 0.0;
49 
50  const double lb[22] = {1460, 3, 0, 0, 300, 150, 150, 300, 700 , 0.01, 0.01, 0.01, 0.01, 0.01, 1.05, 1.05, 1.05, 1.05, -M_PI, -M_PI, -M_PI, -M_PI};
51  const double ub[22] = {1825, 5, 1, 1, 500, 800, 800, 800, 1850, 0.9, 0.9 , 0.9 , 0.9 , 0.9 , 9 , 9 , 9 , 9 , M_PI , M_PI , M_PI , M_PI};
52  set_bounds(lb,lb+22,ub,ub+22);
53 }
54 
57 {
58  return base_ptr(new rosetta(*this));
59 }
60 
63 {
64  MGA_DSM(x, problem,f[0]);
65 }
66 
68 
72 void rosetta::set_sparsity(int &lenG, std::vector<int> &iGfun, std::vector<int> &jGvar) const
73 {
74  lenG=22;
75  iGfun.resize(22);
76  jGvar.resize(22);
77  for (int i = 0; i<lenG; ++i)
78  {
79  iGfun[i] = 0;
80  jGvar[i] = i;
81  }
82 }
83 
84 std::string rosetta::get_name() const
85 {
86  return "Rosetta";
87 }
88 
89 }} //namespaces
90 
91 BOOST_CLASS_EXPORT_IMPLEMENT(pagmo::problem::rosetta)
Root PaGMO namespace.
void objfun_impl(fitness_vector &, const decision_vector &) const
Implementation of the objective function.
Definition: rosetta.cpp:62
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
Rosetta MGA-DSM Problem.
Definition: rosetta.h:51
base_ptr clone() const
Clone method.
Definition: rosetta.cpp:56
void set_sparsity(int &, std::vector< int > &, std::vector< int > &) const
Implementation of the sparsity structure.
Definition: rosetta.cpp:72
std::vector< double > fitness_vector
Fitness vector type.
Definition: types.h:42
rosetta()
Constructor.
Definition: rosetta.cpp:38
std::string get_name() const
Get problem's name.
Definition: rosetta.cpp:84
void set_bounds(const decision_vector &, const decision_vector &)
Bounds setter from pagmo::decision_vector.