diff --git a/trunk/paradiseo-peo/src/core/communicable.cpp b/trunk/paradiseo-peo/src/core/communicable.cpp index 485a65711..382973f93 100644 --- a/trunk/paradiseo-peo/src/core/communicable.cpp +++ b/trunk/paradiseo-peo/src/core/communicable.cpp @@ -80,10 +80,10 @@ COMM_ID getKey (const Communicable * __comm) } void Communicable :: lock () - { +{ - sem_wait (& sem_lock); - } + sem_wait (& sem_lock); +} void Communicable :: unlock () { diff --git a/trunk/paradiseo-peo/src/core/complete_topo.cpp b/trunk/paradiseo-peo/src/core/complete_topo.cpp index 384c26652..408e64b58 100644 --- a/trunk/paradiseo-peo/src/core/complete_topo.cpp +++ b/trunk/paradiseo-peo/src/core/complete_topo.cpp @@ -1,4 +1,4 @@ -/* +/* * * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 * (C) OPAC Team, LIFL, 2002-2008 @@ -38,16 +38,19 @@ #include "complete_topo.h" void CompleteTopology :: setNeighbors (Cooperative * __mig, - std :: vector & __from, - std :: vector & __to) { + std :: vector & __from, + std :: vector & __to) +{ __from.clear () ; __to.clear () ; - for (unsigned i = 0; i < mig.size (); i ++) { - if (mig [i] != __mig) { - __from.push_back (mig [i]); - __to.push_back (mig [i]); - } + for (unsigned i = 0; i < mig.size (); i ++) + { + if (mig [i] != __mig) + { + __from.push_back (mig [i]); + __to.push_back (mig [i]); + } } } diff --git a/trunk/paradiseo-peo/src/core/complete_topo.h b/trunk/paradiseo-peo/src/core/complete_topo.h index 4a7b26fbe..f5513ea20 100644 --- a/trunk/paradiseo-peo/src/core/complete_topo.h +++ b/trunk/paradiseo-peo/src/core/complete_topo.h @@ -1,4 +1,4 @@ -/* +/* * * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 * (C) OPAC Team, LIFL, 2002-2008 @@ -39,13 +39,14 @@ #include "topology.h" -class CompleteTopology : public Topology { +class CompleteTopology : public Topology + { -public : + public : - void setNeighbors (Cooperative * __mig, - std :: vector & __from, - std :: vector & __to); -}; + void setNeighbors (Cooperative * __mig, + std :: vector & __from, + std :: vector & __to); + }; #endif diff --git a/trunk/paradiseo-peo/src/core/random_topo.cpp b/trunk/paradiseo-peo/src/core/random_topo.cpp index cb4685982..237fc169d 100644 --- a/trunk/paradiseo-peo/src/core/random_topo.cpp +++ b/trunk/paradiseo-peo/src/core/random_topo.cpp @@ -1,4 +1,4 @@ -/* +/* * * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 * (C) OPAC Team, LIFL, 2002-2008 @@ -40,16 +40,19 @@ #include void RandomTopology :: setNeighbors (Cooperative * __mig, - std :: vector & __from, - std :: vector & __to) { + std :: vector & __from, + std :: vector & __to) +{ __from.clear () ; __to.clear () ; - for (unsigned i = 0; i < mig.size (); i ++) { - if (mig [i] != __mig && rng.uniform() < 0.5 ) { - __from.push_back (mig [i]); - __to.push_back (mig [i]); - } + for (unsigned i = 0; i < mig.size (); i ++) + { + if (mig [i] != __mig && rng.uniform() < 0.5 ) + { + __from.push_back (mig [i]); + __to.push_back (mig [i]); + } } } diff --git a/trunk/paradiseo-peo/src/core/random_topo.h b/trunk/paradiseo-peo/src/core/random_topo.h index f56edf887..695f5a779 100644 --- a/trunk/paradiseo-peo/src/core/random_topo.h +++ b/trunk/paradiseo-peo/src/core/random_topo.h @@ -1,4 +1,4 @@ -/* +/* * * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 * (C) OPAC Team, LIFL, 2002-2008 @@ -39,13 +39,14 @@ #include "topology.h" -class RandomTopology : public Topology { +class RandomTopology : public Topology + { -public : + public : - void setNeighbors (Cooperative * __mig, - std :: vector & __from, - std :: vector & __to); -}; + void setNeighbors (Cooperative * __mig, + std :: vector & __from, + std :: vector & __to); + }; #endif diff --git a/trunk/paradiseo-peo/src/core/star_topo.cpp b/trunk/paradiseo-peo/src/core/star_topo.cpp index a794b748f..6661d4b05 100644 --- a/trunk/paradiseo-peo/src/core/star_topo.cpp +++ b/trunk/paradiseo-peo/src/core/star_topo.cpp @@ -1,4 +1,4 @@ -/* +/* * * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 * (C) OPAC Team, LIFL, 2002-2008 @@ -40,30 +40,36 @@ StarTopology :: StarTopology () : center( NULL ) {} void StarTopology :: setNeighbors (Cooperative * __mig, - std :: vector & __from, - std :: vector & __to) { + std :: vector & __from, + std :: vector & __to) +{ assert( center != NULL ); __from.clear () ; __to.clear () ; - if ( __mig == center ) { + if ( __mig == center ) + { - for (unsigned i = 0; i < mig.size (); i ++) { - if (mig [i] != center) { - __from.push_back (mig [i]); - __to.push_back (mig [i]); - } + for (unsigned i = 0; i < mig.size (); i ++) + { + if (mig [i] != center) + { + __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; } diff --git a/trunk/paradiseo-peo/src/core/star_topo.h b/trunk/paradiseo-peo/src/core/star_topo.h index 7ef07ed3e..e3ab5acf2 100644 --- a/trunk/paradiseo-peo/src/core/star_topo.h +++ b/trunk/paradiseo-peo/src/core/star_topo.h @@ -1,4 +1,4 @@ -/* +/* * * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 * (C) OPAC Team, LIFL, 2002-2008 @@ -39,21 +39,22 @@ #include "topology.h" -class StarTopology : public Topology { +class StarTopology : public Topology + { -public : + public : - StarTopology (); + StarTopology (); - void setNeighbors (Cooperative * __mig, - std :: vector & __from, - std :: vector & __to); + void setNeighbors (Cooperative * __mig, + std :: vector & __from, + std :: vector & __to); - void setCenter (Cooperative& __center); + void setCenter (Cooperative& __center); -private : + private : - Cooperative* center; -}; + Cooperative* center; + }; #endif diff --git a/trunk/paradiseo-peo/src/core/topology.cpp b/trunk/paradiseo-peo/src/core/topology.cpp index 2838f433d..fffeca66c 100644 --- a/trunk/paradiseo-peo/src/core/topology.cpp +++ b/trunk/paradiseo-peo/src/core/topology.cpp @@ -43,10 +43,10 @@ Topology :: ~ Topology () } void Topology :: add (Cooperative & __mig) - { +{ - mig.push_back (& __mig) ; - } + mig.push_back (& __mig) ; +} Topology :: operator std :: vector & () { diff --git a/trunk/paradiseo-peo/src/peoAsyncIslandMig.h b/trunk/paradiseo-peo/src/peoAsyncIslandMig.h index 9513abc81..b6a2278a1 100644 --- a/trunk/paradiseo-peo/src/peoAsyncIslandMig.h +++ b/trunk/paradiseo-peo/src/peoAsyncIslandMig.h @@ -57,7 +57,7 @@ //! @class peoAsyncIslandMig -//! @brief Specific class for a asynchronous migration +//! @brief Specific class for a asynchronous migration //! @see Cooperative eoUpdater //! @version 2.0 //! @date january 2008 @@ -67,18 +67,18 @@ template< class TYPESELECT, class TYPEREPLACE > class peoAsyncIslandMig : public public: //! @brief Constructor - //! @param continuator & __cont - //! @param selector & __select - //! @param replacement & __replace - //! @param Topology& __topology - peoAsyncIslandMig( + //! @param continuator & __cont + //! @param selector & __select + //! @param replacement & __replace + //! @param Topology& __topology + peoAsyncIslandMig( continuator & __cont, selector & __select, replacement & __replace, Topology& __topology ); - //! @brief operator + //! @brief operator void operator()(); //! @brief Function realizing packages void pack(); @@ -88,23 +88,23 @@ template< class TYPESELECT, class TYPEREPLACE > class peoAsyncIslandMig : public void packSynchronizeReq(); private: - //! @brief Function which sends some emigrants + //! @brief Function which sends some emigrants void emigrate(); //! @brief Function which receives some immigrants void immigrate(); private: - //! @param continuator & cont - //! @param selector & select - //! @param replacement & replace - //! @param Topology& topology - //! @param std :: queue< TYPEREPLACE > imm - //! @param std :: queue< TYPESELECT > em - //! @param std :: queue< Cooperative* > coop_em - continuator & cont; - selector & select; - replacement & replace; - Topology& topology; + //! @param continuator & cont + //! @param selector & select + //! @param replacement & replace + //! @param Topology& topology + //! @param std :: queue< TYPEREPLACE > imm + //! @param std :: queue< TYPESELECT > em + //! @param std :: queue< Cooperative* > coop_em + continuator & cont; + selector & select; + replacement & replace; + Topology& topology; std :: queue< TYPEREPLACE > imm; std :: queue< TYPESELECT > em; std :: queue< Cooperative* > coop_em; @@ -189,8 +189,8 @@ template< class TYPESELECT , class TYPEREPLACE> void peoAsyncIslandMig< TYPESELE if (! cont.check()) { - emigrate(); - immigrate(); + emigrate(); + immigrate(); } } diff --git a/trunk/paradiseo-peo/src/peoData.h b/trunk/paradiseo-peo/src/peoData.h index 85be9c3d0..e6ba3397b 100644 --- a/trunk/paradiseo-peo/src/peoData.h +++ b/trunk/paradiseo-peo/src/peoData.h @@ -51,9 +51,9 @@ class continuator { public: - - //! @brief Virtual function of check - //! @return true if the algorithm must continue + + //! @brief Virtual function of check + //! @return true if the algorithm must continue virtual bool check()=0; //! @brief Virtual destructor virtual ~continuator(){} @@ -69,22 +69,22 @@ template < class EOT> class eoContinuator : public continuator { public: - //! @brief Constructor - //! @param eoContinue & - //! @param eoPop & + //! @brief Constructor + //! @param eoContinue & + //! @param eoPop & eoContinuator(eoContinue & _cont, const eoPop & _pop): cont (_cont), pop(_pop) {} - //! @brief Virtual function of check - //! @return false if the algorithm must continue + //! @brief Virtual function of check + //! @return false if the algorithm must continue virtual bool check() { return cont(pop); } protected: - //! @param eoContinue & - //! @param eoPop & + //! @param eoContinue & + //! @param eoPop & eoContinue & cont ; const eoPop & pop; }; @@ -101,9 +101,9 @@ template < class EOT> class eoContinuator : public continuator template < class TYPE> class selector { public: - - //! @brief Virtual operator on the template type - //! @param TYPE & + + //! @brief Virtual operator on the template type + //! @param TYPE & virtual void operator()(TYPE &)=0; //! @brief Virtual destructor virtual ~selector(){} @@ -119,16 +119,16 @@ template < class EOT, class TYPE> class eoSelector : public selector< TYPE > { public: - //! @brief Constructor - //! @param eoSelectOne & - //! @param unsigned _nb_select - //! @param TYPE & _source (with TYPE which is the template type) + //! @brief Constructor + //! @param eoSelectOne & + //! @param unsigned _nb_select + //! @param TYPE & _source (with TYPE which is the template type) eoSelector(eoSelectOne & _select, unsigned _nb_select, const TYPE & _source): selector (_select), nb_select(_nb_select), source(_source) {} - - //! @brief Virtual operator on the template type - //! @param TYPE & _dest - virtual void operator()(TYPE & _dest) + + //! @brief Virtual operator on the template type + //! @param TYPE & _dest + virtual void operator()(TYPE & _dest) { size_t target = static_cast(nb_select); _dest.resize(target); @@ -137,9 +137,9 @@ template < class EOT, class TYPE> class eoSelector : public selector< TYPE > } protected: - //! @param eoSelectOne & - //! @param unsigned nb_select - //! @param TYPE & source + //! @param eoSelectOne & + //! @param unsigned nb_select + //! @param TYPE & source eoSelectOne & selector ; unsigned nb_select; const TYPE & source; @@ -157,8 +157,8 @@ template < class EOT, class TYPE> class eoSelector : public selector< TYPE > template < class TYPE> class replacement { public: - //! @brief Virtual operator on the template type - //! @param TYPE & + //! @brief Virtual operator on the template type + //! @param TYPE & virtual void operator()(TYPE &)=0; //! @brief Virtual destructor virtual ~replacement(){} @@ -173,22 +173,22 @@ template < class TYPE> class replacement template < class EOT, class TYPE> class eoReplace : public replacement< TYPE > { public: - //! @brief Constructor - //! @param eoReplacement & - //! @param TYPE & _destination (with TYPE which is the template type) + //! @brief Constructor + //! @param eoReplacement & + //! @param TYPE & _destination (with TYPE which is the template type) eoReplace(eoReplacement & _replace, TYPE & _destination): replace(_replace), destination(_destination) {} - //! @brief Virtual operator on the template type - //! @param TYPE & _source + //! @brief Virtual operator on the template type + //! @param TYPE & _source virtual void operator()(TYPE & _source) { replace(destination, _source); } protected: - //! @param eoReplacement & - //! @param TYPE & destination + //! @param eoReplacement & + //! @param TYPE & destination eoReplacement & replace; TYPE & destination; }; @@ -207,14 +207,14 @@ class eoSyncContinue: public continuator { public: - //! @brief Constructor - //! @param unsigned __period - //! @param unsigned __init_counter + //! @brief Constructor + //! @param unsigned __period + //! @param unsigned __init_counter eoSyncContinue (unsigned __period, unsigned __init_counter = 0): period (__period),counter (__init_counter) {} - //! @brief Virtual function of check - //! @return true if the algorithm must continue + //! @brief Virtual function of check + //! @return true if the algorithm must continue virtual bool check() { return ((++ counter) % period) != 0 ; @@ -222,8 +222,8 @@ class eoSyncContinue: public continuator private: - //! @param unsigned period - //! @param unsigned counter + //! @param unsigned period + //! @param unsigned counter unsigned period; unsigned counter; }; diff --git a/trunk/paradiseo-peo/src/peoEvalFunc.h b/trunk/paradiseo-peo/src/peoEvalFunc.h index af0ec5d98..3b3a5f7b3 100644 --- a/trunk/paradiseo-peo/src/peoEvalFunc.h +++ b/trunk/paradiseo-peo/src/peoEvalFunc.h @@ -50,21 +50,21 @@ template< class EOT, class FitT = typename EOT::Fitness, class FunctionArg = con struct peoEvalFunc: public eoEvalFunc { - //! @brief Constructor - //! @param FitT (* _eval)( FunctionArg ) + //! @brief Constructor + //! @param FitT (* _eval)( FunctionArg ) peoEvalFunc( FitT (* _eval)( FunctionArg ) ) : eoEvalFunc(), evalFunc( _eval ) {}; - //! @brief Virtual operator - //! @param EOT & _peo + //! @brief Virtual operator + //! @param EOT & _peo virtual void operator() ( EOT & _peo ) { _peo.fitness((*evalFunc)( _peo )); }; private: - //! @param FitT (* evalFunc )( FunctionArg ) + //! @param FitT (* evalFunc )( FunctionArg ) FitT (* evalFunc )( FunctionArg ); }; diff --git a/trunk/paradiseo-peo/src/peoMoeoPopEval.h b/trunk/paradiseo-peo/src/peoMoeoPopEval.h index 1ec7f4672..88af7eac8 100644 --- a/trunk/paradiseo-peo/src/peoMoeoPopEval.h +++ b/trunk/paradiseo-peo/src/peoMoeoPopEval.h @@ -71,10 +71,10 @@ template< class EOT > class peoMoeoPopEval : public Service, public eoPopEvalFun //! //! @param eoPop< EOT >& __pop - population to be evaluated by applying the evaluation functor specified in the constructor. void operator()(eoPop< EOT >& __pop); - + //! @brief Operator ()( eoPop< EOT >& __dummy, eoPop< EOT >& __pop ) - //! @param eoPop< EOT >& __dummy - //! @param eoPop< EOT >& __pop + //! @param eoPop< EOT >& __dummy + //! @param 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 @@ -105,16 +105,16 @@ template< class EOT > class peoMoeoPopEval : public Service, public eoPopEvalFun void notifySendingAllResourceRequests(); private: - //! @param std :: vector< eoEvalFunc < EOT >* >& funcs - //! @param std :: vector< eoEvalFunc < EOT >* > one_func - //! @param peoAggEvalFunc< EOT >& merge_eval - //! @param peoNoAggEvalFunc< EOT > no_merge_eval - //! @param std :: queue< EOT* >tasks - //! @param std :: map< EOT*, std :: pair< unsigned, unsigned > > progression - //! @param unsigned num_func - //! @param EOT sol - //! @param EOT *ad_sol - //! @param unsigned total + //! @param std :: vector< eoEvalFunc < EOT >* >& funcs + //! @param std :: vector< eoEvalFunc < EOT >* > one_func + //! @param peoAggEvalFunc< EOT >& merge_eval + //! @param peoNoAggEvalFunc< EOT > no_merge_eval + //! @param std :: queue< EOT* >tasks + //! @param std :: map< EOT*, std :: pair< unsigned, unsigned > > progression + //! @param unsigned num_func + //! @param EOT sol + //! @param EOT *ad_sol + //! @param unsigned total const std :: vector< eoEvalFunc < EOT >* >& funcs; std :: vector< eoEvalFunc < EOT >* > one_func; peoAggEvalFunc< EOT >& merge_eval; diff --git a/trunk/paradiseo-peo/src/peoMultiStart.h b/trunk/paradiseo-peo/src/peoMultiStart.h index 077b5e560..835c9bb28 100644 --- a/trunk/paradiseo-peo/src/peoMultiStart.h +++ b/trunk/paradiseo-peo/src/peoMultiStart.h @@ -51,8 +51,8 @@ template < typename EntityType > class peoMultiStart : public Service public: - //! @brief Constructor - //! @param AlgorithmType& externalAlgorithm + //! @brief Constructor + //! @param AlgorithmType& externalAlgorithm template < typename AlgorithmType > peoMultiStart( AlgorithmType& externalAlgorithm ) { singularAlgorithm = new Algorithm< AlgorithmType >( externalAlgorithm ); @@ -60,18 +60,18 @@ template < typename EntityType > class peoMultiStart : public Service aggregationFunction = new NoAggregationFunction(); } - //! @brief Constructor - //! @param AlgorithmReturnType (*externalAlgorithm)( AlgorithmDataType& ) + //! @brief Constructor + //! @param AlgorithmReturnType (*externalAlgorithm)( AlgorithmDataType& ) template < typename AlgorithmReturnType, typename AlgorithmDataType > peoMultiStart( AlgorithmReturnType (*externalAlgorithm)( AlgorithmDataType& ) ) { singularAlgorithm = new FunctionAlgorithm< AlgorithmReturnType, AlgorithmDataType >( externalAlgorithm ); algorithms.push_back( singularAlgorithm ); aggregationFunction = new NoAggregationFunction(); } - - //! @brief Constructor - //! @param std::vector< AlgorithmType* >& externalAlgorithms - //! @param AggregationFunctionType& externalAggregationFunction + + //! @brief Constructor + //! @param std::vector< AlgorithmType* >& externalAlgorithms + //! @param AggregationFunctionType& externalAggregationFunction template < typename AlgorithmType, typename AggregationFunctionType > peoMultiStart( std::vector< AlgorithmType* >& externalAlgorithms, AggregationFunctionType& externalAggregationFunction ) { 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 ); } - //! @brief Constructor - //! @param std::vector< AlgorithmReturnType (*)( AlgorithmDataType& ) >& externalAlgorithms - //! @param AggregationFunctionType& externalAggregationFunction + //! @brief Constructor + //! @param std::vector< AlgorithmReturnType (*)( AlgorithmDataType& ) >& externalAlgorithms + //! @param 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++ ) @@ -93,16 +93,16 @@ template < typename EntityType > class peoMultiStart : public Service aggregationFunction = new AggregationAlgorithm< AggregationFunctionType >( externalAggregationFunction ); } - //! @brief Destructor + //! @brief Destructor ~peoMultiStart() { for ( unsigned int index = 0; index < data.size(); index++ ) delete data[ index ]; - for ( unsigned int index = 0; index < algorithms.size(); index++ ) delete algorithms[ index ]; - delete aggregationFunction; + for ( unsigned int index = 0; index < algorithms.size(); index++ ) delete algorithms[ index ]; + delete aggregationFunction; } - //! @brief operator on the template type - //! @param Type& externalData + //! @brief operator on the template type + //! @param Type& externalData template < typename Type > void operator()( Type& externalData ) { for ( typename Type::iterator externalDataIterator = externalData.begin(); externalDataIterator != externalData.end(); externalDataIterator++ ) @@ -114,9 +114,9 @@ template < typename EntityType > class peoMultiStart : public Service stop(); } - //! @brief operator on the template type - //! @param Type& externalDataBegin - //! @param Type& externalDataEnd + //! @brief operator on the template type + //! @param Type& externalDataBegin + //! @param Type& externalDataEnd template < typename Type > void operator()( const Type& externalDataBegin, const Type& externalDataEnd ) { for ( Type externalDataIterator = externalDataBegin; externalDataIterator != externalDataEnd; externalDataIterator++ ) @@ -128,32 +128,32 @@ template < typename EntityType > class peoMultiStart : public Service stop(); } - //! @brief Function realizing packages of data + //! @brief Function realizing packages of data void packData(); //! @brief Function reconstituting packages of data void unpackData(); - //! @brief Function which executes the algorithm + //! @brief Function which executes the algorithm void execute(); - //! @brief Function realizing packages of the result + //! @brief Function realizing packages of the result void packResult(); - //! @brief Function reconstituting packages of result + //! @brief Function reconstituting packages of result void unpackResult(); - //! @brief Function notifySendingData + //! @brief Function notifySendingData void notifySendingData(); - //! @brief Function notifySendingAllResourceRequests + //! @brief Function notifySendingAllResourceRequests void notifySendingAllResourceRequests(); private: - - //! @param AbstractAlgorithm* singularAlgorithm - //! @param std::vector< AbstractAlgorithm* > algorithms - //! @param AbstractAggregationAlgorithm* aggregationFunction - //! @param EntityType entityTypeInstance - //! @param std::vector< AbstractDataType* > data - //! @param unsigned idx - //! @param unsigned num_term - //! @param unsigned dataIndex - //! @param unsigned functionIndex + + //! @param AbstractAlgorithm* singularAlgorithm + //! @param std::vector< AbstractAlgorithm* > algorithms + //! @param AbstractAggregationAlgorithm* aggregationFunction + //! @param EntityType entityTypeInstance + //! @param std::vector< AbstractDataType* > data + //! @param unsigned idx + //! @param unsigned num_term + //! @param unsigned dataIndex + //! @param unsigned functionIndex template < typename Type > struct DataType; struct AbstractDataType { diff --git a/trunk/paradiseo-peo/src/peoPSO.h b/trunk/paradiseo-peo/src/peoPSO.h index 2c5654344..5d0bb50eb 100644 --- a/trunk/paradiseo-peo/src/peoPSO.h +++ b/trunk/paradiseo-peo/src/peoPSO.h @@ -55,27 +55,27 @@ template class peoPSOSelect: public eoSelectOne { public: - //! @brief Constructor - //! @param eoTopology < POT > & _topology + //! @brief Constructor + //! @param eoTopology < POT > & _topology peoPSOSelect(eoTopology < POT > & _topology):topology(_topology) {} - //! @brief typedef : creation of Fitness + //! @brief typedef : creation of Fitness typedef typename PO < POT >::Fitness Fitness; - //! @brief Virtual operator - //! @param eoPop& _pop - //! @return POT& + //! @brief Virtual operator + //! @param eoPop& _pop + //! @return POT& virtual const POT& operator()(const eoPop& _pop) { return topology.globalBest(_pop); } private: - //! @param eoTopology < POT > & topology + //! @param eoTopology < POT > & topology eoTopology < POT > & topology; }; - + //! @class peoGlobalBestVelocity //! @brief Specific class for a replacement thanks to the velocity migration of a population of a PSO //! @see eoReplacement @@ -86,18 +86,18 @@ class peoGlobalBestVelocity : public eoReplacement { public: - //! @brief typedef : creation of VelocityType + //! @brief typedef : creation of VelocityType typedef typename POT::ParticleVelocityType VelocityType; - //! @brief Constructor - //! @param double & _c3 - //! @param eoVelocity < POT > &_velocity + //! @brief Constructor + //! @param double & _c3 + //! @param eoVelocity < POT > &_velocity peoGlobalBestVelocity( const double & _c3, eoVelocity < POT > &_velocity): c3 (_c3),velocity (_velocity) {} - //! @brief Virtual operator - //! @param eoPop& _dest - //! @param eoPop& _source + //! @brief Virtual operator + //! @param eoPop& _dest + //! @param eoPop& _source void operator()(eoPop& _dest, eoPop& _source) { @@ -113,12 +113,12 @@ class peoGlobalBestVelocity : public eoReplacement } protected: - //! @param double & c3 - //! @param eoVelocity < POT > & velocity + //! @param double & c3 + //! @param eoVelocity < POT > & velocity const double & c3; eoVelocity < POT > & velocity; }; - + //! @class peoWorstPositionReplacement //! @brief Specific class for a replacement of a population of a PSO //! @see eoReplacement @@ -127,13 +127,13 @@ class peoGlobalBestVelocity : public eoReplacement template class peoWorstPositionReplacement : public eoReplacement { public: - //! @brief constructor + //! @brief constructor peoWorstPositionReplacement() {} - //! @brief operator - //! @param eoPop& _dest - //! @param eoPop& _source + //! @brief operator + //! @param eoPop& _dest + //! @param eoPop& _source void operator()(eoPop& _dest, eoPop& _source) { unsigned ind=0; diff --git a/trunk/paradiseo-peo/src/peoPopEval.h b/trunk/paradiseo-peo/src/peoPopEval.h index 0071b0f2f..bcc760940 100644 --- a/trunk/paradiseo-peo/src/peoPopEval.h +++ b/trunk/paradiseo-peo/src/peoPopEval.h @@ -71,10 +71,10 @@ template< class EOT > class peoPopEval : public Service, public eoPopEvalFunc& __pop - population to be evaluated by applying the evaluation functor specified in the constructor. void operator()(eoPop< EOT >& __pop); - + //! @brief Operator ()( eoPop< EOT >& __dummy, eoPop< EOT >& __pop ) - //! @param eoPop< EOT >& __dummy - //! @param eoPop< EOT >& __pop + //! @param eoPop< EOT >& __dummy + //! @param 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 @@ -106,16 +106,16 @@ template< class EOT > class peoPopEval : public Service, public eoPopEvalFunc* >& funcs - //! @param std :: vector< eoEvalFunc < EOT >* > one_func - //! @param peoAggEvalFunc< EOT >& merge_eval - //! @param peoNoAggEvalFunc< EOT > no_merge_eval - //! @param std :: queue< EOT* >tasks - //! @param std :: map< EOT*, std :: pair< unsigned, unsigned > > progression - //! @param unsigned num_func - //! @param EOT sol - //! @param EOT *ad_sol - //! @param unsigned total + //! @param std :: vector< eoEvalFunc < EOT >* >& funcs + //! @param std :: vector< eoEvalFunc < EOT >* > one_func + //! @param peoAggEvalFunc< EOT >& merge_eval + //! @param peoNoAggEvalFunc< EOT > no_merge_eval + //! @param std :: queue< EOT* >tasks + //! @param std :: map< EOT*, std :: pair< unsigned, unsigned > > progression + //! @param unsigned num_func + //! @param EOT sol + //! @param EOT *ad_sol + //! @param unsigned total const std :: vector< eoEvalFunc < EOT >* >& funcs; std :: vector< eoEvalFunc < EOT >* > one_func; 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 ) { - if ( __pop.size() && (funcs.size() * __pop.size()) ) - { - for ( unsigned i = 0; i < __pop.size(); i++ ) - { - __pop[ i ].fitness(typename EOT :: Fitness() ); - progression[ &__pop[ i ] ].first = funcs.size() - 1; - progression[ &__pop[ i ] ].second = funcs.size(); - for ( unsigned j = 0; j < funcs.size(); j++ ) - { - /* Queuing the 'invalid' solution and its associated owner */ - tasks.push( &__pop[ i ] ); - } - } - total = funcs.size() * __pop.size(); - requestResourceRequest( funcs.size() * __pop.size() ); - stop(); - } + if ( __pop.size() && (funcs.size() * __pop.size()) ) + { + for ( unsigned i = 0; i < __pop.size(); i++ ) + { + __pop[ i ].fitness(typename EOT :: Fitness() ); + progression[ &__pop[ i ] ].first = funcs.size() - 1; + progression[ &__pop[ i ] ].second = funcs.size(); + for ( unsigned j = 0; j < funcs.size(); j++ ) + { + /* Queuing the 'invalid' solution and its associated owner */ + tasks.push( &__pop[ i ] ); + } + } + total = funcs.size() * __pop.size(); + requestResourceRequest( funcs.size() * __pop.size() ); + stop(); + } } diff --git a/trunk/paradiseo-peo/src/peoSyncIslandMig.h b/trunk/paradiseo-peo/src/peoSyncIslandMig.h index ff74dea3e..9f125be3b 100644 --- a/trunk/paradiseo-peo/src/peoSyncIslandMig.h +++ b/trunk/paradiseo-peo/src/peoSyncIslandMig.h @@ -64,7 +64,7 @@ //! @class peoSyncIslandMig -//! @brief Specific class for a synchronous migration +//! @brief Specific class for a synchronous migration //! @see Cooperative eoUpdater //! @version 2.0 //! @date january 2008 @@ -74,10 +74,10 @@ template< class TYPESELECT, class TYPEREPLACE > class peoSyncIslandMig : public public: //! @brief Constructor - //! @param unsigned __frequency - //! @param selector & __select - //! @param replacement & __replace - //! @param Topology& __topology + //! @param unsigned __frequency + //! @param selector & __select + //! @param replacement & __replace + //! @param Topology& __topology peoSyncIslandMig( unsigned __frequency, selector & __select, @@ -87,19 +87,19 @@ template< class TYPESELECT, class TYPEREPLACE > class peoSyncIslandMig : public //! @brief operator void operator()(); - //! @brief Function realizing packages + //! @brief Function realizing packages void pack(); //! @brief Function reconstituting packages void unpack(); //! @brief Function packSynchronizeReq void packSynchronizeReq(); - //! @brief Function notifySending + //! @brief Function notifySending void notifySending(); - //! @brief Function notifyReceiving + //! @brief Function notifyReceiving void notifyReceiving(); - //! @brief notifySendingSyncReq + //! @brief notifySendingSyncReq void notifySendingSyncReq(); - //! @brief notifySynchronized + //! @brief notifySynchronized void notifySynchronized(); private: @@ -109,22 +109,22 @@ template< class TYPESELECT, class TYPEREPLACE > class peoSyncIslandMig : public private: - //! @param eoSyncContinue cont - //! @param selector & select - //! @param replacement & replace - //! @param Topology& topology - //! @param std :: queue< TYPEREPLACE > imm - //! @param std :: queue< TYPESELECT > em - //! @param std :: queue< Cooperative* > coop_em - //! @param sem_t sync - //! @param bool explicitPassive - //! @param bool standbyMigration - //! @param std :: vector< Cooperative* > in, out, all - //! @param unsigned nbMigrations - eoSyncContinue cont; - selector & select; - replacement & replace; - Topology& topology; + //! @param eoSyncContinue cont + //! @param selector & select + //! @param replacement & replace + //! @param Topology& topology + //! @param std :: queue< TYPEREPLACE > imm + //! @param std :: queue< TYPESELECT > em + //! @param std :: queue< Cooperative* > coop_em + //! @param sem_t sync + //! @param bool explicitPassive + //! @param bool standbyMigration + //! @param std :: vector< Cooperative* > in, out, all + //! @param unsigned nbMigrations + eoSyncContinue cont; + selector & select; + replacement & replace; + Topology& topology; std :: queue< TYPEREPLACE > imm; std :: queue< TYPESELECT > em; std :: queue< Cooperative* > coop_em; diff --git a/trunk/paradiseo-peo/src/peoTransform.h b/trunk/paradiseo-peo/src/peoTransform.h index 708284e91..b6b058871 100644 --- a/trunk/paradiseo-peo/src/peoTransform.h +++ b/trunk/paradiseo-peo/src/peoTransform.h @@ -55,11 +55,11 @@ template< class EOT > class peoTransform : public Service, public eoTransform< E public: - //! @brief Constructor - //! @param eoQuadOp< EOT >& __cross - //! @param double __cross_rate - //! @param eoMonOp< EOT >& __mut - //! @param double __mut_rate + //! @brief Constructor + //! @param eoQuadOp< EOT >& __cross + //! @param double __cross_rate + //! @param eoMonOp< EOT >& __mut + //! @param double __mut_rate peoTransform( eoQuadOp< EOT >& __cross, double __cross_rate, @@ -67,34 +67,34 @@ template< class EOT > class peoTransform : public Service, public eoTransform< E double __mut_rate ); - //! @brief Operator - //! @param eoPop< EOT >& __pop + //! @brief Operator + //! @param eoPop< EOT >& __pop void operator()( eoPop< EOT >& __pop ); - //! @brief Function realizing packages of data + //! @brief Function realizing packages of data void packData(); - //! @brief Function reconstituting packages of data + //! @brief Function reconstituting packages of data void unpackData(); - //! @brief Function which executes the algorithm + //! @brief Function which executes the algorithm void execute(); - //! @brief Function realizing packages of the result + //! @brief Function realizing packages of the result void packResult(); - //! @brief Function reconstituting packages of result + //! @brief Function reconstituting packages of result void unpackResult(); - //! @brief Function notifySendingData + //! @brief Function notifySendingData void notifySendingData(); //! @brief Function notifySendingAllResourceRequests void notifySendingAllResourceRequests(); private: - //! @param eoQuadOp< EOT >& cross - //! @param double cross_rate - //! @param eoMonOp< EOT >& mut - //! @param double mut_rate - //! @param unsigned idx - //! @param eoPop< EOT >* pop - //! @param EOT father - //! @param mother - //! @param unsigned num_term + //! @param eoQuadOp< EOT >& cross + //! @param double cross_rate + //! @param eoMonOp< EOT >& mut + //! @param double mut_rate + //! @param unsigned idx + //! @param eoPop< EOT >* pop + //! @param EOT father + //! @param mother + //! @param unsigned num_term eoQuadOp< EOT >& cross; double cross_rate; eoMonOp< EOT >& mut; diff --git a/trunk/paradiseo-peo/src/peoWrapper.h b/trunk/paradiseo-peo/src/peoWrapper.h index 88212870d..664f53b41 100644 --- a/trunk/paradiseo-peo/src/peoWrapper.h +++ b/trunk/paradiseo-peo/src/peoWrapper.h @@ -51,39 +51,39 @@ class peoWrapper : public Runner public: - //! @brief constructor - //! @param AlgorithmType& externalAlgorithm + //! @brief constructor + //! @param AlgorithmType& externalAlgorithm template< typename AlgorithmType > peoWrapper( AlgorithmType& externalAlgorithm ) : algorithm( new Algorithm< AlgorithmType, void >( externalAlgorithm ) ) {} - //! @brief constructor - //! @param AlgorithmType& externalAlgorithm - //! @param AlgorithmDataType& externalData + //! @brief constructor + //! @param AlgorithmType& externalAlgorithm + //! @param AlgorithmDataType& externalData template< typename AlgorithmType, typename AlgorithmDataType > peoWrapper( AlgorithmType& externalAlgorithm, AlgorithmDataType& externalData ) : algorithm( new Algorithm< AlgorithmType, AlgorithmDataType >( externalAlgorithm, externalData ) ) {} - //! @brief constructor - //! @param AlgorithmReturnType& (*externalAlgorithm)() + //! @brief constructor + //! @param AlgorithmReturnType& (*externalAlgorithm)() template< typename AlgorithmReturnType > peoWrapper( AlgorithmReturnType& (*externalAlgorithm)() ) : algorithm( new FunctionAlgorithm< AlgorithmReturnType, void >( externalAlgorithm ) ) {} - //! @brief constructor - //! @param AlgorithmReturnType& (*externalAlgorithm)( AlgorithmDataType& ) - //! @param AlgorithmDataType& externalData + //! @brief constructor + //! @param AlgorithmReturnType& (*externalAlgorithm)( AlgorithmDataType& ) + //! @param AlgorithmDataType& externalData template< typename AlgorithmReturnType, typename AlgorithmDataType > peoWrapper( AlgorithmReturnType& (*externalAlgorithm)( AlgorithmDataType& ), AlgorithmDataType& externalData ) : algorithm( new FunctionAlgorithm< AlgorithmReturnType, AlgorithmDataType >( externalAlgorithm, externalData ) ) {} - - //! @brief destructor + + //! @brief destructor ~peoWrapper() { delete algorithm; } - //! @brief function run + //! @brief function run void run() { algorithm->operator()(); @@ -166,7 +166,7 @@ class peoWrapper : public Runner }; private: - //! @param AbstractAlgorithm* algorithm + //! @param AbstractAlgorithm* algorithm AbstractAlgorithm* algorithm; }; diff --git a/trunk/paradiseo-peo/src/rmc/mpi/synchron.h b/trunk/paradiseo-peo/src/rmc/mpi/synchron.h index 38a8a8f49..8b1ad0f43 100644 --- a/trunk/paradiseo-peo/src/rmc/mpi/synchron.h +++ b/trunk/paradiseo-peo/src/rmc/mpi/synchron.h @@ -65,10 +65,14 @@ struct SyncCompare std::vector< SyncEntry >::const_iterator itA = syncA.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(); } diff --git a/trunk/paradiseo-peo/test/t-EAAsyncIsland.cpp b/trunk/paradiseo-peo/test/t-EAAsyncIsland.cpp index e70337604..a48e9092a 100644 --- a/trunk/paradiseo-peo/test/t-EAAsyncIsland.cpp +++ b/trunk/paradiseo-peo/test/t-EAAsyncIsland.cpp @@ -48,7 +48,7 @@ int main (int __argc, char *__argv[]) { peo :: init( __argc, __argv ); 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); RingTopology topology; eoGenContinue < Indi > genContPara (10); @@ -63,7 +63,8 @@ int main (int __argc, char *__argv[]) eoSegmentCrossover crossover; eoUniformMutation mutation(0.01); peoTransform transform(crossover,0.8,mutation,0.3); - /*p*/eoPop < Indi > pop; + /*p*/ + eoPop < Indi > pop; pop.append (10, random); eoPlusReplacement replace; eoRandomSelect mig_select_one; @@ -90,7 +91,8 @@ int main (int __argc, char *__argv[]) eoSegmentCrossover crossover2; eoUniformMutation mutation2(0.01); peoTransform transform2(crossover2,0.8,mutation2,0.3); - /*p*/eoPop < Indi > pop2; + /*p*/ + eoPop < Indi > pop2; pop2.append (10, random2); eoPlusReplacement replace2; eoRandomSelect mig_select_one2; diff --git a/trunk/paradiseo-peo/test/t-EASyncIsland.cpp b/trunk/paradiseo-peo/test/t-EASyncIsland.cpp index d910b24d4..696749a27 100644 --- a/trunk/paradiseo-peo/test/t-EASyncIsland.cpp +++ b/trunk/paradiseo-peo/test/t-EASyncIsland.cpp @@ -49,7 +49,7 @@ int main (int __argc, char *__argv[]) { peo :: init( __argc, __argv ); 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); RingTopology topology; eoGenContinue < Indi > genContPara (10); diff --git a/trunk/paradiseo-peo/test/t-Mpdallexit.cpp b/trunk/paradiseo-peo/test/t-Mpdallexit.cpp index 7ff282163..53df81679 100644 --- a/trunk/paradiseo-peo/test/t-Mpdallexit.cpp +++ b/trunk/paradiseo-peo/test/t-Mpdallexit.cpp @@ -39,5 +39,5 @@ int main (int __argc, char *__argv[]) { - system("mpdallexit"); + system("mpdallexit"); } diff --git a/trunk/paradiseo-peo/test/t-Mpdboot.cpp b/trunk/paradiseo-peo/test/t-Mpdboot.cpp index 8b0510791..4773b482f 100644 --- a/trunk/paradiseo-peo/test/t-Mpdboot.cpp +++ b/trunk/paradiseo-peo/test/t-Mpdboot.cpp @@ -39,5 +39,5 @@ int main (int __argc, char *__argv[]) { - system("mpdboot"); + system("mpdboot"); } diff --git a/trunk/paradiseo-peo/test/t-MultiStart.cpp b/trunk/paradiseo-peo/test/t-MultiStart.cpp index 38fd67ceb..8ec9e4882 100644 --- a/trunk/paradiseo-peo/test/t-MultiStart.cpp +++ b/trunk/paradiseo-peo/test/t-MultiStart.cpp @@ -39,29 +39,29 @@ #include -struct Algorithm -{ - void operator()(double & _d) - { - _d = _d * _d; - } -}; +struct Algorithm + { + void operator()(double & _d) + { + _d = _d * _d; + } + }; int main (int __argc, char * * __argv) { peo :: init (__argc, __argv); if (getNodeRank()==1) - std::cout<<"\n\nTest : multistart\n\n"; + std::cout<<"\n\nTest : multistart\n\n"; std::vector < double > v; if (getNodeRank()==1) - std::cout<<"\n\nBefore :"; - for(unsigned i = 0; i< 10; i++) - { - v.push_back(i); - if (getNodeRank()==1) - std::cout<<"\n"< initParallel (algo); peoWrapper parallelAlgo (initParallel, v); @@ -69,9 +69,9 @@ int main (int __argc, char * * __argv) peo :: run( ); peo :: finalize( ); if (getNodeRank()==1) - { - std::cout<<"\n\nAfter :\n"; - for(unsigned i = 0; i< 10; i++) - std::cout< genContPara (10); diff --git a/trunk/paradiseo-peo/test/t-PSOWorstPosition.cpp b/trunk/paradiseo-peo/test/t-PSOWorstPosition.cpp index a36f764a1..164b98c35 100644 --- a/trunk/paradiseo-peo/test/t-PSOWorstPosition.cpp +++ b/trunk/paradiseo-peo/test/t-PSOWorstPosition.cpp @@ -47,7 +47,7 @@ int main (int __argc, char *__argv[]) { peo :: init( __argc, __argv ); if (getNodeRank()==1) - std::cout<<"\n\nTest : PSO Worst Position\n\n"; + std::cout<<"\n\nTest : PSO Worst Position\n\n"; rng.reseed (10); RingTopology topologyMig; eoGenContinue < Indi > genContPara (10); diff --git a/trunk/paradiseo-peo/test/t-ParallelEval.cpp b/trunk/paradiseo-peo/test/t-ParallelEval.cpp index df41d27ee..5da070ad3 100644 --- a/trunk/paradiseo-peo/test/t-ParallelEval.cpp +++ b/trunk/paradiseo-peo/test/t-ParallelEval.cpp @@ -44,22 +44,22 @@ double f (const Indi & _indi) double sum=_indi[0]+_indi[1]; return (-sum); } -struct Algorithm -{ - Algorithm( peoPopEval < Indi > & _eval): eval( _eval ){} - void operator()(eoPop < Indi > & _pop) - { - eoPop < Indi > empty_pop; - eval(empty_pop, _pop); - } - peoPopEval < Indi > & eval; -}; +struct Algorithm + { + Algorithm( peoPopEval < Indi > & _eval): eval( _eval ){} + void operator()(eoPop < Indi > & _pop) + { + eoPop < Indi > empty_pop; + eval(empty_pop, _pop); + } + peoPopEval < Indi > & eval; + }; int main (int __argc, char *__argv[]) { peo :: init( __argc, __argv ); if (getNodeRank()==1) - std::cout<<"\n\nTest : parallel evaluation\n\n"; + std::cout<<"\n\nTest : parallel evaluation\n\n"; rng.reseed (10); peoEvalFunc plainEval(f); peoPopEval< Indi > eval(plainEval); @@ -72,8 +72,8 @@ int main (int __argc, char *__argv[]) peo :: run(); peo :: finalize(); if (getNodeRank()==1) - { + { pop.sort(); std::cout< & _eval, eoSelect < Indi > & _select, peoTransform < Indi > & _transform): - loopEval(_eval), +struct Algorithm + { + Algorithm( eoEvalFunc < Indi > & _eval, eoSelect < Indi > & _select, peoTransform < Indi > & _transform): + loopEval(_eval), eval(loopEval), - selectTransform( _select, _transform), - breed(selectTransform) {} - - void operator()(eoPop < Indi > & _pop) - { - eoPop < Indi > offspring, empty_pop; - eval(empty_pop, _pop); - eval(empty_pop, offspring); - std::cout<<"\n\nBefore :\n"< loopEval; + selectTransform( _select, _transform), + breed(selectTransform) {} + + void operator()(eoPop < Indi > & _pop) + { + eoPop < Indi > offspring, empty_pop; + eval(empty_pop, _pop); + eval(empty_pop, offspring); + std::cout<<"\n\nBefore :\n"< loopEval; eoPopEvalFunc < Indi > & eval; - eoSelectTransform < Indi > selectTransform; + eoSelectTransform < Indi > selectTransform; eoBreed < Indi > & breed; -}; + }; int main (int __argc, char *__argv[]) { peo :: init( __argc, __argv ); if (getNodeRank()==1) - std::cout<<"\n\nTest : parallel transform\n\n"; + std::cout<<"\n\nTest : parallel transform\n\n"; rng.reseed (10); eoEvalFuncPtr < Indi > plainEval(f); eoEvalFuncCounter < Indi > eval(plainEval); diff --git a/trunk/paradiseo-peo/tutorial/Lesson1/mainEA.cpp b/trunk/paradiseo-peo/tutorial/Lesson1/mainEA.cpp index ede215582..6c65ef7fb 100644 --- a/trunk/paradiseo-peo/tutorial/Lesson1/mainEA.cpp +++ b/trunk/paradiseo-peo/tutorial/Lesson1/mainEA.cpp @@ -65,7 +65,7 @@ int main (int __argc, char *__argv[]) double EPSILON = parser.createParam(0.01, "mutEpsilon", "epsilon for mutation",'e',"Param").value(); double CROSS_RATE = parser.createParam(0.25, "pCross", "Crossover probability",'C',"Param").value(); double MUT_RATE = parser.createParam(0.35, "pMut", "Mutation probability",'M',"Param").value(); - unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); + unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value(); double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value(); rng.reseed (time(0)); @@ -88,7 +88,7 @@ int main (int __argc, char *__argv[]) eoSelectNumber select(selectionStrategy,POP_SIZE); // Transformation - eoSegmentCrossover crossover; + eoSegmentCrossover crossover; eoUniformMutation mutation(EPSILON); eoSGATransform transform(crossover,CROSS_RATE,mutation,MUT_RATE); diff --git a/trunk/paradiseo-peo/tutorial/Lesson1/mainPSO.cpp b/trunk/paradiseo-peo/tutorial/Lesson1/mainPSO.cpp index 1e6908784..5e7315683 100644 --- a/trunk/paradiseo-peo/tutorial/Lesson1/mainPSO.cpp +++ b/trunk/paradiseo-peo/tutorial/Lesson1/mainPSO.cpp @@ -61,7 +61,7 @@ int main (int __argc, char *__argv[]) eoParser parser(__argc, __argv); unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value(); unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value(); - unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); + unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value(); double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value(); double INIT_VELOCITY_MIN = parser.createParam(-1.0, "vMin", "Init velocity min",'n',"Param").value(); diff --git a/trunk/paradiseo-peo/tutorial/Lesson2/mainEA.cpp b/trunk/paradiseo-peo/tutorial/Lesson2/mainEA.cpp index f90a462ac..3d36aff8a 100644 --- a/trunk/paradiseo-peo/tutorial/Lesson2/mainEA.cpp +++ b/trunk/paradiseo-peo/tutorial/Lesson2/mainEA.cpp @@ -58,7 +58,7 @@ int main (int __argc, char *__argv[]) double EPSILON = parser.createParam(0.01, "mutEpsilon", "epsilon for mutation",'e',"Param").value(); double CROSS_RATE = parser.createParam(0.25, "pCross", "Crossover probability",'C',"Param").value(); double MUT_RATE = parser.createParam(0.35, "pMut", "Mutation probability",'M',"Param").value(); - unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); + unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value(); double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value(); rng.reseed (time(0)); diff --git a/trunk/paradiseo-peo/tutorial/Lesson3/mainEA.cpp b/trunk/paradiseo-peo/tutorial/Lesson3/mainEA.cpp index b5fd862ca..daaa068c3 100644 --- a/trunk/paradiseo-peo/tutorial/Lesson3/mainEA.cpp +++ b/trunk/paradiseo-peo/tutorial/Lesson3/mainEA.cpp @@ -58,7 +58,7 @@ int main (int __argc, char *__argv[]) double EPSILON = parser.createParam(0.01, "mutEpsilon", "epsilon for mutation",'e',"Param").value(); double CROSS_RATE = parser.createParam(0.25, "pCross", "Crossover probability",'C',"Param").value(); double MUT_RATE = parser.createParam(0.35, "pMut", "Mutation probability",'M',"Param").value(); - unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); + unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value(); double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value(); unsigned int MIG_FREQ = parser.createParam((unsigned int)(10), "migFreq", "Migration frequency",'F',"Param").value(); @@ -85,9 +85,9 @@ int main (int __argc, char *__argv[]) peoTransform transform(crossover,CROSS_RATE,mutation,MUT_RATE); eoPop < Indi > pop; pop.append (POP_SIZE, random); - + // Define a synchronous island - + // Seclection eoRandomSelect mig_select_one; eoSelector > mig_select (mig_select_one,MIG_SIZE,pop); @@ -97,7 +97,7 @@ int main (int __argc, char *__argv[]) // Island peoSyncIslandMig, eoPop > mig(MIG_FREQ,mig_select,mig_replace,topology); checkpoint.add(mig); - + eoEasyEA< Indi > eaAlg( checkpoint, eval, select, transform, replace ); peoWrapper parallelEA( eaAlg, pop); eval.setOwner(parallelEA); diff --git a/trunk/paradiseo-peo/tutorial/Lesson3/mainPSO.cpp b/trunk/paradiseo-peo/tutorial/Lesson3/mainPSO.cpp index d98a3a2cf..5fbe1c54a 100644 --- a/trunk/paradiseo-peo/tutorial/Lesson3/mainPSO.cpp +++ b/trunk/paradiseo-peo/tutorial/Lesson3/mainPSO.cpp @@ -53,7 +53,7 @@ int main (int __argc, char *__argv[]) eoParser parser(__argc, __argv); unsigned int POP_SIZE = parser.createParam((unsigned int)(20), "popSize", "Population size",'P',"Param").value(); unsigned int MAX_GEN = parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations",'G',"Param").value(); - unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); + unsigned int VEC_SIZE = parser.createParam((unsigned int)(2), "vecSize", "Vector size",'V',"Param").value(); double INIT_POSITION_MIN = parser.createParam(-2.0, "pMin", "Init position min",'N',"Param").value(); double INIT_POSITION_MAX = parser.createParam(2.0, "pMax", "Init position max",'X',"Param").value(); double INIT_VELOCITY_MIN = parser.createParam(-1.0, "vMin", "Init velocity min",'n',"Param").value(); diff --git a/trunk/paradiseo-peo/tutorial/examples/tsp/edge_xover.cpp b/trunk/paradiseo-peo/tutorial/examples/tsp/edge_xover.cpp index a4c46f617..fa5a17f9e 100644 --- a/trunk/paradiseo-peo/tutorial/examples/tsp/edge_xover.cpp +++ b/trunk/paradiseo-peo/tutorial/examples/tsp/edge_xover.cpp @@ -63,16 +63,16 @@ void EdgeXover :: build_map (const Route & __par1, const Route & __par2) } void EdgeXover :: remove_entry (unsigned __vertex, std :: vector > & __map) - { +{ - std :: set & neigh = __map [__vertex] ; + std :: set & neigh = __map [__vertex] ; - for (std :: set :: iterator it = neigh.begin () ; - it != neigh.end () ; - it ++) - __map [* it].erase (__vertex) ; + for (std :: set :: iterator it = neigh.begin () ; + it != neigh.end () ; + it ++) + __map [* it].erase (__vertex) ; - } +} 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 & neigh = _map [cur_vertex] ; for (std :: set :: iterator it = neigh.begin () ; - it != neigh.end () ; - it ++) - { - unsigned l = _map [* it].size () ; - if (len_min_entry > l) - len_min_entry = l ; - } + it != neigh.end () ; + it ++) + { + unsigned l = _map [* it].size () ; + if (len_min_entry > l) + len_min_entry = l ; + } std :: vector cand ; /* Candidates */ for (std :: set :: iterator it = neigh.begin () ; - it != neigh.end () ; - it ++) - { - unsigned l = _map [* it].size () ; - if (len_min_entry == l) - cand.push_back (* it) ; - } + it != neigh.end () ; + it ++) + { + unsigned l = _map [* it].size () ; + if (len_min_entry == l) + cand.push_back (* it) ; + } if (! cand.size ()) {