PaGMO  1.1.5
hoy.h
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 #ifndef PAGMO_UTIL_HV_ALGORITHM_HOY_H
26 #define PAGMO_UTIL_HV_ALGORITHM_HOY_H
27 
28 #include <iostream>
29 #include <vector>
30 #include <cmath>
31 #include <algorithm>
32 #include <iterator>
33 
34 #include "base.h"
35 #include "../hypervolume.h"
36 
37 namespace pagmo { namespace util { namespace hv_algorithm {
38 
40 
57 class __PAGMO_VISIBLE hoy : public base {
58 public:
59  hoy();
60  double compute(std::vector<fitness_vector> &, const fitness_vector &) const;
61  void verify_before_compute(const std::vector<fitness_vector> &, const fitness_vector &) const;
62  base_ptr clone() const;
63  std::string get_name() const;
64 
65 private:
66  inline bool covers(const double cub[], const double reg_low[]) const;
67  inline bool part_covers(const double cub[], const double reg_up[]) const;
68  inline int contains_boundary(const double cub[], const double reg_low[], const int split) const;
69  inline double get_measure(const double reg_low[], const double reg_up[]) const;
70  inline int is_pile(const double cub[], const double reg_low[]) const;
71  inline double compute_trellis(const double reg_low[], const double reg_up[], const double trellis[]) const;
72  inline double get_median(double* bounds, unsigned int n) const;
73  inline void stream(double m_region_low[], double m_region_up[], double** points, const unsigned int n_points, int split, double cover, unsigned int rec_level) const;
74 
79  mutable int m_dimension;
80  mutable int m_total_size;
81  mutable double m_sqrt_size;
82  mutable double m_volume;
83  mutable double *m_region_up;
84  mutable double *m_region_low;
85  mutable int *m_piles;
86  mutable double *m_trellis;
87  mutable double *m_boundaries;
88  mutable double *m_no_boundaries;
89  mutable std::vector<double**> m_child_points;
90 
91  friend class boost::serialization::access;
92  template <class Archive>
93  void serialize(Archive &ar, const unsigned int)
94  {
95  ar & boost::serialization::base_object<base>(*this);
96  }
97 };
98 
99 } } }
100 
101 BOOST_CLASS_EXPORT_KEY(pagmo::util::hv_algorithm::hoy)
102 
103 #endif
Root PaGMO namespace.
HOY algorithm.
Definition: hoy.h:57
std::vector< double > fitness_vector
Fitness vector type.
Definition: types.h:42
boost::shared_ptr< base > base_ptr
Base hypervolume algorithm class.