peoAsyncIslandMig< EOT > Class Template Reference

The peoAsyncIslandMig class offers the elementary basis for implementating an asynchronous island migration model - requires the specification of several basic parameters, i.e. More...

#include <peoAsyncIslandMig.h>

Inheritance diagram for peoAsyncIslandMig< EOT >:

Cooperative eoUpdater Communicable eoF< void > eoFunctorBase List of all members.

Public Member Functions

 peoAsyncIslandMig (eoContinue< EOT > &__cont, eoSelect< EOT > &__select, eoReplacement< EOT > &__replace, Topology &__topology, eoPop< EOT > &__source, eoPop< EOT > &__destination)
 Constructor for the peoAsyncIslandMig class; the characteristics of the migration model are defined through the specified parameters - out of the box objects provided in EO, etc., or custom, derived objects may be passed as parameters.
void operator() ()
 Function operator to be called as checkpoint for performing the migration step.
void pack ()
 Auxiliary function dealing with sending the emigrant individuals. There is no need to explicitly call the function.
void unpack ()
 Auxiliary function dealing with receiving immigrant individuals. There is no need to explicitly call the function.

Private Member Functions

void emigrate ()
void immigrate ()

Private Attributes

eoContinue< EOT > & cont
eoSelect< EOT > & select
eoReplacement< EOT > & replace
Topologytopology
eoPop< EOT > & source
eoPop< EOT > & destination
std::queue< eoPop< EOT > > imm
std::queue< eoPop< EOT > > em
std::queue< Cooperative * > coop_em

Detailed Description

template<class EOT>
class peoAsyncIslandMig< EOT >

The peoAsyncIslandMig class offers the elementary basis for implementating an asynchronous island migration model - requires the specification of several basic parameters, i.e.

continuation criterion, selection and replacement strategies, a topological model and the source and destination population for the migrating individuals. As opposed to the synchronous migration model, in the asynchronous migration approach, there is no synchronization step between islands after performing the emigration phase.

The migration operator is called at the end of each generation of an evolutionary algorithms as a checkpoint object - the following code exposes the structure of a classic evolutionary algorithm:

do {    
         select( population, offsprings );   // select the offsprings from the current population
         transform( offsprings );   // crossover and mutation operators are applied on the selected offsprings
         evaluate( offsprings );   // evaluation step of the resulting offsprings
         replace( population, offsprings );   // replace the individuals in the current population whith individuals from the offspring population, according to a specified replacement strategy
} while ( eaCheckpointContinue( population ) );   // checkpoint operators are applied on the current population, including the migration operator, if any specified

Constructing an asynchronous island migration model requires having defined (1) a topological migration model, (2) the control parameters of the migration process, (3) a checkpoint object associated with an evolutionary algorithm, and (4) an owner object must be set. The owner object must be derived from the Runner class (for example a peoEA object represents a possible owner). A simple example is offered bellow:

  1. topological model to be followed when performing migrations:

    RingTopology migTopology;   // a simple ring topological model - each island communicates with two other islands

  2. the continuation criterion, selection and replacement strategy etc. are defined:

    eoPop< EOT > population( POP_SIZE, popInitializer );   // population of individuals to be used for the evolutionary algorithm
       
    eoPeriodicContinue< EOT > migCont( MIG_FREQ );   // migrations occur periodically at MIG_FREQ iterations
    eoRandomSelect< EOT > migSelectStrategy;   // selection strategy - in this case a random selection is applied
    eoSelectNumber< EOT > migSelect( migSelectStrategy, MIG_SIZE );   // number of individuals to be selected using the specified strategy
    eoPlusReplacement< EOT > migReplace;   // immigration strategy - the worse individuals in the destination population are replaced by the immigrant individuals
       
    peoAsyncIslandMig< EOT > asyncMigration(
             migCont, migSelect, migReplace, migTopology,
             population, population
    );  
    // asynchronous migration object - the emigrant individuals are selected from the same from population in which the immigrant individuals are being integrated

  3. creation of a checkpoint object as part of the definition of an evolutionary algoritm (details of th EA not given as being out of scope):

    ...    
    eoGenContinue< EOT > eaCont( NUM_GEN );   // the evolutionary algorithm will stop after NUM_GEN generations
    eoCheckPoint< EOT > eaCheckpointContinue( eaCont );   // number of individuals to be selected using the specified strategy
    ...    
    eaCheckpointContinue.add( asyncMigration );   // adding the migration operator as checkpoint element
    ...    

  4. definition of an owner evolutionary algorithm (an object inheriting the Runner class):

    peoEA< EOT > eaAlg( eaCheckpointContinue, eaPopEval, eaSelect, eaTransform, eaReplace);   // evolutionary algorithm having as checkpoint the eaCheckpointContinue object defined above
    asyncMigration.setOwner( eaAlg );   // setting the evolutionary algorithm as owner of the migration object
    eaAlg( population );   // applying the evolutionary algorithm on a given population

The source and the destination population for the migration object were specified as being the same, in step no. 2, as we are usually interested in selecting the emigrants and integrating the immigrant individuals from and in, respectively, one unique population, iteratively evolved by an evolutionary algorithm. There is no restriction in having two distinct populations as source and destination for the emigrant and immigrant individuals respectively.

The above steps only create an asynchronous migration object associated to an evolutionary algorithm. The creation of several islands requires the reiteration of the steps 2 through 4 for creating distinct algorithms, with distinct populations and the associated distinctly parametrized migration objects. The interconnecting element is the underlying topology, defined at step 1 (the same C++ migTopology object has to be passed as parameter for all the migration objects, in order to interconnect them).

Definition at line 140 of file peoAsyncIslandMig.h.


Constructor & Destructor Documentation

template<class EOT>
peoAsyncIslandMig< EOT >::peoAsyncIslandMig ( eoContinue< EOT > &  __cont,
eoSelect< EOT > &  __select,
eoReplacement< EOT > &  __replace,
Topology __topology,
eoPop< EOT > &  __source,
eoPop< EOT > &  __destination 
)

Constructor for the peoAsyncIslandMig class; the characteristics of the migration model are defined through the specified parameters - out of the box objects provided in EO, etc., or custom, derived objects may be passed as parameters.

Parameters:
eoContinue< EOT >& __cont - continuation criterion specifying whether the migration is performed or not;
eoSelect< EOT >& __select - selection strategy to be applied for constructing a list of emigrant individuals out of the source population;
eoReplacement< EOT >& __replace - replacement strategy used for integrating the immigrant individuals in the destination population;
Topology& __topology - topological model to be followed when performing migrations;
eoPop< EOT >& __source - source population from which the emigrant individuals are selected;
eoPop< EOT >& __destination - destination population in which the immigrant population are integrated.

Definition at line 199 of file peoAsyncIslandMig.h.

References Topology::add().


Member Function Documentation

template<class EOT>
void peoAsyncIslandMig< EOT >::operator() (  )  [virtual]

Function operator to be called as checkpoint for performing the migration step.

The emigrant individuals are selected from the source population and sent to the next island (defined by the topology object) while the immigrant individuals are integrated in the destination population. There is no need to explicitly call the function - the wrapper checkpoint object (please refer to the above example) will perform the call when required.

Implements eoF< void >.

Definition at line 276 of file peoAsyncIslandMig.h.

References peoAsyncIslandMig< EOT >::cont, peoAsyncIslandMig< EOT >::emigrate(), peoAsyncIslandMig< EOT >::immigrate(), and peoAsyncIslandMig< EOT >::source.


The documentation for this class was generated from the following file:
Generated on Mon Oct 8 11:16:47 2007 for ParadisEO-PEOMovingObjects by  doxygen 1.4.7