PaGMO  1.1.5
base_unc_mo.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 "../types.h"
26 #include "../population.h"
27 #include "../exceptions.h"
28 #include "base_unc_mo.h"
29 
30 namespace pagmo { namespace problem {
31 
33 
43 base_unc_mo::base_unc_mo(size_type n, size_type ni, f_size_type nf):base(n, ni, nf, 0, 0, 0.0) {}
44 
46 
54 {
55  double c = 0.0;
56  for (population::size_type i = 0; i < pop.size(); ++i) {
58  }
59 
60  return c / pop.size();
61 }
62 
64 
71 {
72  return convergence_metric(x);
73 }
74 
76 
84 {
85  (void) x; // avoids warnings during compilation
86  pagmo_throw(not_implemented_error, "Error: a convergence metric is not implemented for this problem.");
87 }
88 
89 }} // namespaces
Root PaGMO namespace.
std::vector< double > decision_vector
Decision vector type.
Definition: types.h:40
const individual_type & get_individual(const size_type &) const
Get constant reference to individual at position n.
Definition: population.cpp:277
fitness_vector::size_type f_size_type
Fitness' size type: the same as pagmo::fitness_vector's size type.
Definition: problem/base.h:162
Base problem class.
Definition: problem/base.h:148
Population class.
Definition: population.h:70
double p_distance(const decision_vector &) const
Distance from the Pareto front (of a decision_vector)
Definition: base_unc_mo.cpp:70
container_type::size_type size_type
Population size type.
Definition: population.h:192
decision_vector cur_x
Current decision vector.
Definition: population.h:83
base_unc_mo(base::size_type, base::size_type, base::f_size_type)
Constructor from dimension and fitness dimension.
Definition: base_unc_mo.cpp:43
virtual double convergence_metric(const decision_vector &) const
Default implementation for a convergence metric.
Definition: base_unc_mo.cpp:83
decision_vector::size_type size_type
Problem's size type: the same as pagmo::decision_vector's size type.
Definition: problem/base.h:160