Add islandNotifier to allow the mig and int policy to be checked in the island. The islandNotifier is added to the algorithm continuator and will make the island perform a binded task. In the case of island, the task is to check policies.

This commit is contained in:
quemy 2012-11-11 22:36:21 +01:00
commit cf561b537a
14 changed files with 498 additions and 93 deletions

View file

@ -37,6 +37,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <eo>
#include <abstractIsland.h>
#include <migPolicy.h>
#include <intPolicy.h>
#include <PPExpander.h>
#include <contWrapper.h>
#include <contDispatching.h>
@ -50,25 +51,57 @@ template<template <class> class EOAlgo, class EOT>
class Island : private ContWrapper<EOT>, public AIsland<EOT>
{
public:
/**
* Constructor
* @param _popSize Size of the algorithm population.
* @param _chromInit Population initializer.
* @param _intPolicy Integration policy
* @param _migPolicy Migration policy
* @param args Parameters to construct the algorithm of the island.
*/
template<class... Args>
Island(unsigned _popSize, eoInit<EOT>& _chromInit, eoReplacement<EOT>& _intPolicy, Policy<EOT>& _migPolicy, Args&... args);
Island(unsigned _popSize, eoInit<EOT>& _chromInit, IntPolicy<EOT>& _intPolicy, MigPolicy<EOT>& _migPolicy, Args&... args);
/**
* Start the island.
*/
void operator()();
/**
* Update the list of imigrants.
* @param _data Elements to integrate in the main population.
*/
void update(eoPop<EOT>& _data);
/**
* Return a reference to the island population.
* @return Reference to the island population
*/
eoPop<EOT>& getPop();
//friend void Policy<EOT>::notifyIsland(eoSelect<EOT>& _select) const;
/**
* Check if there is population to receive or to migrate
*/
virtual void check(void);
protected:
void send(eoSelect<EOT>& _select);
void receive(void);
/**
* Send population to mediator
* @param _select Method to select EOT to send
*/
virtual void send(eoSelect<EOT>& _select);
/**
* Check if there is population to receive
*/
virtual void receive(void);
eoPop<EOT> pop;
EOAlgo<EOT> algo;
std::queue<eoPop<EOT>*> listImigrants;
eoReplacement<EOT>& intPolicy;
IntPolicy<EOT>& intPolicy;
MigPolicy<EOT>& migPolicy;
};
#include <island.cpp>