PaGMO  1.1.5
Public Member Functions | Friends
pagmo::migration::base_r_policy Class Referenceabstract

Base class for migration replacement policies. More...

#include <base_r_policy.h>

Inheritance diagram for pagmo::migration::base_r_policy:
Inheritance graph
[legend]

Public Member Functions

 base_r_policy (const double &rate=1, rate_type type=fractional)
 Constructor from migration rate and type. More...
 
virtual ~base_r_policy ()
 Trivial destructor. More...
 
virtual base_r_policy_ptr clone () const =0
 Clone method. More...
 
virtual std::vector< std::pair< population::size_type, std::vector< population::individual_type >::size_type > > select (const std::vector< population::individual_type > &immigrants, const population &destination) const =0
 Assign pairs of individuals for replacement during migration. 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.
 

Detailed Description

Base class for migration replacement policies.

The task of a migration replacement policy is to select in a population the individuals that will replaced by immigrating individuals. The selection is performed by the pure virtual select() method.

The base::get_n_individuals() method for this class is meant to represent the maximum number of individuals in the target population that can be replaced by the immigrants. How many of these will actually be replaced will depend on the specific policy implementation.

Author
Marek Rucinski (marek.nosp@m..ruc.nosp@m.inski.nosp@m.@gma.nosp@m.il.co.nosp@m.m)
Francesco Biscani (blues.nosp@m.carn.nosp@m.i@gma.nosp@m.il.c.nosp@m.om)
Dario Izzo (dario.nosp@m..izz.nosp@m.o@gma.nosp@m.il.c.nosp@m.om)

Definition at line 57 of file base_r_policy.h.

Constructor & Destructor Documentation

pagmo::migration::base_r_policy::base_r_policy ( const double &  rate = 1,
rate_type  type = fractional 
)

Constructor from migration rate and type.

Default replacement policy is to allow the replacement of the 100% of the target population.

Parameters
[in]ratemigration rate.
[in]typemigration rate type.
See also
migration::base::base().

Definition at line 39 of file base_r_policy.cpp.

pagmo::migration::base_r_policy::~base_r_policy ( )
virtual

Trivial destructor.

No side effects.

Definition at line 45 of file base_r_policy.cpp.

Member Function Documentation

virtual base_r_policy_ptr pagmo::migration::base_r_policy::clone ( ) const
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_r_policy, pagmo::migration::hv_fair_r_policy, pagmo::migration::fair_r_policy, pagmo::migration::random_r_policy, and pagmo::migration::worst_r_policy.

virtual std::vector<std::pair<population::size_type,std::vector<population::individual_type>::size_type> > pagmo::migration::base_r_policy::select ( const std::vector< population::individual_type > &  immigrants,
const population destination 
) const
pure virtual

Assign pairs of individuals for replacement during migration.

Note, that this method does not alter the target population, it just provides the replacement choice. The actual replacement is done in the archipelago class. The first element of a pair should be the index of the one from the destination population. The second one - the index of the individual from the immigrants vector which is to replace the first one.

Parameters
[in]immigrantsvector of incoming individuals.
[in]destinationpopulation into which the immigrants will be replaced.
Returns
replacement assignment.

Implemented in pagmo::migration::hv_greedy_r_policy, pagmo::migration::hv_fair_r_policy, pagmo::migration::fair_r_policy, pagmo::migration::random_r_policy, and pagmo::migration::worst_r_policy.


The documentation for this class was generated from the following files: