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
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
*/
@ -100,7 +100,7 @@ protected:
void operator()(eoPop<EOT>& pop, const eoEasyEA_tag&);
/**
* Specifid algorithm for EasyPSO
* Specific algorithm for EasyPSO
*/
void operator()(eoPop<EOT>& pop, const eoEasyPSO_tag&);

View file

@ -41,14 +41,15 @@ namespace smp
{
// Forward declaration
template<class EOT>
template<class bEOT>
class IslandModel;
/** AbstractIsland: An abstract island.
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>
@ -59,26 +60,31 @@ public:
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;
/**
* 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;
/**
* 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;
/**
* Check if the algorithm is stopped.
* @return true if stopped
* @return true if stopped.
*/
virtual bool isStopped(void) const = 0;
/**
* Receive population by integrate individuals.
*/
virtual void receive(void) = 0;
protected:

View file

@ -38,7 +38,7 @@ namespace smp
{
/** 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

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

View file

@ -32,7 +32,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
/** 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
* @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:
eoCheckPoint<EOT> ck;

View file

@ -45,18 +45,33 @@ namespace paradiseo
namespace smp
{
/** HomogeneousIslandModel: Wrapper to create homogeneous model easily
@see smp::IslandModel
*/
template<template <class> class EOAlgo, class EOT>
class HomogeneousIslandModel
{
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>
HomogeneousIslandModel(unsigned _islandNumber, AbstractTopology& _topo, unsigned _popSize, eoInit<EOT> &_chromInit, IslandInit... args);
/**
* Destructor
*/
~HomogeneousIslandModel();
void operator()();
/**
* Get populations
* @return Populations
*/
std::vector<eoPop<EOT>>& getPop();
protected:

View file

@ -39,7 +39,7 @@ namespace smp
/** 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
*/

View file

@ -55,7 +55,8 @@ namespace smp
{
/** 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
*/
@ -68,8 +69,7 @@ public:
* Constructor
* @param _convertFromBase Function to convert EOT from base EOT
* @param _convertToBase Function to convert base EOT to EOT
* @param _popSize Size of the algorithm population.
* @param _chromInit Population initializer.
* @param _pop Population of the island
* @param _intPolicy Integration policy
* @param _migPolicy Migration policy
* @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);
/**
* Constructor
* @param _popSize Size of the algorithm population.
* @param _chromInit Population initializer.
* @param _pop Population of the island
* @param _intPolicy Integration policy
* @param _migPolicy Migration policy
* @param args Parameters to construct the algorithm.

View file

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

View file

@ -50,8 +50,16 @@ template <class EOT>
class IslandNotifier : public eoUpdater
{
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);
/**
* Notify the island by performing the binded task
*/
virtual void operator()();
protected :

View file

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

View file

@ -38,7 +38,7 @@ namespace smp
{
/** 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.
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.
*/