PaGMO  1.1.5
fon.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 <boost/math/constants/constants.hpp>
26 #include <cmath>
27 
28 #include "../exceptions.h"
29 #include "../types.h"
30 #include "base.h"
31 #include "fon.h"
32 
33 namespace pagmo { namespace problem {
34 
40 fon::fon():base(3,0,2)
41 {
42  set_bounds(-4,4);
43 }
44 
47 {
48  return base_ptr(new fon(*this));
49 }
50 
53 {
54  pagmo_assert(f.size() == 2 && x.size() == 3);
55  f[0] = 1 - std::exp(-(x[0] - 1 / std::sqrt(3.0)) * (x[0] - 1 / std::sqrt(3.0)) - (x[1] - 1 / std::sqrt(3.0)) * (x[1] -
56  1 / std::sqrt(3.0)) - (x[2] - 1 / std::sqrt(3.0)) * (x[2] - 1 / std::sqrt(3.0)));
57  f[1] = 1 - std::exp(-(x[0] + 1 / std::sqrt(3.0)) * (x[0] + 1 / std::sqrt(3.0)) - (x[1] + 1 / std::sqrt(3.0)) * (x[1] +
58  1 / std::sqrt(3.0)) - (x[2] + 1 / std::sqrt(3.0)) * (x[2] + 1 / std::sqrt(3.0)));
59 }
60 
61 std::string fon::get_name() const
62 {
63  return "Fonseca and Fleming's study";
64 }
65 
66 }} //namespaces
67 
68 BOOST_CLASS_EXPORT_IMPLEMENT(pagmo::problem::fon)
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_ptr clone() const
Clone method.
Definition: fon.cpp:46
Base problem class.
Definition: problem/base.h:148
void objfun_impl(fitness_vector &, const decision_vector &) const
Implementation of the objective function.
Definition: fon.cpp:52
std::vector< double > fitness_vector
Fitness vector type.
Definition: types.h:42
std::string get_name() const
Get problem's name.
Definition: fon.cpp:61
Fonseca and Fleming's study.
Definition: fon.h:52
void set_bounds(const decision_vector &, const decision_vector &)
Bounds setter from pagmo::decision_vector.