25 #ifndef PAGMO_ALGORITHM_SGA_H
26 #define PAGMO_ALGORITHM_SGA_H
28 #include "../config.h"
29 #include "../problem/base.h"
30 #include "../serialization.h"
33 namespace pagmo {
namespace algorithm {
59 enum type {BEST20 = 0,ROULETTE = 1};
64 enum type {GAUSSIAN = 0, RANDOM = 1};
78 friend class boost::serialization::access;
79 template <
class Archive>
80 void serialize(Archive &ar,
const unsigned int)
90 enum type {BINOMIAL = 0, EXPONENTIAL = 1};
92 sga(
int gen = 1,
const double &cr = .95,
const double &m = .02,
int elitism = 1,
93 mutation::type mut = mutation::GAUSSIAN,
double width = 0.1,
94 selection::type sel = selection::ROULETTE,
95 crossover::type cro = crossover::EXPONENTIAL);
98 std::string get_name()
const;
100 std::string human_readable_extra()
const;
102 friend class boost::serialization::access;
103 template <
class Archive>
104 void serialize(Archive &ar,
const unsigned int)
106 ar & boost::serialization::base_object<base>(*this);
107 ar &
const_cast<int &
>(m_gen);
108 ar &
const_cast<double &
>(m_cr);
109 ar &
const_cast<double &
>(m_m);
110 ar &
const_cast<int &
>(m_elitism);
111 ar &
const_cast<mutation &
>(m_mut);
112 ar &
const_cast<selection::type &
>(m_sel);
113 ar &
const_cast<crossover::type &
>(m_cro);
125 const mutation m_mut;
127 const selection::type m_sel;
129 const crossover::type m_cro;
136 #endif // PAGMO_ALGORITHM_SGA_H
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base algorithm.
type
Selection type, best 20% or roulette.
type
Crossover type, binomial or exponential.
double m_width
Mutation width.
type
Mutation type, gaussian or random.
The Simple Genetic Algorithm (SGA)
type m_type
Mutation type.
mutation(mutation::type t, double width)
Constructor.