28 #include "../population.h"
30 #include "base_s_policy.h"
31 #include "random_s_policy.h"
32 #include "../exceptions.h"
34 namespace pagmo {
namespace migration {
57 std::vector<population::individual_type> result;
60 std::vector<population::size_type> candidates_idx(boost::numeric_cast<std::vector<population::size_type>::size_type>(pop.size()));
66 random_shuffle(candidates_idx.begin(),candidates_idx.end());
Base class for migration selection policies.
const individual_type & get_individual(const size_type &) const
Get constant reference to individual at position n.
population::size_type get_n_individuals(const population &) const
Get number of individuals to migrate from/to input population.
std::vector< population::individual_type > select(population &) const
Select individuals to emigrate from the given population.
random_s_policy(const double &rate=1, rate_type type=absolute)
Constructor from migration rate and type.
Random migration selection policy.
boost::shared_ptr< base_s_policy > base_s_policy_ptr
Shared pointer to base selection policy.
static void iota(ForwardIterator first, ForwardIterator last, T value)
Iota function, usefull to fill iterator range with increasing values.
container_type::size_type size_type
Population size type.
base_s_policy_ptr clone() const
Clone method.
rate_type
Type of migration rate.