PaGMO
1.1.5
|
Base class for migration selection policies. More...
#include <base_s_policy.h>
Public Member Functions | |
base_s_policy (const double &rate=1, rate_type type=absolute) | |
Constructor from migration rate and type. More... | |
virtual | ~base_s_policy () |
Trivial destructor. More... | |
virtual base_s_policy_ptr | clone () const =0 |
Clone method. More... | |
virtual std::vector< population::individual_type > | select (population &pop) const =0 |
Select individuals to emigrate from the given population. More... | |
Public Member Functions inherited from pagmo::migration::base | |
base (const double &, rate_type) | |
Constructor from migration rate and type. More... | |
population::size_type | get_n_individuals (const population &) const |
Get number of individuals to migrate from/to input population. More... | |
std::string | human_readable () const |
Return human readable representation. More... | |
virtual | ~base () |
Destructor. More... | |
Friends | |
class | boost::serialization::access |
Additional Inherited Members | |
Protected Member Functions inherited from pagmo::migration::base | |
virtual std::string | human_readable_extra () const |
Return extra information in human readable representation. More... | |
Static Protected Member Functions inherited from pagmo::migration::base | |
template<class ForwardIterator , class T > | |
static void | iota (ForwardIterator first, ForwardIterator last, T value) |
Iota function, usefull to fill iterator range with increasing values. More... | |
Protected Attributes inherited from pagmo::migration::base | |
double | m_rate |
Migration rate. More... | |
rate_type | m_type |
Migration rate type. | |
Base class for migration selection policies.
The task of a migration selection policy is to select in a population the individuals that will emigrate. The selection is performed by the pure virtual select() method.
The base::get_n_individuals() method for this class is meant to represent the number of individuals emigrating from the population.
Definition at line 54 of file base_s_policy.h.
pagmo::migration::base_s_policy::base_s_policy | ( | const double & | rate = 1 , |
rate_type | type = absolute |
||
) |
Constructor from migration rate and type.
By default, one single individual will be selected for migration.
[in] | rate | migration rate. |
[in] | type | migration rate type. |
Definition at line 39 of file base_s_policy.cpp.
|
virtual |
|
pure virtual |
Clone method.
Provided that the derived policy implements properly the copy constructor, virtually all implementations of this method will look like this:
return base_ptr(new derived_policy(*this));
@return migration::base_s_policy_ptr to a copy of this.
Implemented in pagmo::migration::hv_greedy_s_policy, pagmo::migration::best_s_policy, pagmo::migration::hv_best_s_policy, pagmo::migration::best_kill_s_policy, and pagmo::migration::random_s_policy.
|
pure virtual |
Select individuals to emigrate from the given population.
This is the method that actually implements the policy. Output vector should contain copies of selected individuals.
[in,out] | pop | source population. In some cases (see best_kill_s-policy) it can be modified (e.g. killing the selected individual) |
Implemented in pagmo::migration::hv_greedy_s_policy, pagmo::migration::best_s_policy, pagmo::migration::hv_best_s_policy, pagmo::migration::best_kill_s_policy, and pagmo::migration::random_s_policy.