Update documentation

This commit is contained in:
quemy 2012-12-09 21:42:47 +01:00
commit c4e2fb4507
14 changed files with 93 additions and 65 deletions

View file

@ -48,7 +48,7 @@ namespace smp
/** MWModel: Master / Worker Model for multicore computation /** MWModel: Master / Worker Model for multicore computation
The MW Model wraps any algorithm in order to apply it on several populations. The MW Model wraps any algorithm in order to dispatch load between threads.
@see smp::Worker, smp::Thread @see smp::Worker, smp::Thread
*/ */
@ -100,7 +100,7 @@ protected:
void operator()(eoPop<EOT>& pop, const eoEasyEA_tag&); void operator()(eoPop<EOT>& pop, const eoEasyEA_tag&);
/** /**
* Specifid algorithm for EasyPSO * Specific algorithm for EasyPSO
*/ */
void operator()(eoPop<EOT>& pop, const eoEasyPSO_tag&); void operator()(eoPop<EOT>& pop, const eoEasyPSO_tag&);

View file

@ -41,14 +41,15 @@ namespace smp
{ {
// Forward declaration // Forward declaration
template<class EOT> template<class bEOT>
class IslandModel; class IslandModel;
/** AbstractIsland: An abstract island. /** AbstractIsland: An abstract island.
The abstract island is used to manipulate island pointers wihout the knowledge of the algorithm. The abstract island is used to manipulate island pointers wihout the knowledge of the algorithm.
The template is the base type for individuals.
@see smp::Island @see smp::Island smp::IslandModel
*/ */
template<class bEOT> template<class bEOT>
@ -59,26 +60,31 @@ public:
virtual void operator()() = 0; virtual void operator()() = 0;
/** /**
* Check if there is population to receive * Set the Island Model.
* @param _model The model which manipulate the island.
*/ */
virtual void setModel(IslandModel<bEOT>* _model) = 0; virtual void setModel(IslandModel<bEOT>* _model) = 0;
/** /**
* Check if there is population to receive or to emigrate * Check if there is population to receive or to emigrate.
*/ */
virtual void check(void) = 0; virtual void check(void) = 0;
/** /**
* Update the island by adding population to send in the imigrants list. * Update the island by adding population to send in the imigrants list.
* @param _data Population to integrate.
*/ */
virtual void update(eoPop<bEOT> _data) = 0; virtual void update(eoPop<bEOT> _data) = 0;
/** /**
* Check if the algorithm is stopped. * Check if the algorithm is stopped.
* @return true if stopped * @return true if stopped.
*/ */
virtual bool isStopped(void) const = 0; virtual bool isStopped(void) const = 0;
/**
* Receive population by integrate individuals.
*/
virtual void receive(void) = 0; virtual void receive(void) = 0;
protected: protected:

View file

@ -38,7 +38,7 @@ namespace smp
{ {
/** Algo Dispatching /** Algo Dispatching
The Algo Dispatching enable to choose the algorithm to call at compile time by tag-dispatching method The Algo Dispatching enables to choose the algorithm to call at compile time by tag-dispatching method
**/ **/

View file

@ -53,55 +53,51 @@ public:
* @param A right key * @param A right key
* @param B left key * @param B left key
*/ */
void add(A& a, B& b) void add(A& a, B& b);
{
rightAssociation[a] = b;
leftAssociation[b] = a;
}
std::map<A,B> getRight() const /**
{ * Return a map which represents the right association.
return rightAssociation; * @return rightAssociation
} */
std::map<A,B> getRight() const;
std::map<B,A> getLeft() const /**
{ * Return a map which represents the left association.
return leftAssociation; * @return leftAssociation
} */
std::map<B,A> getLeft() const;
void removeFromRight(const A& a) /**
{ * Remove an association from a right key.
for(auto& it : leftAssociation) * @param Right key of the association to be removed.
if(it->second == a) */
leftAssociation.erase(it); void removeFromRight(const A& a);
rightAssociation.erase(a); /**
} * Remove an association from a left key.
* @param Left key of the association to be removed.
*/
void removeFromLeft(const B& b);
void removeFromLeft(const B& b) /**
{ * Return the number of associations.
for(auto& it : rightAssociation) * @return Size of bimap
if(it->second == b) */
rightAssociation.erase(it); unsigned size() const;
leftAssociation.erase(b); /**
} * Check if the bimap is empty
* @return true if the bimap is empty
unsigned size() const */
{ bool empty() const;
return leftAssociation.size();
}
bool empty() const
{
return leftAssociation.empty();
}
protected: protected:
std::map<A,B> rightAssociation; std::map<A,B> rightAssociation;
std::map<B,A> leftAssociation; std::map<B,A> leftAssociation;
}; };
#include <bimap.cpp>
} }
} }

View file

@ -32,7 +32,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
/** Continuator Dispatching /** Continuator Dispatching
The Continuator Dispatching enable to wrap continuators in Island constructor for a better user interface The Continuator Dispatching enables to wrap continuators in the Island constructor for a better user interface and, moreover, avoiding side effect.
**/ **/

View file

@ -57,9 +57,9 @@ public:
/** /**
* Constructor * Constructor
* @param _cont Original continuators * @param _cont Original continuators
* @param _policy Policy to wrap with continuators * @param _island Pointer on the island used by the notifier
*/ */
ContWrapper(eoContinue<EOT>& _cont, AIsland<bEOT>* island); ContWrapper(eoContinue<EOT>& _cont, AIsland<bEOT>* _island);
protected: protected:
eoCheckPoint<EOT> ck; eoCheckPoint<EOT> ck;

View file

@ -45,18 +45,33 @@ namespace paradiseo
namespace smp namespace smp
{ {
/** HomogeneousIslandModel: Wrapper to create homogeneous model easily
@see smp::IslandModel
*/
template<template <class> class EOAlgo, class EOT> template<template <class> class EOAlgo, class EOT>
class HomogeneousIslandModel class HomogeneousIslandModel
{ {
public: public:
/**
* Constructor
* @param _islandNumber number of islands to create
* @param _topo Topology
* @param args... list of parameters according to the constructor of the island
*/
template<class... IslandInit> template<class... IslandInit>
HomogeneousIslandModel(unsigned _islandNumber, AbstractTopology& _topo, unsigned _popSize, eoInit<EOT> &_chromInit, IslandInit... args); HomogeneousIslandModel(unsigned _islandNumber, AbstractTopology& _topo, unsigned _popSize, eoInit<EOT> &_chromInit, IslandInit... args);
/**
* Destructor
*/
~HomogeneousIslandModel(); ~HomogeneousIslandModel();
void operator()(); /**
* Get populations
* @return Populations
*/
std::vector<eoPop<EOT>>& getPop(); std::vector<eoPop<EOT>>& getPop();
protected: protected:

View file

@ -39,7 +39,7 @@ namespace smp
/** IntPolicy: Integration policy for island. /** IntPolicy: Integration policy for island.
The island model will check its policy to know how to integrate population sent by other islands. The island model will check its policy to know how to integrate populations sent by other islands.
@see smp::Island, smp::MigPolicy @see smp::Island, smp::MigPolicy
*/ */

View file

@ -55,7 +55,8 @@ namespace smp
{ {
/** Island: Concrete island that wraps an algorithm /** Island: Concrete island that wraps an algorithm
The island wraps an algorithm and provide mecanism for emigration and integration of populations. The island wraps an algorithm and provide mecanisms for emigration and integration of populations.
An island also have a base type which represents the type of individuals of the Island Model.
@see smp::AbstractIsland, smp::MigPolicy @see smp::AbstractIsland, smp::MigPolicy
*/ */
@ -68,8 +69,7 @@ public:
* Constructor * Constructor
* @param _convertFromBase Function to convert EOT from base EOT * @param _convertFromBase Function to convert EOT from base EOT
* @param _convertToBase Function to convert base EOT to EOT * @param _convertToBase Function to convert base EOT to EOT
* @param _popSize Size of the algorithm population. * @param _pop Population of the island
* @param _chromInit Population initializer.
* @param _intPolicy Integration policy * @param _intPolicy Integration policy
* @param _migPolicy Migration policy * @param _migPolicy Migration policy
* @param args Parameters to construct the algorithm. * @param args Parameters to construct the algorithm.
@ -78,8 +78,7 @@ public:
Island(std::function<EOT(bEOT&)> _convertFromBase, std::function<bEOT(EOT&)> _convertToBase, eoPop<EOT>& pop, IntPolicy<EOT>& _intPolicy, MigPolicy<EOT>& _migPolicy, Args&... args); Island(std::function<EOT(bEOT&)> _convertFromBase, std::function<bEOT(EOT&)> _convertToBase, eoPop<EOT>& pop, IntPolicy<EOT>& _intPolicy, MigPolicy<EOT>& _migPolicy, Args&... args);
/** /**
* Constructor * Constructor
* @param _popSize Size of the algorithm population. * @param _pop Population of the island
* @param _chromInit Population initializer.
* @param _intPolicy Integration policy * @param _intPolicy Integration policy
* @param _migPolicy Migration policy * @param _migPolicy Migration policy
* @param args Parameters to construct the algorithm. * @param args Parameters to construct the algorithm.

View file

@ -46,14 +46,11 @@ namespace smp
/** IslandModel /** IslandModel
The IslandModel object is an island container that provides mecanism in order to perform a The IslandModel object is an island container that provides mecanisms in order to manage island communications according to a topology.
island model pattern according to a topology.
@see smp::Island, smp::MigPolicy @see smp::Island, smp::MigPolicy
*/ */
template<class EOT> template<class EOT>
class IslandModel class IslandModel
{ {

View file

@ -50,8 +50,16 @@ template <class EOT>
class IslandNotifier : public eoUpdater class IslandNotifier : public eoUpdater
{ {
public : public :
/**
* Constructor
* @param _observer Island which will perform the task
* @param _task Task to perform each generation
*/
IslandNotifier(AIsland<EOT>* _observer, std::function<void(AIsland<EOT>*)> _task); IslandNotifier(AIsland<EOT>* _observer, std::function<void(AIsland<EOT>*)> _task);
/**
* Notify the island by performing the binded task
*/
virtual void operator()(); virtual void operator()();
protected : protected :

View file

@ -45,8 +45,15 @@ namespace smp
class Notifier : public eoUpdater class Notifier : public eoUpdater
{ {
public : public :
/**
* Constructor
* @param _task task to perform each generation
*/
Notifier(std::function<void(void)> _task); Notifier(std::function<void(void)> _task);
/**
* Performing the binded task
*/
virtual void operator()(); virtual void operator()();
protected : protected :

View file

@ -38,7 +38,7 @@ namespace smp
{ {
/** Policies Dispatching /** Policies Dispatching
The Policies Dispatching enable to choose the policy to call at compile time by tag-dispatching method The Policies Dispatching enables to choose the policy to call at compile time by tag-dispatching method
**/ **/

View file

@ -38,7 +38,7 @@ namespace smp
{ {
/** PolicyElement: PolicyElement is an element of a migration policy. /** PolicyElement: PolicyElement is an element of a migration policy.
The policy element is a pair of a selection method and a criterion to apply the selection. The policy element is a pair made of a selection method and a criterion to apply the selection.
*/ */