PaGMO  1.1.5
moea_d.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_ALGORITHM_MOEAD_H
26 #define PAGMO_ALGORITHM_MOEAD_H
27 
28 #include "../config.h"
29 #include "../serialization.h"
30 #include "base.h"
31 #include "../problem/decompose.h"
32 
33 
34 
35 namespace pagmo { namespace algorithm {
36 
38 
50 class __PAGMO_VISIBLE moead: public base
51 {
52 public:
55  RANDOM=0,
56  GRID=1,
57  LOW_DISCREPANCY=2
58  };
59 
60  moead(
61  int gen=100,
62  weight_generation_type = GRID,
64  double realb = 0.9,
65  unsigned int limit = 2,
66  double CR = 1.0,
67  double F=0.5,
68  double eta_m = 20,
69  bool preserve_diversity = true
70  );
71 
72  base_ptr clone() const;
73  void evolve(population &) const;
74  std::string get_name() const;
75  std::vector<fitness_vector> generate_weights(const unsigned int, const unsigned int) const;
76 
77 protected:
78  std::string human_readable_extra() const;
79 
80 private:
81  void reksum(std::vector<std::vector<double> > &, const std::vector<unsigned int>&, unsigned int, unsigned int, std::vector<double> = std::vector<double>() ) const;
82  void compute_neighbours(std::vector<std::vector<int> > &, const std::vector<std::vector <double> > &);
83  void mating_selection(std::vector<population::size_type> &, int, int,const std::vector<std::vector<population::size_type> >&) const;
84  void mutation(decision_vector&, const population&, double rate) const;
85 
86  friend class boost::serialization::access;
87  template <class Archive>
88  void serialize(Archive &ar, const unsigned int)
89  {
90  ar & boost::serialization::base_object<base>(*this);
91  ar & const_cast<int &>(m_gen);
92  ar & const_cast<population::size_type &>(m_T);
93  ar & const_cast<weight_generation_type &>(m_weight_generation);
94  ar & const_cast<double &>(m_realb);
95  ar & const_cast<unsigned int &>(m_limit);
96  ar & const_cast<double &>(m_cr);
97  ar & const_cast<double &>(m_f);
98  ar & const_cast<double &>(m_eta_m);
99  ar & const_cast<double &>(m_preserve_diversity);
100  }
101  //Number of generations
102  const int m_gen;
103  const population::size_type m_T;
104  const weight_generation_type m_weight_generation;
105  //probability of selecting mating parents from neighborhood
106  const double m_realb;
107  const unsigned int m_limit;
108  const double m_cr;
109  const double m_f;
110  const double m_eta_m;
111  const double m_preserve_diversity;
112 };
113 
114 }} //namespaces
115 
116 BOOST_CLASS_EXPORT_KEY(pagmo::algorithm::moead)
117 
118 #endif // PAGMO_ALGORITHM_MOEAD_H
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base algorithm.
Root PaGMO namespace.
std::vector< double > decision_vector
Decision vector type.
Definition: types.h:40
Base algorithm class.
Population class.
Definition: population.h:70
weight_generation_type
Mechanism used to generate the weight vectors.
Definition: moea_d.h:54
container_type::size_type size_type
Population size type.
Definition: population.h:192
MOEA/D - DE.
Definition: moea_d.h:50