PaGMO  1.1.5
messenger.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 "messenger.h"
28 #include "../AstroToolbox/mga_dsm.h"
29 #include "../AstroToolbox/misc4Tandem.h"
30 
31 namespace pagmo { namespace problem {
32 
33 const int messenger::sequence[5] = {3,3,2,2,1};
34 
36 
38 messenger::messenger():base(18), problem(total_DV_rndv,sequence,5,0,0,0,0,0)
39 {
40 
41  const double lb[18] = {1000, 1, 0, 0, 200, 30, 30, 30, 0.01, 0.01, 0.01, 0.01, 1.1, 1.1, 1.1, -M_PI, -M_PI, -M_PI};
42  const double ub[18] = {4000, 5, 1, 1, 400, 400, 400, 400, 0.99, 0.99, 0.99, 0.99, 6, 6, 6, M_PI, M_PI, M_PI};
43  set_bounds(lb,lb+18,ub,ub+18);
44 }
45 
48 {
49  return base_ptr(new messenger(*this));
50 }
51 
54 {
55  MGA_DSM(x, problem,f[0]);
56 }
57 
59 
63 void messenger::set_sparsity(int &lenG, std::vector<int> &iGfun, std::vector<int> &jGvar) const
64 {
65  lenG=18;
66  iGfun.resize(lenG);
67  jGvar.resize(lenG);
68  for (int i = 0; i<lenG; ++i)
69  {
70  iGfun[i] = 0;
71  jGvar[i] = i;
72  }
73 }
74 
75 std::string messenger::get_name() const
76 {
77  return "Messenger";
78 }
79 
80 }} //namespaces
81 
82 BOOST_CLASS_EXPORT_IMPLEMENT(pagmo::problem::messenger)
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
messenger()
Constructor.
Definition: messenger.cpp:38
Base problem class.
Definition: problem/base.h:148
std::string get_name() const
Get problem's name.
Definition: messenger.cpp:75
void set_sparsity(int &, std::vector< int > &, std::vector< int > &) const
Implementation of the sparsity structure.
Definition: messenger.cpp:63
std::vector< double > fitness_vector
Fitness vector type.
Definition: types.h:42
void objfun_impl(fitness_vector &, const decision_vector &) const
Implementation of the objective function.
Definition: messenger.cpp:53
Messenger MGA-DSM Problem (reduced version)
Definition: messenger.h:53
void set_bounds(const decision_vector &, const decision_vector &)
Bounds setter from pagmo::decision_vector.
base_ptr clone() const
Clone method.
Definition: messenger.cpp:47