25 #include <boost/random/uniform_int.hpp>
30 #include "../exceptions.h"
31 #include "../population.h"
36 namespace pagmo {
namespace algorithm {
50 pagmo_throw(value_error,
"number of generations must be nonnegative");
76 pagmo_throw(value_error,
"The problem is not box constrained and EA is not suitable to solve it");
80 pagmo_throw(value_error,
"The problem has a continuous dimension and this (N+1)-EA Simple Evolutionary Algorithm is not suitable to solve it");
90 for (
int j = 0; j<m_gen; j++) {
99 new_gene = boost::uniform_int<int>(lb[j],ub[j])(
m_urng);
100 }
while(new_gene == offspring[j]);
101 offspring[j] = new_gene;
106 pop.push_back(offspring);
109 pop.erase(pop.get_worst_idx());
117 return "(N+1)-EA Simple Evolutionary Algorithm";
126 std::ostringstream s;
127 s <<
"gen:" << m_gen <<
' ';
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base algorithm.
base_ptr clone() const
Clone method.
std::vector< double > decision_vector
Decision vector type.
const individual_type & get_individual(const size_type &) const
Get constant reference to individual at position n.
(N+1)-EA Simple Evolutionary Algorithm
sea(int gen=1)
Constructor.
size_type get_dimension() const
Return global dimension.
std::string get_name() const
Algorithm name.
void evolve(population &) const
Evolve implementation.
size_type get_i_dimension() const
Return integer dimension.
c_size_type get_c_dimension() const
Return global constraints dimension.
const decision_vector & get_ub() const
Upper bounds getter.
rng_uint32 m_urng
Random number generator for unsigned integer values.
const decision_vector & get_lb() const
Lower bounds getter.
rng_double m_drng
Random number generator for double-precision floating point values.
decision_vector::size_type size_type
Problem's size type: the same as pagmo::decision_vector's size type.
std::string human_readable_extra() const
Extra human readable algorithm info.