25 #ifndef PAGMO_UTIL_HV_ALGORITHM_BASE_H
26 #define PAGMO_UTIL_HV_ALGORITHM_BASE_H
31 #include <boost/lexical_cast.hpp>
33 #include "../../config.h"
34 #include "../../exceptions.h"
35 #include "../../serialization.h"
36 #include "../../types.h"
38 namespace pagmo {
namespace util {
43 namespace hv_algorithm {
49 typedef boost::shared_ptr<base>
base_ptr;
102 virtual double compute(std::vector<fitness_vector> &points,
const fitness_vector &r_point)
const = 0;
103 virtual double exclusive(
const unsigned int, std::vector<fitness_vector> &,
const fitness_vector &)
const;
104 virtual unsigned int least_contributor(std::vector<fitness_vector> &,
const fitness_vector &)
const;
105 virtual unsigned int greatest_contributor(std::vector<fitness_vector> &,
const fitness_vector &)
const;
106 virtual std::vector<double> contributions(std::vector<fitness_vector> &,
const fitness_vector &)
const;
116 virtual void verify_before_compute(
const std::vector<fitness_vector> &points,
const fitness_vector &r_point)
const = 0;
122 virtual base_ptr clone()
const = 0;
124 virtual std::string get_name()
const;
128 void assert_minimisation(
const std::vector<fitness_vector> &,
const fitness_vector &)
const;
130 virtual unsigned int extreme_contributor(std::vector<fitness_vector> &,
const fitness_vector &,
bool (*)(
double,
double))
const;
133 static bool cmp_least(
const double,
const double);
134 static bool cmp_greatest(
const double,
const double);
142 DOM_CMP_B_DOMINATES_A = 1,
143 DOM_CMP_A_DOMINATES_B = 2,
144 DOM_CMP_A_B_EQUAL = 3,
145 DOM_CMP_INCOMPARABLE = 4
148 static double volume_between(
double*,
double*,
unsigned int);
149 static int dom_cmp(
double*,
double*,
unsigned int);
153 friend class boost::serialization::access;
154 template <
class Archive>
155 void serialize(Archive &ar,
const unsigned int) {
183 return (*m_cmp_obj)(lhs,rhs);
189 cmp_fun(
int dim) : m_dim(dim) { }
190 virtual ~cmp_fun() { };
194 return lhs[0] < rhs[0];
198 struct cmp_le : cmp_fun
200 cmp_le(
int dim) : cmp_fun(dim) { }
203 return lhs[m_dim] < rhs[m_dim];
207 struct cmp_ge : cmp_fun
209 cmp_ge(
int dim) : cmp_fun(dim) { }
212 return lhs[m_dim] > rhs[m_dim];
216 boost::shared_ptr<cmp_fun> m_cmp_obj;
Fitness vector comparator class.
bool operator()(const fitness_vector &lhs, const fitness_vector &rhs)
Overloaded operator()
fitness_vector_cmp(int dim, char cmp_type)
Constructor of the comparator object.
std::vector< double > fitness_vector
Fitness vector type.
boost::shared_ptr< base > base_ptr
Base hypervolume algorithm class.