26 #include <boost/numeric/conversion/cast.hpp>
30 #include "../population.h"
33 #include "base_r_policy.h"
34 #include "random_r_policy.h"
36 namespace pagmo {
namespace migration {
52 std::vector<std::pair<population::size_type,std::vector<population::individual_type>::size_type> >
57 std::vector<population::size_type> immigrants_idx(boost::numeric_cast<std::vector<population::size_type>::size_type>(immigrants.size()));
58 std::vector<population::size_type> dest_idx(boost::numeric_cast<std::vector<population::size_type>::size_type>(dest.size()));
66 std::swap(immigrants_idx[i], immigrants_idx[next_idx]);
73 std::swap(dest_idx[i], dest_idx[next_idx]);
77 std::vector<std::pair<population::size_type,std::vector<population::individual_type>::size_type> >
80 retval.push_back(std::make_pair(dest_idx[i],immigrants_idx[i]));
Generic thread-safe generator of pseudo-random number generators.
Base class for migration replacement policies.
boost::shared_ptr< base_r_policy > base_r_policy_ptr
Shared pointer to base replacement policy.
This rng returns an unsigned integer in the [0,2**32-1] range.
base_r_policy_ptr clone() const
Clone method.
std::vector< std::pair< population::size_type, std::vector< population::individual_type >::size_type > > select(const std::vector< population::individual_type > &, const population &) const
Assign pairs of individuals for replacement during migration.
population::size_type get_n_individuals(const population &) const
Get number of individuals to migrate from/to input population.
Random replacement 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.
random_r_policy(const double &rate=1, rate_type type=absolute)
Constructor.
rate_type
Type of migration rate.