PaGMO  1.1.5
algorithm/cstrs_co_evolution.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_CSTRS_CO_EVOLUTION_H
26 #define PAGMO_ALGORITHM_CSTRS_CO_EVOLUTION_H
27 
28 #include <string>
29 
30 #include "../config.h"
31 #include "../population.h"
32 #include "../serialization.h"
33 #include "base.h"
34 #include "jde.h"
35 #include "sga.h"
36 
37 namespace pagmo { namespace algorithm {
38 
40 
62 class __PAGMO_VISIBLE cstrs_co_evolution: public base
63 {
64 public:
66 
72  // co-evolution simple, split_neq_eq, split_constraints
73  enum method_type {SIMPLE = 0, SPLIT_NEQ_EQ = 1, SPLIT_CONSTRAINTS = 2};
74 
75  cstrs_co_evolution(const base & = jde(), const base & = sga(1), int pop_penalties_size = 30, int gen = 1,
76  method_type method = SIMPLE, double pen_lower_bound = 0.,
77  double pen_upper_bound = 100000.,
78  double = 1e-15, double = 1e-15);
80  base_ptr clone() const;
81 
82 public:
83  void evolve(population &) const;
84  std::string get_name() const;
85  base_ptr get_algorithm() const;
86  void set_algorithm(const base &);
87 
88 protected:
89  std::string human_readable_extra() const;
90 
91 private:
92  friend class boost::serialization::access;
93  template <class Archive>
94  void serialize(Archive &ar, const unsigned int)
95  {
96  ar & boost::serialization::base_object<base>(*this);
97  ar & m_original_algo;
98  ar & m_original_algo_penalties;
99  ar & const_cast<int &>(m_gen);
100  ar & m_method;
101  ar & m_pop_penalties_size;
102  ar & m_pen_lower_bound;
103  ar & m_pen_upper_bound;
104  ar & const_cast<double &>(m_ftol);
105  ar & const_cast<double &>(m_xtol);
106  }
107  base_ptr m_original_algo;
108  base_ptr m_original_algo_penalties;
109  //Number of generations
110  const int m_gen;
111  // population encoding penalties size
112  int m_pop_penalties_size;
113  // problem associated to population penalties variables
114  method_type m_method;
115  double m_pen_lower_bound;
116  double m_pen_upper_bound;
117 
118  // tolerance
119  const double m_ftol;
120  const double m_xtol;
121 };
122 
123 }} //namespaces
124 
125 BOOST_CLASS_EXPORT_KEY(pagmo::algorithm::cstrs_co_evolution)
126 
127 #endif // PAGMO_ALGORITHM_CSTRS_CO_EVOLUTION_H
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base algorithm.
Root PaGMO namespace.
Base algorithm class.
Population class.
Definition: population.h:70
Co-Evolution constraints handling meta-algorithm.
The Simple Genetic Algorithm (SGA)
Definition: sga.h:53
jDE - Differential Evolution Algorithm - Self-Adaptive C and R (2011)
Definition: jde.h:64