new style peo
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1021 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
ef8ef3f3b2
commit
edb6d65a7b
34 changed files with 407 additions and 386 deletions
|
|
@ -80,10 +80,10 @@ COMM_ID getKey (const Communicable * __comm)
|
||||||
}
|
}
|
||||||
|
|
||||||
void Communicable :: lock ()
|
void Communicable :: lock ()
|
||||||
{
|
{
|
||||||
|
|
||||||
sem_wait (& sem_lock);
|
sem_wait (& sem_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Communicable :: unlock ()
|
void Communicable :: unlock ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -38,16 +38,19 @@
|
||||||
#include "complete_topo.h"
|
#include "complete_topo.h"
|
||||||
|
|
||||||
void CompleteTopology :: setNeighbors (Cooperative * __mig,
|
void CompleteTopology :: setNeighbors (Cooperative * __mig,
|
||||||
std :: vector <Cooperative *> & __from,
|
std :: vector <Cooperative *> & __from,
|
||||||
std :: vector <Cooperative *> & __to) {
|
std :: vector <Cooperative *> & __to)
|
||||||
|
{
|
||||||
|
|
||||||
__from.clear () ;
|
__from.clear () ;
|
||||||
__to.clear () ;
|
__to.clear () ;
|
||||||
|
|
||||||
for (unsigned i = 0; i < mig.size (); i ++) {
|
for (unsigned i = 0; i < mig.size (); i ++)
|
||||||
if (mig [i] != __mig) {
|
{
|
||||||
__from.push_back (mig [i]);
|
if (mig [i] != __mig)
|
||||||
__to.push_back (mig [i]);
|
{
|
||||||
}
|
__from.push_back (mig [i]);
|
||||||
|
__to.push_back (mig [i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,14 @@
|
||||||
|
|
||||||
#include "topology.h"
|
#include "topology.h"
|
||||||
|
|
||||||
class CompleteTopology : public Topology {
|
class CompleteTopology : public Topology
|
||||||
|
{
|
||||||
|
|
||||||
public :
|
public :
|
||||||
|
|
||||||
void setNeighbors (Cooperative * __mig,
|
void setNeighbors (Cooperative * __mig,
|
||||||
std :: vector <Cooperative *> & __from,
|
std :: vector <Cooperative *> & __from,
|
||||||
std :: vector <Cooperative *> & __to);
|
std :: vector <Cooperative *> & __to);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -40,16 +40,19 @@
|
||||||
#include <utils/eoRNG.h>
|
#include <utils/eoRNG.h>
|
||||||
|
|
||||||
void RandomTopology :: setNeighbors (Cooperative * __mig,
|
void RandomTopology :: setNeighbors (Cooperative * __mig,
|
||||||
std :: vector <Cooperative *> & __from,
|
std :: vector <Cooperative *> & __from,
|
||||||
std :: vector <Cooperative *> & __to) {
|
std :: vector <Cooperative *> & __to)
|
||||||
|
{
|
||||||
|
|
||||||
__from.clear () ;
|
__from.clear () ;
|
||||||
__to.clear () ;
|
__to.clear () ;
|
||||||
|
|
||||||
for (unsigned i = 0; i < mig.size (); i ++) {
|
for (unsigned i = 0; i < mig.size (); i ++)
|
||||||
if (mig [i] != __mig && rng.uniform() < 0.5 ) {
|
{
|
||||||
__from.push_back (mig [i]);
|
if (mig [i] != __mig && rng.uniform() < 0.5 )
|
||||||
__to.push_back (mig [i]);
|
{
|
||||||
}
|
__from.push_back (mig [i]);
|
||||||
|
__to.push_back (mig [i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,14 @@
|
||||||
|
|
||||||
#include "topology.h"
|
#include "topology.h"
|
||||||
|
|
||||||
class RandomTopology : public Topology {
|
class RandomTopology : public Topology
|
||||||
|
{
|
||||||
|
|
||||||
public :
|
public :
|
||||||
|
|
||||||
void setNeighbors (Cooperative * __mig,
|
void setNeighbors (Cooperative * __mig,
|
||||||
std :: vector <Cooperative *> & __from,
|
std :: vector <Cooperative *> & __from,
|
||||||
std :: vector <Cooperative *> & __to);
|
std :: vector <Cooperative *> & __to);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -40,30 +40,36 @@
|
||||||
StarTopology :: StarTopology () : center( NULL ) {}
|
StarTopology :: StarTopology () : center( NULL ) {}
|
||||||
|
|
||||||
void StarTopology :: setNeighbors (Cooperative * __mig,
|
void StarTopology :: setNeighbors (Cooperative * __mig,
|
||||||
std :: vector <Cooperative *> & __from,
|
std :: vector <Cooperative *> & __from,
|
||||||
std :: vector <Cooperative *> & __to) {
|
std :: vector <Cooperative *> & __to)
|
||||||
|
{
|
||||||
|
|
||||||
assert( center != NULL );
|
assert( center != NULL );
|
||||||
|
|
||||||
__from.clear () ;
|
__from.clear () ;
|
||||||
__to.clear () ;
|
__to.clear () ;
|
||||||
|
|
||||||
if ( __mig == center ) {
|
if ( __mig == center )
|
||||||
|
{
|
||||||
|
|
||||||
for (unsigned i = 0; i < mig.size (); i ++) {
|
for (unsigned i = 0; i < mig.size (); i ++)
|
||||||
if (mig [i] != center) {
|
{
|
||||||
__from.push_back (mig [i]);
|
if (mig [i] != center)
|
||||||
__to.push_back (mig [i]);
|
{
|
||||||
}
|
__from.push_back (mig [i]);
|
||||||
|
__to.push_back (mig [i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
__from.push_back (center);
|
||||||
|
__to.push_back (center);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
__from.push_back (center);
|
|
||||||
__to.push_back (center);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StarTopology :: setCenter (Cooperative& __center) {
|
void StarTopology :: setCenter (Cooperative& __center)
|
||||||
|
{
|
||||||
|
|
||||||
center = &__center;
|
center = &__center;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,21 +39,22 @@
|
||||||
|
|
||||||
#include "topology.h"
|
#include "topology.h"
|
||||||
|
|
||||||
class StarTopology : public Topology {
|
class StarTopology : public Topology
|
||||||
|
{
|
||||||
|
|
||||||
public :
|
public :
|
||||||
|
|
||||||
StarTopology ();
|
StarTopology ();
|
||||||
|
|
||||||
void setNeighbors (Cooperative * __mig,
|
void setNeighbors (Cooperative * __mig,
|
||||||
std :: vector <Cooperative *> & __from,
|
std :: vector <Cooperative *> & __from,
|
||||||
std :: vector <Cooperative *> & __to);
|
std :: vector <Cooperative *> & __to);
|
||||||
|
|
||||||
void setCenter (Cooperative& __center);
|
void setCenter (Cooperative& __center);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
Cooperative* center;
|
Cooperative* center;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,10 @@ Topology :: ~ Topology ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void Topology :: add (Cooperative & __mig)
|
void Topology :: add (Cooperative & __mig)
|
||||||
{
|
{
|
||||||
|
|
||||||
mig.push_back (& __mig) ;
|
mig.push_back (& __mig) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
Topology :: operator std :: vector <Cooperative *>& ()
|
Topology :: operator std :: vector <Cooperative *>& ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -67,18 +67,18 @@ template< class TYPESELECT, class TYPEREPLACE > class peoAsyncIslandMig : public
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
//! @param continuator & __cont
|
//! @param continuator & __cont
|
||||||
//! @param selector <TYPE> & __select
|
//! @param selector <TYPE> & __select
|
||||||
//! @param replacement <TYPE> & __replace
|
//! @param replacement <TYPE> & __replace
|
||||||
//! @param Topology& __topology
|
//! @param Topology& __topology
|
||||||
peoAsyncIslandMig(
|
peoAsyncIslandMig(
|
||||||
continuator & __cont,
|
continuator & __cont,
|
||||||
selector <TYPESELECT> & __select,
|
selector <TYPESELECT> & __select,
|
||||||
replacement <TYPEREPLACE> & __replace,
|
replacement <TYPEREPLACE> & __replace,
|
||||||
Topology& __topology
|
Topology& __topology
|
||||||
);
|
);
|
||||||
|
|
||||||
//! @brief operator
|
//! @brief operator
|
||||||
void operator()();
|
void operator()();
|
||||||
//! @brief Function realizing packages
|
//! @brief Function realizing packages
|
||||||
void pack();
|
void pack();
|
||||||
|
|
@ -88,19 +88,19 @@ template< class TYPESELECT, class TYPEREPLACE > class peoAsyncIslandMig : public
|
||||||
void packSynchronizeReq();
|
void packSynchronizeReq();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! @brief Function which sends some emigrants
|
//! @brief Function which sends some emigrants
|
||||||
void emigrate();
|
void emigrate();
|
||||||
//! @brief Function which receives some immigrants
|
//! @brief Function which receives some immigrants
|
||||||
void immigrate();
|
void immigrate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! @param continuator & cont
|
//! @param continuator & cont
|
||||||
//! @param selector <TYPESELECT> & select
|
//! @param selector <TYPESELECT> & select
|
||||||
//! @param replacement <TYPEREPLACE> & replace
|
//! @param replacement <TYPEREPLACE> & replace
|
||||||
//! @param Topology& topology
|
//! @param Topology& topology
|
||||||
//! @param std :: queue< TYPEREPLACE > imm
|
//! @param std :: queue< TYPEREPLACE > imm
|
||||||
//! @param std :: queue< TYPESELECT > em
|
//! @param std :: queue< TYPESELECT > em
|
||||||
//! @param std :: queue< Cooperative* > coop_em
|
//! @param std :: queue< Cooperative* > coop_em
|
||||||
continuator & cont;
|
continuator & cont;
|
||||||
selector <TYPESELECT> & select;
|
selector <TYPESELECT> & select;
|
||||||
replacement <TYPEREPLACE> & replace;
|
replacement <TYPEREPLACE> & replace;
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@ class continuator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! @brief Virtual function of check
|
//! @brief Virtual function of check
|
||||||
//! @return true if the algorithm must continue
|
//! @return true if the algorithm must continue
|
||||||
virtual bool check()=0;
|
virtual bool check()=0;
|
||||||
//! @brief Virtual destructor
|
//! @brief Virtual destructor
|
||||||
virtual ~continuator(){}
|
virtual ~continuator(){}
|
||||||
|
|
@ -69,22 +69,22 @@ template < class EOT> class eoContinuator : public continuator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
//! @param eoContinue<EOT> &
|
//! @param eoContinue<EOT> &
|
||||||
//! @param eoPop<EOT> &
|
//! @param eoPop<EOT> &
|
||||||
eoContinuator(eoContinue<EOT> & _cont, const eoPop<EOT> & _pop): cont (_cont), pop(_pop)
|
eoContinuator(eoContinue<EOT> & _cont, const eoPop<EOT> & _pop): cont (_cont), pop(_pop)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//! @brief Virtual function of check
|
//! @brief Virtual function of check
|
||||||
//! @return false if the algorithm must continue
|
//! @return false if the algorithm must continue
|
||||||
virtual bool check()
|
virtual bool check()
|
||||||
{
|
{
|
||||||
return cont(pop);
|
return cont(pop);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! @param eoContinue<EOT> &
|
//! @param eoContinue<EOT> &
|
||||||
//! @param eoPop<EOT> &
|
//! @param eoPop<EOT> &
|
||||||
eoContinue<EOT> & cont ;
|
eoContinue<EOT> & cont ;
|
||||||
const eoPop<EOT> & pop;
|
const eoPop<EOT> & pop;
|
||||||
};
|
};
|
||||||
|
|
@ -102,8 +102,8 @@ template < class TYPE> class selector
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! @brief Virtual operator on the template type
|
//! @brief Virtual operator on the template type
|
||||||
//! @param TYPE &
|
//! @param TYPE &
|
||||||
virtual void operator()(TYPE &)=0;
|
virtual void operator()(TYPE &)=0;
|
||||||
//! @brief Virtual destructor
|
//! @brief Virtual destructor
|
||||||
virtual ~selector(){}
|
virtual ~selector(){}
|
||||||
|
|
@ -119,16 +119,16 @@ template < class EOT, class TYPE> class eoSelector : public selector< TYPE >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
//! @param eoSelectOne<EOT> &
|
//! @param eoSelectOne<EOT> &
|
||||||
//! @param unsigned _nb_select
|
//! @param unsigned _nb_select
|
||||||
//! @param TYPE & _source (with TYPE which is the template type)
|
//! @param TYPE & _source (with TYPE which is the template type)
|
||||||
eoSelector(eoSelectOne<EOT> & _select, unsigned _nb_select, const TYPE & _source): selector (_select), nb_select(_nb_select), source(_source)
|
eoSelector(eoSelectOne<EOT> & _select, unsigned _nb_select, const TYPE & _source): selector (_select), nb_select(_nb_select), source(_source)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//! @brief Virtual operator on the template type
|
//! @brief Virtual operator on the template type
|
||||||
//! @param TYPE & _dest
|
//! @param TYPE & _dest
|
||||||
virtual void operator()(TYPE & _dest)
|
virtual void operator()(TYPE & _dest)
|
||||||
{
|
{
|
||||||
size_t target = static_cast<size_t>(nb_select);
|
size_t target = static_cast<size_t>(nb_select);
|
||||||
_dest.resize(target);
|
_dest.resize(target);
|
||||||
|
|
@ -137,9 +137,9 @@ template < class EOT, class TYPE> class eoSelector : public selector< TYPE >
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! @param eoSelectOne<EOT> &
|
//! @param eoSelectOne<EOT> &
|
||||||
//! @param unsigned nb_select
|
//! @param unsigned nb_select
|
||||||
//! @param TYPE & source
|
//! @param TYPE & source
|
||||||
eoSelectOne<EOT> & selector ;
|
eoSelectOne<EOT> & selector ;
|
||||||
unsigned nb_select;
|
unsigned nb_select;
|
||||||
const TYPE & source;
|
const TYPE & source;
|
||||||
|
|
@ -157,8 +157,8 @@ template < class EOT, class TYPE> class eoSelector : public selector< TYPE >
|
||||||
template < class TYPE> class replacement
|
template < class TYPE> class replacement
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! @brief Virtual operator on the template type
|
//! @brief Virtual operator on the template type
|
||||||
//! @param TYPE &
|
//! @param TYPE &
|
||||||
virtual void operator()(TYPE &)=0;
|
virtual void operator()(TYPE &)=0;
|
||||||
//! @brief Virtual destructor
|
//! @brief Virtual destructor
|
||||||
virtual ~replacement(){}
|
virtual ~replacement(){}
|
||||||
|
|
@ -173,22 +173,22 @@ template < class TYPE> class replacement
|
||||||
template < class EOT, class TYPE> class eoReplace : public replacement< TYPE >
|
template < class EOT, class TYPE> class eoReplace : public replacement< TYPE >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
//! @param eoReplacement<EOT> &
|
//! @param eoReplacement<EOT> &
|
||||||
//! @param TYPE & _destination (with TYPE which is the template type)
|
//! @param TYPE & _destination (with TYPE which is the template type)
|
||||||
eoReplace(eoReplacement<EOT> & _replace, TYPE & _destination): replace(_replace), destination(_destination)
|
eoReplace(eoReplacement<EOT> & _replace, TYPE & _destination): replace(_replace), destination(_destination)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//! @brief Virtual operator on the template type
|
//! @brief Virtual operator on the template type
|
||||||
//! @param TYPE & _source
|
//! @param TYPE & _source
|
||||||
virtual void operator()(TYPE & _source)
|
virtual void operator()(TYPE & _source)
|
||||||
{
|
{
|
||||||
replace(destination, _source);
|
replace(destination, _source);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! @param eoReplacement<EOT> &
|
//! @param eoReplacement<EOT> &
|
||||||
//! @param TYPE & destination
|
//! @param TYPE & destination
|
||||||
eoReplacement<EOT> & replace;
|
eoReplacement<EOT> & replace;
|
||||||
TYPE & destination;
|
TYPE & destination;
|
||||||
};
|
};
|
||||||
|
|
@ -207,14 +207,14 @@ class eoSyncContinue: public continuator
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
//! @param unsigned __period
|
//! @param unsigned __period
|
||||||
//! @param unsigned __init_counter
|
//! @param unsigned __init_counter
|
||||||
eoSyncContinue (unsigned __period, unsigned __init_counter = 0): period (__period),counter (__init_counter)
|
eoSyncContinue (unsigned __period, unsigned __init_counter = 0): period (__period),counter (__init_counter)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//! @brief Virtual function of check
|
//! @brief Virtual function of check
|
||||||
//! @return true if the algorithm must continue
|
//! @return true if the algorithm must continue
|
||||||
virtual bool check()
|
virtual bool check()
|
||||||
{
|
{
|
||||||
return ((++ counter) % period) != 0 ;
|
return ((++ counter) % period) != 0 ;
|
||||||
|
|
@ -222,8 +222,8 @@ class eoSyncContinue: public continuator
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! @param unsigned period
|
//! @param unsigned period
|
||||||
//! @param unsigned counter
|
//! @param unsigned counter
|
||||||
unsigned period;
|
unsigned period;
|
||||||
unsigned counter;
|
unsigned counter;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -50,21 +50,21 @@ template< class EOT, class FitT = typename EOT::Fitness, class FunctionArg = con
|
||||||
struct peoEvalFunc: public eoEvalFunc<EOT>
|
struct peoEvalFunc: public eoEvalFunc<EOT>
|
||||||
{
|
{
|
||||||
|
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
//! @param FitT (* _eval)( FunctionArg )
|
//! @param FitT (* _eval)( FunctionArg )
|
||||||
peoEvalFunc( FitT (* _eval)( FunctionArg ) )
|
peoEvalFunc( FitT (* _eval)( FunctionArg ) )
|
||||||
: eoEvalFunc<EOT>(), evalFunc( _eval )
|
: eoEvalFunc<EOT>(), evalFunc( _eval )
|
||||||
{};
|
{};
|
||||||
|
|
||||||
//! @brief Virtual operator
|
//! @brief Virtual operator
|
||||||
//! @param EOT & _peo
|
//! @param EOT & _peo
|
||||||
virtual void operator() ( EOT & _peo )
|
virtual void operator() ( EOT & _peo )
|
||||||
{
|
{
|
||||||
_peo.fitness((*evalFunc)( _peo ));
|
_peo.fitness((*evalFunc)( _peo ));
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! @param FitT (* evalFunc )( FunctionArg )
|
//! @param FitT (* evalFunc )( FunctionArg )
|
||||||
FitT (* evalFunc )( FunctionArg );
|
FitT (* evalFunc )( FunctionArg );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,8 @@ template< class EOT > class peoMoeoPopEval : public Service, public eoPopEvalFun
|
||||||
void operator()(eoPop< EOT >& __pop);
|
void operator()(eoPop< EOT >& __pop);
|
||||||
|
|
||||||
//! @brief Operator ()( eoPop< EOT >& __dummy, eoPop< EOT >& __pop )
|
//! @brief Operator ()( eoPop< EOT >& __dummy, eoPop< EOT >& __pop )
|
||||||
//! @param eoPop< EOT >& __dummy
|
//! @param eoPop< EOT >& __dummy
|
||||||
//! @param eoPop< EOT >& __pop
|
//! @param eoPop< EOT >& __pop
|
||||||
void operator()( eoPop< EOT >& __dummy, eoPop< EOT >& __pop );
|
void operator()( eoPop< EOT >& __dummy, eoPop< EOT >& __pop );
|
||||||
|
|
||||||
//! Auxiliary function for transferring data between the process requesting an evaluation operation and the process that
|
//! Auxiliary function for transferring data between the process requesting an evaluation operation and the process that
|
||||||
|
|
@ -105,16 +105,16 @@ template< class EOT > class peoMoeoPopEval : public Service, public eoPopEvalFun
|
||||||
void notifySendingAllResourceRequests();
|
void notifySendingAllResourceRequests();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! @param std :: vector< eoEvalFunc < EOT >* >& funcs
|
//! @param std :: vector< eoEvalFunc < EOT >* >& funcs
|
||||||
//! @param std :: vector< eoEvalFunc < EOT >* > one_func
|
//! @param std :: vector< eoEvalFunc < EOT >* > one_func
|
||||||
//! @param peoAggEvalFunc< EOT >& merge_eval
|
//! @param peoAggEvalFunc< EOT >& merge_eval
|
||||||
//! @param peoNoAggEvalFunc< EOT > no_merge_eval
|
//! @param peoNoAggEvalFunc< EOT > no_merge_eval
|
||||||
//! @param std :: queue< EOT* >tasks
|
//! @param std :: queue< EOT* >tasks
|
||||||
//! @param std :: map< EOT*, std :: pair< unsigned, unsigned > > progression
|
//! @param std :: map< EOT*, std :: pair< unsigned, unsigned > > progression
|
||||||
//! @param unsigned num_func
|
//! @param unsigned num_func
|
||||||
//! @param EOT sol
|
//! @param EOT sol
|
||||||
//! @param EOT *ad_sol
|
//! @param EOT *ad_sol
|
||||||
//! @param unsigned total
|
//! @param unsigned total
|
||||||
const std :: vector< eoEvalFunc < EOT >* >& funcs;
|
const std :: vector< eoEvalFunc < EOT >* >& funcs;
|
||||||
std :: vector< eoEvalFunc < EOT >* > one_func;
|
std :: vector< eoEvalFunc < EOT >* > one_func;
|
||||||
peoAggEvalFunc< EOT >& merge_eval;
|
peoAggEvalFunc< EOT >& merge_eval;
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ template < typename EntityType > class peoMultiStart : public Service
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
//! @param AlgorithmType& externalAlgorithm
|
//! @param AlgorithmType& externalAlgorithm
|
||||||
template < typename AlgorithmType > peoMultiStart( AlgorithmType& externalAlgorithm )
|
template < typename AlgorithmType > peoMultiStart( AlgorithmType& externalAlgorithm )
|
||||||
{
|
{
|
||||||
singularAlgorithm = new Algorithm< AlgorithmType >( externalAlgorithm );
|
singularAlgorithm = new Algorithm< AlgorithmType >( externalAlgorithm );
|
||||||
|
|
@ -60,8 +60,8 @@ template < typename EntityType > class peoMultiStart : public Service
|
||||||
aggregationFunction = new NoAggregationFunction();
|
aggregationFunction = new NoAggregationFunction();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
//! @param AlgorithmReturnType (*externalAlgorithm)( AlgorithmDataType& )
|
//! @param AlgorithmReturnType (*externalAlgorithm)( AlgorithmDataType& )
|
||||||
template < typename AlgorithmReturnType, typename AlgorithmDataType > peoMultiStart( AlgorithmReturnType (*externalAlgorithm)( AlgorithmDataType& ) )
|
template < typename AlgorithmReturnType, typename AlgorithmDataType > peoMultiStart( AlgorithmReturnType (*externalAlgorithm)( AlgorithmDataType& ) )
|
||||||
{
|
{
|
||||||
singularAlgorithm = new FunctionAlgorithm< AlgorithmReturnType, AlgorithmDataType >( externalAlgorithm );
|
singularAlgorithm = new FunctionAlgorithm< AlgorithmReturnType, AlgorithmDataType >( externalAlgorithm );
|
||||||
|
|
@ -69,9 +69,9 @@ template < typename EntityType > class peoMultiStart : public Service
|
||||||
aggregationFunction = new NoAggregationFunction();
|
aggregationFunction = new NoAggregationFunction();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
//! @param std::vector< AlgorithmType* >& externalAlgorithms
|
//! @param std::vector< AlgorithmType* >& externalAlgorithms
|
||||||
//! @param AggregationFunctionType& externalAggregationFunction
|
//! @param AggregationFunctionType& externalAggregationFunction
|
||||||
template < typename AlgorithmType, typename AggregationFunctionType > peoMultiStart( std::vector< AlgorithmType* >& externalAlgorithms, AggregationFunctionType& externalAggregationFunction )
|
template < typename AlgorithmType, typename AggregationFunctionType > peoMultiStart( std::vector< AlgorithmType* >& externalAlgorithms, AggregationFunctionType& externalAggregationFunction )
|
||||||
{
|
{
|
||||||
for ( unsigned int index = 0; index < externalAlgorithms.size(); index++ )
|
for ( unsigned int index = 0; index < externalAlgorithms.size(); index++ )
|
||||||
|
|
@ -81,9 +81,9 @@ template < typename EntityType > class peoMultiStart : public Service
|
||||||
aggregationFunction = new AggregationAlgorithm< AggregationFunctionType >( externalAggregationFunction );
|
aggregationFunction = new AggregationAlgorithm< AggregationFunctionType >( externalAggregationFunction );
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
//! @param std::vector< AlgorithmReturnType (*)( AlgorithmDataType& ) >& externalAlgorithms
|
//! @param std::vector< AlgorithmReturnType (*)( AlgorithmDataType& ) >& externalAlgorithms
|
||||||
//! @param AggregationFunctionType& externalAggregationFunction
|
//! @param AggregationFunctionType& externalAggregationFunction
|
||||||
template < typename AlgorithmReturnType, typename AlgorithmDataType, typename AggregationFunctionType > peoMultiStart( std::vector< AlgorithmReturnType (*)( AlgorithmDataType& ) >& externalAlgorithms, AggregationFunctionType& externalAggregationFunction )
|
template < typename AlgorithmReturnType, typename AlgorithmDataType, typename AggregationFunctionType > peoMultiStart( std::vector< AlgorithmReturnType (*)( AlgorithmDataType& ) >& externalAlgorithms, AggregationFunctionType& externalAggregationFunction )
|
||||||
{
|
{
|
||||||
for ( unsigned int index = 0; index < externalAlgorithms.size(); index++ )
|
for ( unsigned int index = 0; index < externalAlgorithms.size(); index++ )
|
||||||
|
|
@ -93,16 +93,16 @@ template < typename EntityType > class peoMultiStart : public Service
|
||||||
aggregationFunction = new AggregationAlgorithm< AggregationFunctionType >( externalAggregationFunction );
|
aggregationFunction = new AggregationAlgorithm< AggregationFunctionType >( externalAggregationFunction );
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @brief Destructor
|
//! @brief Destructor
|
||||||
~peoMultiStart()
|
~peoMultiStart()
|
||||||
{
|
{
|
||||||
for ( unsigned int index = 0; index < data.size(); index++ ) delete data[ index ];
|
for ( unsigned int index = 0; index < data.size(); index++ ) delete data[ index ];
|
||||||
for ( unsigned int index = 0; index < algorithms.size(); index++ ) delete algorithms[ index ];
|
for ( unsigned int index = 0; index < algorithms.size(); index++ ) delete algorithms[ index ];
|
||||||
delete aggregationFunction;
|
delete aggregationFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @brief operator on the template type
|
//! @brief operator on the template type
|
||||||
//! @param Type& externalData
|
//! @param Type& externalData
|
||||||
template < typename Type > void operator()( Type& externalData )
|
template < typename Type > void operator()( Type& externalData )
|
||||||
{
|
{
|
||||||
for ( typename Type::iterator externalDataIterator = externalData.begin(); externalDataIterator != externalData.end(); externalDataIterator++ )
|
for ( typename Type::iterator externalDataIterator = externalData.begin(); externalDataIterator != externalData.end(); externalDataIterator++ )
|
||||||
|
|
@ -114,9 +114,9 @@ template < typename EntityType > class peoMultiStart : public Service
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @brief operator on the template type
|
//! @brief operator on the template type
|
||||||
//! @param Type& externalDataBegin
|
//! @param Type& externalDataBegin
|
||||||
//! @param Type& externalDataEnd
|
//! @param Type& externalDataEnd
|
||||||
template < typename Type > void operator()( const Type& externalDataBegin, const Type& externalDataEnd )
|
template < typename Type > void operator()( const Type& externalDataBegin, const Type& externalDataEnd )
|
||||||
{
|
{
|
||||||
for ( Type externalDataIterator = externalDataBegin; externalDataIterator != externalDataEnd; externalDataIterator++ )
|
for ( Type externalDataIterator = externalDataBegin; externalDataIterator != externalDataEnd; externalDataIterator++ )
|
||||||
|
|
@ -128,32 +128,32 @@ template < typename EntityType > class peoMultiStart : public Service
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @brief Function realizing packages of data
|
//! @brief Function realizing packages of data
|
||||||
void packData();
|
void packData();
|
||||||
//! @brief Function reconstituting packages of data
|
//! @brief Function reconstituting packages of data
|
||||||
void unpackData();
|
void unpackData();
|
||||||
//! @brief Function which executes the algorithm
|
//! @brief Function which executes the algorithm
|
||||||
void execute();
|
void execute();
|
||||||
//! @brief Function realizing packages of the result
|
//! @brief Function realizing packages of the result
|
||||||
void packResult();
|
void packResult();
|
||||||
//! @brief Function reconstituting packages of result
|
//! @brief Function reconstituting packages of result
|
||||||
void unpackResult();
|
void unpackResult();
|
||||||
//! @brief Function notifySendingData
|
//! @brief Function notifySendingData
|
||||||
void notifySendingData();
|
void notifySendingData();
|
||||||
//! @brief Function notifySendingAllResourceRequests
|
//! @brief Function notifySendingAllResourceRequests
|
||||||
void notifySendingAllResourceRequests();
|
void notifySendingAllResourceRequests();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! @param AbstractAlgorithm* singularAlgorithm
|
//! @param AbstractAlgorithm* singularAlgorithm
|
||||||
//! @param std::vector< AbstractAlgorithm* > algorithms
|
//! @param std::vector< AbstractAlgorithm* > algorithms
|
||||||
//! @param AbstractAggregationAlgorithm* aggregationFunction
|
//! @param AbstractAggregationAlgorithm* aggregationFunction
|
||||||
//! @param EntityType entityTypeInstance
|
//! @param EntityType entityTypeInstance
|
||||||
//! @param std::vector< AbstractDataType* > data
|
//! @param std::vector< AbstractDataType* > data
|
||||||
//! @param unsigned idx
|
//! @param unsigned idx
|
||||||
//! @param unsigned num_term
|
//! @param unsigned num_term
|
||||||
//! @param unsigned dataIndex
|
//! @param unsigned dataIndex
|
||||||
//! @param unsigned functionIndex
|
//! @param unsigned functionIndex
|
||||||
template < typename Type > struct DataType;
|
template < typename Type > struct DataType;
|
||||||
struct AbstractDataType
|
struct AbstractDataType
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -55,24 +55,24 @@ template <class POT> class peoPSOSelect: public eoSelectOne<POT>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
//! @param eoTopology < POT > & _topology
|
//! @param eoTopology < POT > & _topology
|
||||||
peoPSOSelect(eoTopology < POT > & _topology):topology(_topology)
|
peoPSOSelect(eoTopology < POT > & _topology):topology(_topology)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//! @brief typedef : creation of Fitness
|
//! @brief typedef : creation of Fitness
|
||||||
typedef typename PO < POT >::Fitness Fitness;
|
typedef typename PO < POT >::Fitness Fitness;
|
||||||
|
|
||||||
//! @brief Virtual operator
|
//! @brief Virtual operator
|
||||||
//! @param eoPop<POT>& _pop
|
//! @param eoPop<POT>& _pop
|
||||||
//! @return POT&
|
//! @return POT&
|
||||||
virtual const POT& operator()(const eoPop<POT>& _pop)
|
virtual const POT& operator()(const eoPop<POT>& _pop)
|
||||||
{
|
{
|
||||||
return topology.globalBest(_pop);
|
return topology.globalBest(_pop);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! @param eoTopology < POT > & topology
|
//! @param eoTopology < POT > & topology
|
||||||
eoTopology < POT > & topology;
|
eoTopology < POT > & topology;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -86,18 +86,18 @@ class peoGlobalBestVelocity : public eoReplacement<POT>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! @brief typedef : creation of VelocityType
|
//! @brief typedef : creation of VelocityType
|
||||||
typedef typename POT::ParticleVelocityType VelocityType;
|
typedef typename POT::ParticleVelocityType VelocityType;
|
||||||
|
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
//! @param double & _c3
|
//! @param double & _c3
|
||||||
//! @param eoVelocity < POT > &_velocity
|
//! @param eoVelocity < POT > &_velocity
|
||||||
peoGlobalBestVelocity( const double & _c3, eoVelocity < POT > &_velocity): c3 (_c3),velocity (_velocity)
|
peoGlobalBestVelocity( const double & _c3, eoVelocity < POT > &_velocity): c3 (_c3),velocity (_velocity)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//! @brief Virtual operator
|
//! @brief Virtual operator
|
||||||
//! @param eoPop<POT>& _dest
|
//! @param eoPop<POT>& _dest
|
||||||
//! @param eoPop<POT>& _source
|
//! @param eoPop<POT>& _source
|
||||||
void operator()(eoPop<POT>& _dest, eoPop<POT>& _source)
|
void operator()(eoPop<POT>& _dest, eoPop<POT>& _source)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -113,8 +113,8 @@ class peoGlobalBestVelocity : public eoReplacement<POT>
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! @param double & c3
|
//! @param double & c3
|
||||||
//! @param eoVelocity < POT > & velocity
|
//! @param eoVelocity < POT > & velocity
|
||||||
const double & c3;
|
const double & c3;
|
||||||
eoVelocity < POT > & velocity;
|
eoVelocity < POT > & velocity;
|
||||||
};
|
};
|
||||||
|
|
@ -127,13 +127,13 @@ class peoGlobalBestVelocity : public eoReplacement<POT>
|
||||||
template <class POT> class peoWorstPositionReplacement : public eoReplacement<POT>
|
template <class POT> class peoWorstPositionReplacement : public eoReplacement<POT>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! @brief constructor
|
//! @brief constructor
|
||||||
peoWorstPositionReplacement()
|
peoWorstPositionReplacement()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//! @brief operator
|
//! @brief operator
|
||||||
//! @param eoPop<POT>& _dest
|
//! @param eoPop<POT>& _dest
|
||||||
//! @param eoPop<POT>& _source
|
//! @param eoPop<POT>& _source
|
||||||
void operator()(eoPop<POT>& _dest, eoPop<POT>& _source)
|
void operator()(eoPop<POT>& _dest, eoPop<POT>& _source)
|
||||||
{
|
{
|
||||||
unsigned ind=0;
|
unsigned ind=0;
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,8 @@ template< class EOT > class peoPopEval : public Service, public eoPopEvalFunc<EO
|
||||||
void operator()(eoPop< EOT >& __pop);
|
void operator()(eoPop< EOT >& __pop);
|
||||||
|
|
||||||
//! @brief Operator ()( eoPop< EOT >& __dummy, eoPop< EOT >& __pop )
|
//! @brief Operator ()( eoPop< EOT >& __dummy, eoPop< EOT >& __pop )
|
||||||
//! @param eoPop< EOT >& __dummy
|
//! @param eoPop< EOT >& __dummy
|
||||||
//! @param eoPop< EOT >& __pop
|
//! @param eoPop< EOT >& __pop
|
||||||
void operator()( eoPop< EOT >& __dummy, eoPop< EOT >& __pop );
|
void operator()( eoPop< EOT >& __dummy, eoPop< EOT >& __pop );
|
||||||
|
|
||||||
//! Auxiliary function for transferring data between the process requesting an evaluation operation and the process that
|
//! Auxiliary function for transferring data between the process requesting an evaluation operation and the process that
|
||||||
|
|
@ -106,16 +106,16 @@ template< class EOT > class peoPopEval : public Service, public eoPopEvalFunc<EO
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! @param std :: vector< eoEvalFunc < EOT >* >& funcs
|
//! @param std :: vector< eoEvalFunc < EOT >* >& funcs
|
||||||
//! @param std :: vector< eoEvalFunc < EOT >* > one_func
|
//! @param std :: vector< eoEvalFunc < EOT >* > one_func
|
||||||
//! @param peoAggEvalFunc< EOT >& merge_eval
|
//! @param peoAggEvalFunc< EOT >& merge_eval
|
||||||
//! @param peoNoAggEvalFunc< EOT > no_merge_eval
|
//! @param peoNoAggEvalFunc< EOT > no_merge_eval
|
||||||
//! @param std :: queue< EOT* >tasks
|
//! @param std :: queue< EOT* >tasks
|
||||||
//! @param std :: map< EOT*, std :: pair< unsigned, unsigned > > progression
|
//! @param std :: map< EOT*, std :: pair< unsigned, unsigned > > progression
|
||||||
//! @param unsigned num_func
|
//! @param unsigned num_func
|
||||||
//! @param EOT sol
|
//! @param EOT sol
|
||||||
//! @param EOT *ad_sol
|
//! @param EOT *ad_sol
|
||||||
//! @param unsigned total
|
//! @param unsigned total
|
||||||
const std :: vector< eoEvalFunc < EOT >* >& funcs;
|
const std :: vector< eoEvalFunc < EOT >* >& funcs;
|
||||||
std :: vector< eoEvalFunc < EOT >* > one_func;
|
std :: vector< eoEvalFunc < EOT >* > one_func;
|
||||||
peoAggEvalFunc< EOT >& merge_eval;
|
peoAggEvalFunc< EOT >& merge_eval;
|
||||||
|
|
@ -153,23 +153,23 @@ template< class EOT > void peoPopEval< EOT >::operator()(eoPop< EOT >& __dummy,
|
||||||
|
|
||||||
template< class EOT > void peoPopEval< EOT >::operator()(eoPop< EOT >& __pop )
|
template< class EOT > void peoPopEval< EOT >::operator()(eoPop< EOT >& __pop )
|
||||||
{
|
{
|
||||||
if ( __pop.size() && (funcs.size() * __pop.size()) )
|
if ( __pop.size() && (funcs.size() * __pop.size()) )
|
||||||
{
|
{
|
||||||
for ( unsigned i = 0; i < __pop.size(); i++ )
|
for ( unsigned i = 0; i < __pop.size(); i++ )
|
||||||
{
|
{
|
||||||
__pop[ i ].fitness(typename EOT :: Fitness() );
|
__pop[ i ].fitness(typename EOT :: Fitness() );
|
||||||
progression[ &__pop[ i ] ].first = funcs.size() - 1;
|
progression[ &__pop[ i ] ].first = funcs.size() - 1;
|
||||||
progression[ &__pop[ i ] ].second = funcs.size();
|
progression[ &__pop[ i ] ].second = funcs.size();
|
||||||
for ( unsigned j = 0; j < funcs.size(); j++ )
|
for ( unsigned j = 0; j < funcs.size(); j++ )
|
||||||
{
|
{
|
||||||
/* Queuing the 'invalid' solution and its associated owner */
|
/* Queuing the 'invalid' solution and its associated owner */
|
||||||
tasks.push( &__pop[ i ] );
|
tasks.push( &__pop[ i ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
total = funcs.size() * __pop.size();
|
total = funcs.size() * __pop.size();
|
||||||
requestResourceRequest( funcs.size() * __pop.size() );
|
requestResourceRequest( funcs.size() * __pop.size() );
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,10 +74,10 @@ template< class TYPESELECT, class TYPEREPLACE > class peoSyncIslandMig : public
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
//! @param unsigned __frequency
|
//! @param unsigned __frequency
|
||||||
//! @param selector <TYPESELECT> & __select
|
//! @param selector <TYPESELECT> & __select
|
||||||
//! @param replacement <TYPEREPLACE> & __replace
|
//! @param replacement <TYPEREPLACE> & __replace
|
||||||
//! @param Topology& __topology
|
//! @param Topology& __topology
|
||||||
peoSyncIslandMig(
|
peoSyncIslandMig(
|
||||||
unsigned __frequency,
|
unsigned __frequency,
|
||||||
selector <TYPESELECT> & __select,
|
selector <TYPESELECT> & __select,
|
||||||
|
|
@ -87,19 +87,19 @@ template< class TYPESELECT, class TYPEREPLACE > class peoSyncIslandMig : public
|
||||||
|
|
||||||
//! @brief operator
|
//! @brief operator
|
||||||
void operator()();
|
void operator()();
|
||||||
//! @brief Function realizing packages
|
//! @brief Function realizing packages
|
||||||
void pack();
|
void pack();
|
||||||
//! @brief Function reconstituting packages
|
//! @brief Function reconstituting packages
|
||||||
void unpack();
|
void unpack();
|
||||||
//! @brief Function packSynchronizeReq
|
//! @brief Function packSynchronizeReq
|
||||||
void packSynchronizeReq();
|
void packSynchronizeReq();
|
||||||
//! @brief Function notifySending
|
//! @brief Function notifySending
|
||||||
void notifySending();
|
void notifySending();
|
||||||
//! @brief Function notifyReceiving
|
//! @brief Function notifyReceiving
|
||||||
void notifyReceiving();
|
void notifyReceiving();
|
||||||
//! @brief notifySendingSyncReq
|
//! @brief notifySendingSyncReq
|
||||||
void notifySendingSyncReq();
|
void notifySendingSyncReq();
|
||||||
//! @brief notifySynchronized
|
//! @brief notifySynchronized
|
||||||
void notifySynchronized();
|
void notifySynchronized();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -109,18 +109,18 @@ template< class TYPESELECT, class TYPEREPLACE > class peoSyncIslandMig : public
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! @param eoSyncContinue cont
|
//! @param eoSyncContinue cont
|
||||||
//! @param selector <TYPESELECT> & select
|
//! @param selector <TYPESELECT> & select
|
||||||
//! @param replacement <TYPEREPLACE> & replace
|
//! @param replacement <TYPEREPLACE> & replace
|
||||||
//! @param Topology& topology
|
//! @param Topology& topology
|
||||||
//! @param std :: queue< TYPEREPLACE > imm
|
//! @param std :: queue< TYPEREPLACE > imm
|
||||||
//! @param std :: queue< TYPESELECT > em
|
//! @param std :: queue< TYPESELECT > em
|
||||||
//! @param std :: queue< Cooperative* > coop_em
|
//! @param std :: queue< Cooperative* > coop_em
|
||||||
//! @param sem_t sync
|
//! @param sem_t sync
|
||||||
//! @param bool explicitPassive
|
//! @param bool explicitPassive
|
||||||
//! @param bool standbyMigration
|
//! @param bool standbyMigration
|
||||||
//! @param std :: vector< Cooperative* > in, out, all
|
//! @param std :: vector< Cooperative* > in, out, all
|
||||||
//! @param unsigned nbMigrations
|
//! @param unsigned nbMigrations
|
||||||
eoSyncContinue cont;
|
eoSyncContinue cont;
|
||||||
selector <TYPESELECT> & select;
|
selector <TYPESELECT> & select;
|
||||||
replacement <TYPEREPLACE> & replace;
|
replacement <TYPEREPLACE> & replace;
|
||||||
|
|
|
||||||
|
|
@ -55,11 +55,11 @@ template< class EOT > class peoTransform : public Service, public eoTransform< E
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
//! @param eoQuadOp< EOT >& __cross
|
//! @param eoQuadOp< EOT >& __cross
|
||||||
//! @param double __cross_rate
|
//! @param double __cross_rate
|
||||||
//! @param eoMonOp< EOT >& __mut
|
//! @param eoMonOp< EOT >& __mut
|
||||||
//! @param double __mut_rate
|
//! @param double __mut_rate
|
||||||
peoTransform(
|
peoTransform(
|
||||||
eoQuadOp< EOT >& __cross,
|
eoQuadOp< EOT >& __cross,
|
||||||
double __cross_rate,
|
double __cross_rate,
|
||||||
|
|
@ -67,34 +67,34 @@ template< class EOT > class peoTransform : public Service, public eoTransform< E
|
||||||
double __mut_rate
|
double __mut_rate
|
||||||
);
|
);
|
||||||
|
|
||||||
//! @brief Operator
|
//! @brief Operator
|
||||||
//! @param eoPop< EOT >& __pop
|
//! @param eoPop< EOT >& __pop
|
||||||
void operator()( eoPop< EOT >& __pop );
|
void operator()( eoPop< EOT >& __pop );
|
||||||
//! @brief Function realizing packages of data
|
//! @brief Function realizing packages of data
|
||||||
void packData();
|
void packData();
|
||||||
//! @brief Function reconstituting packages of data
|
//! @brief Function reconstituting packages of data
|
||||||
void unpackData();
|
void unpackData();
|
||||||
//! @brief Function which executes the algorithm
|
//! @brief Function which executes the algorithm
|
||||||
void execute();
|
void execute();
|
||||||
//! @brief Function realizing packages of the result
|
//! @brief Function realizing packages of the result
|
||||||
void packResult();
|
void packResult();
|
||||||
//! @brief Function reconstituting packages of result
|
//! @brief Function reconstituting packages of result
|
||||||
void unpackResult();
|
void unpackResult();
|
||||||
//! @brief Function notifySendingData
|
//! @brief Function notifySendingData
|
||||||
void notifySendingData();
|
void notifySendingData();
|
||||||
//! @brief Function notifySendingAllResourceRequests
|
//! @brief Function notifySendingAllResourceRequests
|
||||||
void notifySendingAllResourceRequests();
|
void notifySendingAllResourceRequests();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! @param eoQuadOp< EOT >& cross
|
//! @param eoQuadOp< EOT >& cross
|
||||||
//! @param double cross_rate
|
//! @param double cross_rate
|
||||||
//! @param eoMonOp< EOT >& mut
|
//! @param eoMonOp< EOT >& mut
|
||||||
//! @param double mut_rate
|
//! @param double mut_rate
|
||||||
//! @param unsigned idx
|
//! @param unsigned idx
|
||||||
//! @param eoPop< EOT >* pop
|
//! @param eoPop< EOT >* pop
|
||||||
//! @param EOT father
|
//! @param EOT father
|
||||||
//! @param mother
|
//! @param mother
|
||||||
//! @param unsigned num_term
|
//! @param unsigned num_term
|
||||||
eoQuadOp< EOT >& cross;
|
eoQuadOp< EOT >& cross;
|
||||||
double cross_rate;
|
double cross_rate;
|
||||||
eoMonOp< EOT >& mut;
|
eoMonOp< EOT >& mut;
|
||||||
|
|
|
||||||
|
|
@ -51,39 +51,39 @@ class peoWrapper : public Runner
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! @brief constructor
|
//! @brief constructor
|
||||||
//! @param AlgorithmType& externalAlgorithm
|
//! @param AlgorithmType& externalAlgorithm
|
||||||
template< typename AlgorithmType > peoWrapper( AlgorithmType& externalAlgorithm )
|
template< typename AlgorithmType > peoWrapper( AlgorithmType& externalAlgorithm )
|
||||||
: algorithm( new Algorithm< AlgorithmType, void >( externalAlgorithm ) )
|
: algorithm( new Algorithm< AlgorithmType, void >( externalAlgorithm ) )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//! @brief constructor
|
//! @brief constructor
|
||||||
//! @param AlgorithmType& externalAlgorithm
|
//! @param AlgorithmType& externalAlgorithm
|
||||||
//! @param AlgorithmDataType& externalData
|
//! @param AlgorithmDataType& externalData
|
||||||
template< typename AlgorithmType, typename AlgorithmDataType > peoWrapper( AlgorithmType& externalAlgorithm, AlgorithmDataType& externalData )
|
template< typename AlgorithmType, typename AlgorithmDataType > peoWrapper( AlgorithmType& externalAlgorithm, AlgorithmDataType& externalData )
|
||||||
: algorithm( new Algorithm< AlgorithmType, AlgorithmDataType >( externalAlgorithm, externalData ) )
|
: algorithm( new Algorithm< AlgorithmType, AlgorithmDataType >( externalAlgorithm, externalData ) )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//! @brief constructor
|
//! @brief constructor
|
||||||
//! @param AlgorithmReturnType& (*externalAlgorithm)()
|
//! @param AlgorithmReturnType& (*externalAlgorithm)()
|
||||||
template< typename AlgorithmReturnType > peoWrapper( AlgorithmReturnType& (*externalAlgorithm)() )
|
template< typename AlgorithmReturnType > peoWrapper( AlgorithmReturnType& (*externalAlgorithm)() )
|
||||||
: algorithm( new FunctionAlgorithm< AlgorithmReturnType, void >( externalAlgorithm ) )
|
: algorithm( new FunctionAlgorithm< AlgorithmReturnType, void >( externalAlgorithm ) )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//! @brief constructor
|
//! @brief constructor
|
||||||
//! @param AlgorithmReturnType& (*externalAlgorithm)( AlgorithmDataType& )
|
//! @param AlgorithmReturnType& (*externalAlgorithm)( AlgorithmDataType& )
|
||||||
//! @param AlgorithmDataType& externalData
|
//! @param AlgorithmDataType& externalData
|
||||||
template< typename AlgorithmReturnType, typename AlgorithmDataType > peoWrapper( AlgorithmReturnType& (*externalAlgorithm)( AlgorithmDataType& ), AlgorithmDataType& externalData )
|
template< typename AlgorithmReturnType, typename AlgorithmDataType > peoWrapper( AlgorithmReturnType& (*externalAlgorithm)( AlgorithmDataType& ), AlgorithmDataType& externalData )
|
||||||
: algorithm( new FunctionAlgorithm< AlgorithmReturnType, AlgorithmDataType >( externalAlgorithm, externalData ) )
|
: algorithm( new FunctionAlgorithm< AlgorithmReturnType, AlgorithmDataType >( externalAlgorithm, externalData ) )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//! @brief destructor
|
//! @brief destructor
|
||||||
~peoWrapper()
|
~peoWrapper()
|
||||||
{
|
{
|
||||||
delete algorithm;
|
delete algorithm;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @brief function run
|
//! @brief function run
|
||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
algorithm->operator()();
|
algorithm->operator()();
|
||||||
|
|
@ -166,7 +166,7 @@ class peoWrapper : public Runner
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! @param AbstractAlgorithm* algorithm
|
//! @param AbstractAlgorithm* algorithm
|
||||||
AbstractAlgorithm* algorithm;
|
AbstractAlgorithm* algorithm;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,10 +65,14 @@ struct SyncCompare
|
||||||
std::vector< SyncEntry >::const_iterator itA = syncA.begin();
|
std::vector< SyncEntry >::const_iterator itA = syncA.begin();
|
||||||
std::vector< SyncEntry >::const_iterator itB = syncB.begin();
|
std::vector< SyncEntry >::const_iterator itB = syncB.begin();
|
||||||
|
|
||||||
while ( itA != syncA.end() && (*itA).runner == (*itB).runner ) { itA++; itB++; }
|
while ( itA != syncA.end() && (*itA).runner == (*itB).runner )
|
||||||
|
{
|
||||||
|
itA++;
|
||||||
|
itB++;
|
||||||
|
}
|
||||||
|
|
||||||
return ( (itA == syncA.end()) ) ? false : ( (*itA).runner < (*itB).runner );
|
return ( (itA == syncA.end()) ) ? false : ( (*itA).runner < (*itB).runner );
|
||||||
}
|
}
|
||||||
|
|
||||||
return syncA.size() < syncB.size();
|
return syncA.size() < syncB.size();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ int main (int __argc, char *__argv[])
|
||||||
{
|
{
|
||||||
peo :: init( __argc, __argv );
|
peo :: init( __argc, __argv );
|
||||||
if (getNodeRank()==1)
|
if (getNodeRank()==1)
|
||||||
std::cout<<"\n\nTest : Asynchronous island with EA\n\n";
|
std::cout<<"\n\nTest : Asynchronous island with EA\n\n";
|
||||||
rng.reseed (10);
|
rng.reseed (10);
|
||||||
RingTopology topology;
|
RingTopology topology;
|
||||||
eoGenContinue < Indi > genContPara (10);
|
eoGenContinue < Indi > genContPara (10);
|
||||||
|
|
@ -63,7 +63,8 @@ int main (int __argc, char *__argv[])
|
||||||
eoSegmentCrossover<Indi> crossover;
|
eoSegmentCrossover<Indi> crossover;
|
||||||
eoUniformMutation<Indi> mutation(0.01);
|
eoUniformMutation<Indi> mutation(0.01);
|
||||||
peoTransform<Indi> transform(crossover,0.8,mutation,0.3);
|
peoTransform<Indi> transform(crossover,0.8,mutation,0.3);
|
||||||
/*p*/eoPop < Indi > pop;
|
/*p*/
|
||||||
|
eoPop < Indi > pop;
|
||||||
pop.append (10, random);
|
pop.append (10, random);
|
||||||
eoPlusReplacement<Indi> replace;
|
eoPlusReplacement<Indi> replace;
|
||||||
eoRandomSelect<Indi> mig_select_one;
|
eoRandomSelect<Indi> mig_select_one;
|
||||||
|
|
@ -90,7 +91,8 @@ int main (int __argc, char *__argv[])
|
||||||
eoSegmentCrossover<Indi> crossover2;
|
eoSegmentCrossover<Indi> crossover2;
|
||||||
eoUniformMutation<Indi> mutation2(0.01);
|
eoUniformMutation<Indi> mutation2(0.01);
|
||||||
peoTransform<Indi> transform2(crossover2,0.8,mutation2,0.3);
|
peoTransform<Indi> transform2(crossover2,0.8,mutation2,0.3);
|
||||||
/*p*/eoPop < Indi > pop2;
|
/*p*/
|
||||||
|
eoPop < Indi > pop2;
|
||||||
pop2.append (10, random2);
|
pop2.append (10, random2);
|
||||||
eoPlusReplacement<Indi> replace2;
|
eoPlusReplacement<Indi> replace2;
|
||||||
eoRandomSelect<Indi> mig_select_one2;
|
eoRandomSelect<Indi> mig_select_one2;
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ int main (int __argc, char *__argv[])
|
||||||
{
|
{
|
||||||
peo :: init( __argc, __argv );
|
peo :: init( __argc, __argv );
|
||||||
if (getNodeRank()==1)
|
if (getNodeRank()==1)
|
||||||
std::cout<<"\n\nTest : Synchronous island with EA\n\n";
|
std::cout<<"\n\nTest : Synchronous island with EA\n\n";
|
||||||
rng.reseed (10);
|
rng.reseed (10);
|
||||||
RingTopology topology;
|
RingTopology topology;
|
||||||
eoGenContinue < Indi > genContPara (10);
|
eoGenContinue < Indi > genContPara (10);
|
||||||
|
|
|
||||||
|
|
@ -39,5 +39,5 @@
|
||||||
|
|
||||||
int main (int __argc, char *__argv[])
|
int main (int __argc, char *__argv[])
|
||||||
{
|
{
|
||||||
system("mpdallexit");
|
system("mpdallexit");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,5 +39,5 @@
|
||||||
|
|
||||||
int main (int __argc, char *__argv[])
|
int main (int __argc, char *__argv[])
|
||||||
{
|
{
|
||||||
system("mpdboot");
|
system("mpdboot");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,28 +40,28 @@
|
||||||
#include <peo>
|
#include <peo>
|
||||||
|
|
||||||
struct Algorithm
|
struct Algorithm
|
||||||
{
|
{
|
||||||
void operator()(double & _d)
|
void operator()(double & _d)
|
||||||
{
|
{
|
||||||
_d = _d * _d;
|
_d = _d * _d;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main (int __argc, char * * __argv)
|
int main (int __argc, char * * __argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
peo :: init (__argc, __argv);
|
peo :: init (__argc, __argv);
|
||||||
if (getNodeRank()==1)
|
if (getNodeRank()==1)
|
||||||
std::cout<<"\n\nTest : multistart\n\n";
|
std::cout<<"\n\nTest : multistart\n\n";
|
||||||
std::vector < double > v;
|
std::vector < double > v;
|
||||||
if (getNodeRank()==1)
|
if (getNodeRank()==1)
|
||||||
std::cout<<"\n\nBefore :";
|
std::cout<<"\n\nBefore :";
|
||||||
for(unsigned i = 0; i< 10; i++)
|
for (unsigned i = 0; i< 10; i++)
|
||||||
{
|
{
|
||||||
v.push_back(i);
|
v.push_back(i);
|
||||||
if (getNodeRank()==1)
|
if (getNodeRank()==1)
|
||||||
std::cout<<"\n"<<v[i];
|
std::cout<<"\n"<<v[i];
|
||||||
}
|
}
|
||||||
Algorithm algo;
|
Algorithm algo;
|
||||||
peoMultiStart < double > initParallel (algo);
|
peoMultiStart < double > initParallel (algo);
|
||||||
peoWrapper parallelAlgo (initParallel, v);
|
peoWrapper parallelAlgo (initParallel, v);
|
||||||
|
|
@ -69,9 +69,9 @@ int main (int __argc, char * * __argv)
|
||||||
peo :: run( );
|
peo :: run( );
|
||||||
peo :: finalize( );
|
peo :: finalize( );
|
||||||
if (getNodeRank()==1)
|
if (getNodeRank()==1)
|
||||||
{
|
{
|
||||||
std::cout<<"\n\nAfter :\n";
|
std::cout<<"\n\nAfter :\n";
|
||||||
for(unsigned i = 0; i< 10; i++)
|
for (unsigned i = 0; i< 10; i++)
|
||||||
std::cout<<v[i]<<"\n";
|
std::cout<<v[i]<<"\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ int main (int __argc, char *__argv[])
|
||||||
{
|
{
|
||||||
peo :: init( __argc, __argv );
|
peo :: init( __argc, __argv );
|
||||||
if (getNodeRank()==1)
|
if (getNodeRank()==1)
|
||||||
std::cout<<"\n\nTest : PSO Global Best\n\n";
|
std::cout<<"\n\nTest : PSO Global Best\n\n";
|
||||||
rng.reseed (10);
|
rng.reseed (10);
|
||||||
RingTopology topologyMig;
|
RingTopology topologyMig;
|
||||||
eoGenContinue < Indi > genContPara (10);
|
eoGenContinue < Indi > genContPara (10);
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ int main (int __argc, char *__argv[])
|
||||||
{
|
{
|
||||||
peo :: init( __argc, __argv );
|
peo :: init( __argc, __argv );
|
||||||
if (getNodeRank()==1)
|
if (getNodeRank()==1)
|
||||||
std::cout<<"\n\nTest : PSO Worst Position\n\n";
|
std::cout<<"\n\nTest : PSO Worst Position\n\n";
|
||||||
rng.reseed (10);
|
rng.reseed (10);
|
||||||
RingTopology topologyMig;
|
RingTopology topologyMig;
|
||||||
eoGenContinue < Indi > genContPara (10);
|
eoGenContinue < Indi > genContPara (10);
|
||||||
|
|
|
||||||
|
|
@ -45,21 +45,21 @@ double f (const Indi & _indi)
|
||||||
return (-sum);
|
return (-sum);
|
||||||
}
|
}
|
||||||
struct Algorithm
|
struct Algorithm
|
||||||
{
|
{
|
||||||
Algorithm( peoPopEval < Indi > & _eval): eval( _eval ){}
|
Algorithm( peoPopEval < Indi > & _eval): eval( _eval ){}
|
||||||
void operator()(eoPop < Indi > & _pop)
|
void operator()(eoPop < Indi > & _pop)
|
||||||
{
|
{
|
||||||
eoPop < Indi > empty_pop;
|
eoPop < Indi > empty_pop;
|
||||||
eval(empty_pop, _pop);
|
eval(empty_pop, _pop);
|
||||||
}
|
}
|
||||||
peoPopEval < Indi > & eval;
|
peoPopEval < Indi > & eval;
|
||||||
};
|
};
|
||||||
|
|
||||||
int main (int __argc, char *__argv[])
|
int main (int __argc, char *__argv[])
|
||||||
{
|
{
|
||||||
peo :: init( __argc, __argv );
|
peo :: init( __argc, __argv );
|
||||||
if (getNodeRank()==1)
|
if (getNodeRank()==1)
|
||||||
std::cout<<"\n\nTest : parallel evaluation\n\n";
|
std::cout<<"\n\nTest : parallel evaluation\n\n";
|
||||||
rng.reseed (10);
|
rng.reseed (10);
|
||||||
peoEvalFunc<Indi, double, const Indi& > plainEval(f);
|
peoEvalFunc<Indi, double, const Indi& > plainEval(f);
|
||||||
peoPopEval< Indi > eval(plainEval);
|
peoPopEval< Indi > eval(plainEval);
|
||||||
|
|
@ -72,8 +72,8 @@ int main (int __argc, char *__argv[])
|
||||||
peo :: run();
|
peo :: run();
|
||||||
peo :: finalize();
|
peo :: finalize();
|
||||||
if (getNodeRank()==1)
|
if (getNodeRank()==1)
|
||||||
{
|
{
|
||||||
pop.sort();
|
pop.sort();
|
||||||
std::cout<<pop;
|
std::cout<<pop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,34 +45,34 @@ double f (const Indi & _indi)
|
||||||
return (-sum);
|
return (-sum);
|
||||||
}
|
}
|
||||||
struct Algorithm
|
struct Algorithm
|
||||||
{
|
{
|
||||||
Algorithm( eoEvalFunc < Indi > & _eval, eoSelect < Indi > & _select, peoTransform < Indi > & _transform):
|
Algorithm( eoEvalFunc < Indi > & _eval, eoSelect < Indi > & _select, peoTransform < Indi > & _transform):
|
||||||
loopEval(_eval),
|
loopEval(_eval),
|
||||||
eval(loopEval),
|
eval(loopEval),
|
||||||
selectTransform( _select, _transform),
|
selectTransform( _select, _transform),
|
||||||
breed(selectTransform) {}
|
breed(selectTransform) {}
|
||||||
|
|
||||||
void operator()(eoPop < Indi > & _pop)
|
void operator()(eoPop < Indi > & _pop)
|
||||||
{
|
{
|
||||||
eoPop < Indi > offspring, empty_pop;
|
eoPop < Indi > offspring, empty_pop;
|
||||||
eval(empty_pop, _pop);
|
eval(empty_pop, _pop);
|
||||||
eval(empty_pop, offspring);
|
eval(empty_pop, offspring);
|
||||||
std::cout<<"\n\nBefore :\n"<<offspring;
|
std::cout<<"\n\nBefore :\n"<<offspring;
|
||||||
breed(_pop, offspring);
|
breed(_pop, offspring);
|
||||||
eval(empty_pop, offspring);
|
eval(empty_pop, offspring);
|
||||||
std::cout<<"\n\nAfter :\n"<<offspring;
|
std::cout<<"\n\nAfter :\n"<<offspring;
|
||||||
}
|
}
|
||||||
eoPopLoopEval < Indi > loopEval;
|
eoPopLoopEval < Indi > loopEval;
|
||||||
eoPopEvalFunc < Indi > & eval;
|
eoPopEvalFunc < Indi > & eval;
|
||||||
eoSelectTransform < Indi > selectTransform;
|
eoSelectTransform < Indi > selectTransform;
|
||||||
eoBreed < Indi > & breed;
|
eoBreed < Indi > & breed;
|
||||||
};
|
};
|
||||||
|
|
||||||
int main (int __argc, char *__argv[])
|
int main (int __argc, char *__argv[])
|
||||||
{
|
{
|
||||||
peo :: init( __argc, __argv );
|
peo :: init( __argc, __argv );
|
||||||
if (getNodeRank()==1)
|
if (getNodeRank()==1)
|
||||||
std::cout<<"\n\nTest : parallel transform\n\n";
|
std::cout<<"\n\nTest : parallel transform\n\n";
|
||||||
rng.reseed (10);
|
rng.reseed (10);
|
||||||
eoEvalFuncPtr < Indi > plainEval(f);
|
eoEvalFuncPtr < Indi > plainEval(f);
|
||||||
eoEvalFuncCounter < Indi > eval(plainEval);
|
eoEvalFuncCounter < Indi > eval(plainEval);
|
||||||
|
|
|
||||||
|
|
@ -63,16 +63,16 @@ void EdgeXover :: build_map (const Route & __par1, const Route & __par2)
|
||||||
}
|
}
|
||||||
|
|
||||||
void EdgeXover :: remove_entry (unsigned __vertex, std :: vector <std :: set <unsigned> > & __map)
|
void EdgeXover :: remove_entry (unsigned __vertex, std :: vector <std :: set <unsigned> > & __map)
|
||||||
{
|
{
|
||||||
|
|
||||||
std :: set <unsigned> & neigh = __map [__vertex] ;
|
std :: set <unsigned> & neigh = __map [__vertex] ;
|
||||||
|
|
||||||
for (std :: set <unsigned> :: iterator it = neigh.begin () ;
|
for (std :: set <unsigned> :: iterator it = neigh.begin () ;
|
||||||
it != neigh.end () ;
|
it != neigh.end () ;
|
||||||
it ++)
|
it ++)
|
||||||
__map [* it].erase (__vertex) ;
|
__map [* it].erase (__vertex) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EdgeXover :: add_vertex (unsigned __vertex, Route & __child)
|
void EdgeXover :: add_vertex (unsigned __vertex, Route & __child)
|
||||||
{
|
{
|
||||||
|
|
@ -104,24 +104,24 @@ void EdgeXover :: cross (const Route & __par1, const Route & __par2, Route & __c
|
||||||
std :: set <unsigned> & neigh = _map [cur_vertex] ;
|
std :: set <unsigned> & neigh = _map [cur_vertex] ;
|
||||||
|
|
||||||
for (std :: set <unsigned> :: iterator it = neigh.begin () ;
|
for (std :: set <unsigned> :: iterator it = neigh.begin () ;
|
||||||
it != neigh.end () ;
|
it != neigh.end () ;
|
||||||
it ++)
|
it ++)
|
||||||
{
|
{
|
||||||
unsigned l = _map [* it].size () ;
|
unsigned l = _map [* it].size () ;
|
||||||
if (len_min_entry > l)
|
if (len_min_entry > l)
|
||||||
len_min_entry = l ;
|
len_min_entry = l ;
|
||||||
}
|
}
|
||||||
|
|
||||||
std :: vector <unsigned> cand ; /* Candidates */
|
std :: vector <unsigned> cand ; /* Candidates */
|
||||||
|
|
||||||
for (std :: set <unsigned> :: iterator it = neigh.begin () ;
|
for (std :: set <unsigned> :: iterator it = neigh.begin () ;
|
||||||
it != neigh.end () ;
|
it != neigh.end () ;
|
||||||
it ++)
|
it ++)
|
||||||
{
|
{
|
||||||
unsigned l = _map [* it].size () ;
|
unsigned l = _map [* it].size () ;
|
||||||
if (len_min_entry == l)
|
if (len_min_entry == l)
|
||||||
cand.push_back (* it) ;
|
cand.push_back (* it) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! cand.size ())
|
if (! cand.size ())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue