From 5f7d120a6e34133a408957c79496a457f3ade31a Mon Sep 17 00:00:00 2001 From: jhumeau Date: Wed, 7 Apr 2010 15:52:47 +0000 Subject: [PATCH] Replace Templates NHE and Neighborhood git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1732 331e1502-861f-0410-8da2-ba01fb791d7f --- trunk/paradiseo-mo/CMakeLists.txt | 10 +++---- trunk/paradiseo-mo/src/algo/moLocalSearch.h | 17 ++++++------ .../src/continuator/moCheckpoint.h | 14 +++++----- .../src/continuator/moContinuator.h | 9 ++++--- .../src/continuator/moIterContinuator.h | 8 +++--- .../src/continuator/moMaxNeighborStat.h | 12 ++++----- .../src/continuator/moMinNeighborStat.h | 12 ++++----- .../src/continuator/moNbInfNeighborStat.h | 12 ++++----- .../src/continuator/moNbSupNeighborStat.h | 12 ++++----- .../src/continuator/moNeighborhoodStat.h | 9 ++++--- .../continuator/moNeutralDegreeNeighborStat.h | 10 +++---- .../continuator/moSecondMomentNeighborStat.h | 10 +++---- .../src/continuator/moSizeNeighborStat.h | 10 +++---- .../src/continuator/moTrueContinuator.h | 6 ++--- .../src/explorer/moFirstImprExplorer.h | 15 ++++++----- .../src/explorer/moHCneutralExplorer.h | 27 ++++++++++--------- .../paradiseo-mo/src/explorer/moILSexplorer.h | 13 +++++---- .../explorer/moMetropolisHastingExplorer.h | 15 ++++++----- .../src/explorer/moNeighborhoodExplorer.h | 9 +++---- .../explorer/moRandomNeutralWalkExplorer.h | 15 ++++++----- .../src/explorer/moRandomWalkExplorer.h | 15 ++++++----- .../paradiseo-mo/src/explorer/moSAexplorer.h | 15 ++++++----- .../src/explorer/moSimpleHCexplorer.h | 15 ++++++----- .../src/explorer/moSimpleHCneutralExplorer.h | 15 ++++++----- .../paradiseo-mo/src/explorer/moTSExplorer.h | 16 +++++------ trunk/paradiseo-mo/test/moTestClass.h | 2 +- trunk/paradiseo-mo/test/t-moCheckpoint.cpp | 6 ++--- .../test/t-moFirstImprExplorer.cpp | 2 +- .../test/t-moHCneutralExplorer.cpp | 2 +- .../test/t-moMetropolisHastingExplorer.cpp | 2 +- .../test/t-moNeighborhoodStat.cpp | 16 +++++------ .../test/t-moRandomNeutralWalkExplorer.cpp | 4 +-- .../test/t-moRandomWalkExplorer.cpp | 2 +- .../test/t-moSimpleHCexplorer.cpp | 2 +- .../test/t-moSimpleHCneutralExplorer.cpp | 2 +- trunk/paradiseo-mo/test/t-moTSExplorer.cpp | 6 ++--- .../paradiseo-mo/test/t-moTrueContinuator.cpp | 2 +- .../oneMax/application/CMakeLists.txt | 4 +-- .../oneMax/application/testFirstImpr.cpp | 6 ++--- .../oneMax/application/testHCneutral.cpp | 6 ++--- .../tutorial/oneMax/application/testILS.cpp | 16 +++++------ .../application/testMetropolisHasting.cpp | 6 ++--- .../application/testRandomNeutralWalk.cpp | 24 ++++++++--------- .../oneMax/application/testRandomWalk.cpp | 8 +++--- .../oneMax/application/testSimpleHC.cpp | 6 ++--- .../application/testSimpleHCneutral.cpp | 6 ++--- .../oneMax/application/testSimpleTS.cpp | 6 ++--- .../application/testSimulatedAnnealing.cpp | 6 ++--- 48 files changed, 236 insertions(+), 227 deletions(-) diff --git a/trunk/paradiseo-mo/CMakeLists.txt b/trunk/paradiseo-mo/CMakeLists.txt index 7627ba19e..3b58ccd7f 100644 --- a/trunk/paradiseo-mo/CMakeLists.txt +++ b/trunk/paradiseo-mo/CMakeLists.txt @@ -35,12 +35,12 @@ IF(NOT DEFINED config OR NOT config) give the path of the install configuration file. ") ENDIF(NOT DEFINED config OR NOT config) -EXECUTE_PROCESS( - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${ParadisEO-MOEO_SOURCE_DIR}/CTestCustom.cmake - ${ParadisEO-MOEO_BINARY_DIR}/CTestCustom.cmake) - # Need the config file whose full path is given thanks to the "config" variable INCLUDE(${config}) + +EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/CTestCustom.cmake + ${MO_BIN_DIR}/CTestCustom.cmake) ########################################################################################################################################## diff --git a/trunk/paradiseo-mo/src/algo/moLocalSearch.h b/trunk/paradiseo-mo/src/algo/moLocalSearch.h index ad7ce5d7c..965825a94 100644 --- a/trunk/paradiseo-mo/src/algo/moLocalSearch.h +++ b/trunk/paradiseo-mo/src/algo/moLocalSearch.h @@ -37,23 +37,24 @@ #include #include +#include #include /** * the main algorithm of the local search */ -template -class moLocalSearch: public eoMonOp +template +class moLocalSearch: public eoMonOp { public: - typedef NHE NeighborhoodExplorer ; - typedef typename NeighborhoodExplorer::EOT EOT ; - typedef typename NeighborhoodExplorer::Neighborhood Neighborhood ; + typedef moNeighborhood Neighborhood; + typedef moNeighborhoodExplorer NeighborhoodExplorer; + typedef typename Neighbor::EOT EOT ; /** * Constructor of a moLocalSearch needs a NeighborhooExplorer and a Continuator */ - moLocalSearch(moNeighborhoodExplorer& _searchExpl, moContinuator & _continuator, eoEvalFunc& _fullEval) : searchExplorer(_searchExpl), continuator(_continuator), fullEval(_fullEval) { } ; + moLocalSearch(NeighborhoodExplorer& _searchExpl, moContinuator & _continuator, eoEvalFunc& _fullEval) : searchExplorer(_searchExpl), continuator(_continuator), fullEval(_fullEval) { } ; /** * Run the local search on a solution @@ -98,10 +99,10 @@ public: private: // make the exploration of the neighborhood according to a local search heuristic - moNeighborhoodExplorer& searchExplorer ; + moNeighborhoodExplorer& searchExplorer ; // external continuator - moContinuator& continuator ; + moContinuator& continuator ; //full evaluation function eoEvalFunc& fullEval; diff --git a/trunk/paradiseo-mo/src/continuator/moCheckpoint.h b/trunk/paradiseo-mo/src/continuator/moCheckpoint.h index 7d344c710..f081d636e 100644 --- a/trunk/paradiseo-mo/src/continuator/moCheckpoint.h +++ b/trunk/paradiseo-mo/src/continuator/moCheckpoint.h @@ -39,23 +39,23 @@ #include #include #include +#include /** * Continuator allowing to add others (continuators, stats, monitors or updaters) */ -template -class moCheckpoint : public moContinuator { +template +class moCheckpoint : public moContinuator { public : - typedef NH Neighborhood ; - typedef typename Neighborhood::EOT EOT ; + typedef typename Neighbor::EOT EOT ; /** * Default constructor (moCheckpoint must have at least one continuator) * @param _cont a continuator * @param _interval frequency to compute statistical operators */ - moCheckpoint(moContinuator& _cont, unsigned int _interval=1):interval(_interval), counter(0) { + moCheckpoint(moContinuator& _cont, unsigned int _interval=1):interval(_interval), counter(0) { continuators.push_back(&_cont); } @@ -63,7 +63,7 @@ public : * add a continuator to the checkpoint * @param _cont a continuator */ - void add(moContinuator& _cont) { + void add(moContinuator& _cont) { continuators.push_back(&_cont); } @@ -153,7 +153,7 @@ public : private : /** continuators vector */ - std::vector*> continuators; + std::vector*> continuators; /** statistic operators vector */ std::vector*> stats; /** monitors vector */ diff --git a/trunk/paradiseo-mo/src/continuator/moContinuator.h b/trunk/paradiseo-mo/src/continuator/moContinuator.h index fca36d424..cec268038 100644 --- a/trunk/paradiseo-mo/src/continuator/moContinuator.h +++ b/trunk/paradiseo-mo/src/continuator/moContinuator.h @@ -36,16 +36,17 @@ #define _moContinuator_h #include +#include /** * To make specific continuator from a solution */ -template< class NH > -class moContinuator : public eoUF +template< class Neighbor > +class moContinuator : public eoUF { public: - typedef NH Neighborhood ; - typedef typename Neighborhood::EOT EOT ; + + typedef typename Neighbor::EOT EOT ; /** * Init Continuator parameters diff --git a/trunk/paradiseo-mo/src/continuator/moIterContinuator.h b/trunk/paradiseo-mo/src/continuator/moIterContinuator.h index 20de09211..212534dba 100644 --- a/trunk/paradiseo-mo/src/continuator/moIterContinuator.h +++ b/trunk/paradiseo-mo/src/continuator/moIterContinuator.h @@ -31,15 +31,15 @@ Contact: paradiseo-help@lists.gforge.inria.fr #define _moIterContinuator_h #include - +#include /** * Continue until a maximum fixed number of iterations is reached */ -template< class NH > -class moIterContinuator : public moContinuator +template< class Neighbor > +class moIterContinuator : public moContinuator { public: - typedef typename NH::EOT EOT ; + typedef typename Neighbor::EOT EOT ; /** * @param _maxIter number maximum of iterations diff --git a/trunk/paradiseo-mo/src/continuator/moMaxNeighborStat.h b/trunk/paradiseo-mo/src/continuator/moMaxNeighborStat.h index 7decd5c02..586507202 100644 --- a/trunk/paradiseo-mo/src/continuator/moMaxNeighborStat.h +++ b/trunk/paradiseo-mo/src/continuator/moMaxNeighborStat.h @@ -37,15 +37,15 @@ #include #include - +#include /** * From moNeighborhoodStat, to compute the max fitness in the neighborhood */ -template< class Neighborhood > -class moMaxNeighborStat : public moStat +template< class Neighbor > +class moMaxNeighborStat : public moStat { public : - typedef typename Neighborhood::EOT EOT ; + typedef typename Neighbor::EOT EOT ; typedef typename EOT::Fitness Fitness ; using moStat< EOT, Fitness >::value; @@ -54,7 +54,7 @@ public : * Default Constructor * @param _nhStat a neighborhoodStat */ - moMaxNeighborStat(moNeighborhoodStat & _nhStat): + moMaxNeighborStat(moNeighborhoodStat & _nhStat): moStat(Fitness(), "min"), nhStat(_nhStat) {} /** @@ -74,7 +74,7 @@ public : private: /** moNeighborhoodStat */ - moNeighborhoodStat & nhStat; + moNeighborhoodStat & nhStat; }; #endif diff --git a/trunk/paradiseo-mo/src/continuator/moMinNeighborStat.h b/trunk/paradiseo-mo/src/continuator/moMinNeighborStat.h index 0967e335b..b5594bda2 100644 --- a/trunk/paradiseo-mo/src/continuator/moMinNeighborStat.h +++ b/trunk/paradiseo-mo/src/continuator/moMinNeighborStat.h @@ -37,15 +37,15 @@ #include #include - +#include /** * From moNeighborhoodStat, to compute the min fitness in the neighborhood */ -template< class Neighborhood > -class moMinNeighborStat : public moStat +template< class Neighbor > +class moMinNeighborStat : public moStat { public : - typedef typename Neighborhood::EOT EOT ; + typedef typename Neighbor::EOT EOT ; typedef typename EOT::Fitness Fitness ; using moStat< EOT, Fitness >::value; @@ -54,7 +54,7 @@ public : * Default Constructor * @param _nhStat a neighborhoodStat */ - moMinNeighborStat(moNeighborhoodStat & _nhStat): + moMinNeighborStat(moNeighborhoodStat & _nhStat): moStat(Fitness(), "min"), nhStat(_nhStat) {} /** @@ -74,7 +74,7 @@ public : private: /** moNeighborhoodStat */ - moNeighborhoodStat & nhStat; + moNeighborhoodStat & nhStat; }; #endif diff --git a/trunk/paradiseo-mo/src/continuator/moNbInfNeighborStat.h b/trunk/paradiseo-mo/src/continuator/moNbInfNeighborStat.h index 0c62497cf..0dae01139 100644 --- a/trunk/paradiseo-mo/src/continuator/moNbInfNeighborStat.h +++ b/trunk/paradiseo-mo/src/continuator/moNbInfNeighborStat.h @@ -37,18 +37,18 @@ #include #include - +#include /** * * From moNeighborhoodStat, to compute the number of solutions in the neighborhood * with (strictly) lower fitness than the current solution * */ -template< class Neighborhood > -class moNbInfNeighborStat : public moStat +template< class Neighbor > +class moNbInfNeighborStat : public moStat { public : - typedef typename Neighborhood::EOT EOT ; + typedef typename Neighbor::EOT EOT ; typedef typename EOT::Fitness Fitness ; using moStat< EOT, unsigned >::value; @@ -57,7 +57,7 @@ public : * Default Constructor * @param _nhStat a neighborhoodStat */ - moNbInfNeighborStat(moNeighborhoodStat & _nhStat): + moNbInfNeighborStat(moNeighborhoodStat & _nhStat): moStat(0, "nb inf"), nhStat(_nhStat) {} /** @@ -77,7 +77,7 @@ public : private: /** moNeighborhoodStat */ - moNeighborhoodStat & nhStat; + moNeighborhoodStat & nhStat; }; #endif diff --git a/trunk/paradiseo-mo/src/continuator/moNbSupNeighborStat.h b/trunk/paradiseo-mo/src/continuator/moNbSupNeighborStat.h index ccba1a59a..5a856c66d 100644 --- a/trunk/paradiseo-mo/src/continuator/moNbSupNeighborStat.h +++ b/trunk/paradiseo-mo/src/continuator/moNbSupNeighborStat.h @@ -37,18 +37,18 @@ #include #include - +#include /** * * From moNeighborhoodStat, to compute the number of solutions in the neighborhood * with higher fitness than the current solution * */ -template< class Neighborhood > -class moNbSupNeighborStat : public moStat +template< class Neighbor > +class moNbSupNeighborStat : public moStat { public : - typedef typename Neighborhood::EOT EOT ; + typedef typename Neighbor::EOT EOT ; typedef typename EOT::Fitness Fitness ; using moStat< EOT, unsigned >::value; @@ -57,7 +57,7 @@ public : * Default Constructor * @param _nhStat a neighborhoodStat */ - moNbSupNeighborStat(moNeighborhoodStat & _nhStat): + moNbSupNeighborStat(moNeighborhoodStat & _nhStat): moStat(0, "nb sup"), nhStat(_nhStat) {} /** @@ -77,7 +77,7 @@ public : private: /** moNeighborhoodStat */ - moNeighborhoodStat & nhStat; + moNeighborhoodStat & nhStat; }; #endif diff --git a/trunk/paradiseo-mo/src/continuator/moNeighborhoodStat.h b/trunk/paradiseo-mo/src/continuator/moNeighborhoodStat.h index fd59abc02..1d6b3a0a2 100644 --- a/trunk/paradiseo-mo/src/continuator/moNeighborhoodStat.h +++ b/trunk/paradiseo-mo/src/continuator/moNeighborhoodStat.h @@ -40,17 +40,18 @@ #include #include #include +#include /** * All possible statitic on the neighborhood fitness * to combine with other specific statistic to print them */ -template< class Neighborhood > -class moNeighborhoodStat : public moStat +template< class Neighbor > +class moNeighborhoodStat : public moStat { public : - typedef typename Neighborhood::EOT EOT ; - typedef typename Neighborhood::Neighbor Neighbor ; + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; typedef typename EOT::Fitness Fitness ; using moStat< EOT, bool >::value; diff --git a/trunk/paradiseo-mo/src/continuator/moNeutralDegreeNeighborStat.h b/trunk/paradiseo-mo/src/continuator/moNeutralDegreeNeighborStat.h index cdf64b11c..55f260d22 100644 --- a/trunk/paradiseo-mo/src/continuator/moNeutralDegreeNeighborStat.h +++ b/trunk/paradiseo-mo/src/continuator/moNeutralDegreeNeighborStat.h @@ -43,11 +43,11 @@ * which is the number of solutions in the neighborhood * with equals fitness */ -template< class Neighborhood > -class moNeutralDegreeNeighborStat : public moStat +template< class Neighbor > +class moNeutralDegreeNeighborStat : public moStat { public : - typedef typename Neighborhood::EOT EOT ; + typedef typename Neighbor::EOT EOT ; typedef typename EOT::Fitness Fitness ; using moStat< EOT, unsigned >::value; @@ -56,7 +56,7 @@ public : * Default Constructor * @param _nhStat a neighborhoodStat */ - moNeutralDegreeNeighborStat(moNeighborhoodStat & _nhStat): + moNeutralDegreeNeighborStat(moNeighborhoodStat & _nhStat): moStat(0, "neutral degree"), nhStat(_nhStat) {} /** @@ -76,7 +76,7 @@ public : private: /** moNeighborhoodStat */ - moNeighborhoodStat & nhStat; + moNeighborhoodStat & nhStat; }; #endif diff --git a/trunk/paradiseo-mo/src/continuator/moSecondMomentNeighborStat.h b/trunk/paradiseo-mo/src/continuator/moSecondMomentNeighborStat.h index 125548f40..dba14eeed 100644 --- a/trunk/paradiseo-mo/src/continuator/moSecondMomentNeighborStat.h +++ b/trunk/paradiseo-mo/src/continuator/moSecondMomentNeighborStat.h @@ -41,11 +41,11 @@ /** * From moNeighborhoodStat, to compute the average and the standard deviation of fitness in the neighborhood */ -template< class Neighborhood > -class moSecondMomentNeighborStat : public moStat > +template< class Neighbor > +class moSecondMomentNeighborStat : public moStat > { public : - typedef typename Neighborhood::EOT EOT ; + typedef typename Neighbor::EOT EOT ; typedef typename EOT::Fitness Fitness ; using moStat< EOT, std::pair >::value; @@ -54,7 +54,7 @@ public : * Default Constructor * @param _nhStat a neighborhoodStat */ - moSecondMomentNeighborStat(moNeighborhoodStat & _nhStat): + moSecondMomentNeighborStat(moNeighborhoodStat & _nhStat): moStat >(std::make_pair(0.0,0.0), "average and stdev"), nhStat(_nhStat) {} /** @@ -75,7 +75,7 @@ public : private: /** moNeighborhoodStat */ - moNeighborhoodStat & nhStat; + moNeighborhoodStat & nhStat; }; #endif diff --git a/trunk/paradiseo-mo/src/continuator/moSizeNeighborStat.h b/trunk/paradiseo-mo/src/continuator/moSizeNeighborStat.h index 37b0f95b4..d246da1c9 100644 --- a/trunk/paradiseo-mo/src/continuator/moSizeNeighborStat.h +++ b/trunk/paradiseo-mo/src/continuator/moSizeNeighborStat.h @@ -42,11 +42,11 @@ * From moNeighborhoodStat, to compute the number of solutions in the neighborhood * */ -template< class Neighborhood > -class moSizeNeighborStat : public moStat +template< class Neighbor > +class moSizeNeighborStat : public moStat { public : - typedef typename Neighborhood::EOT EOT ; + typedef typename Neighbor::EOT EOT ; typedef typename EOT::Fitness Fitness ; using moStat< EOT, unsigned >::value; @@ -55,7 +55,7 @@ public : * Default Constructor * @param _nhStat a neighborhoodStat */ - moSizeNeighborStat(moNeighborhoodStat & _nhStat): + moSizeNeighborStat(moNeighborhoodStat & _nhStat): moStat(0, "size"), nhStat(_nhStat) {} /** @@ -75,7 +75,7 @@ public : private: /** moNeighborhoodStat */ - moNeighborhoodStat & nhStat; + moNeighborhoodStat & nhStat; }; #endif diff --git a/trunk/paradiseo-mo/src/continuator/moTrueContinuator.h b/trunk/paradiseo-mo/src/continuator/moTrueContinuator.h index 5b1c942ea..a4243ba44 100644 --- a/trunk/paradiseo-mo/src/continuator/moTrueContinuator.h +++ b/trunk/paradiseo-mo/src/continuator/moTrueContinuator.h @@ -40,11 +40,11 @@ /** * Continuator always return True */ -template< class NH > -class moTrueContinuator : public moContinuator +template< class Neighbor > +class moTrueContinuator : public moContinuator { public: - typedef typename NH::EOT EOT ; + typedef typename Neighbor::EOT EOT ; // empty constructor moTrueContinuator() {} ; diff --git a/trunk/paradiseo-mo/src/explorer/moFirstImprExplorer.h b/trunk/paradiseo-mo/src/explorer/moFirstImprExplorer.h index 98f82b80d..804cc7fd4 100644 --- a/trunk/paradiseo-mo/src/explorer/moFirstImprExplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moFirstImprExplorer.h @@ -38,19 +38,20 @@ #include #include #include +#include /** * Explorer for a first imporvement heuristic */ -template< class Neighborhood > -class moFirstImprExplorer : public moNeighborhoodExplorer +template< class Neighbor> +class moFirstImprExplorer : public moNeighborhoodExplorer { public: - typedef typename Neighborhood::EOT EOT ; - typedef typename Neighborhood::Neighbor Neighbor ; + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; - using moNeighborhoodExplorer::neighborhood; - using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; /** * Constructor @@ -59,7 +60,7 @@ public: * @param _neighborComparator a neighbor comparator * @param _solNeighborComparator a solution vs neighbor comparator */ - moFirstImprExplorer(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator) : moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) { + moFirstImprExplorer(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator) : moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) { isAccept = false; current=new Neighbor(); } diff --git a/trunk/paradiseo-mo/src/explorer/moHCneutralExplorer.h b/trunk/paradiseo-mo/src/explorer/moHCneutralExplorer.h index 99b3c4a80..f1e65fde9 100644 --- a/trunk/paradiseo-mo/src/explorer/moHCneutralExplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moHCneutralExplorer.h @@ -38,23 +38,24 @@ #include #include #include +#include /** * Explorer for a neutral Hill-climbing */ -template< class Neighborhood > -class moHCneutralExplorer : public moSimpleHCneutralExplorer +template< class Neighbor > +class moHCneutralExplorer : public moSimpleHCneutralExplorer { public: - typedef typename Neighborhood::EOT EOT ; - typedef typename Neighborhood::Neighbor Neighbor ; + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; - using moNeighborhoodExplorer::neighborhood; - using moSimpleHCneutralExplorer::solNeighborComparator; - using moSimpleHCneutralExplorer::isAccept; - using moSimpleHCneutralExplorer::bestVector; - using moSimpleHCneutralExplorer::initParam; - using moSimpleHCneutralExplorer::updateParam; + using moNeighborhoodExplorer::neighborhood; + using moSimpleHCneutralExplorer::solNeighborComparator; + using moSimpleHCneutralExplorer::isAccept; + using moSimpleHCneutralExplorer::bestVector; + using moSimpleHCneutralExplorer::initParam; + using moSimpleHCneutralExplorer::updateParam; /** * Constructor @@ -69,7 +70,7 @@ public: moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator, unsigned _nbStep) : - moSimpleHCneutralExplorer(_neighborhood, _eval, _neighborComparator, _solNeighborComparator), + moSimpleHCneutralExplorer(_neighborhood, _eval, _neighborComparator, _solNeighborComparator), nbStep(_nbStep) { //Some cycle is possible with equals fitness solutions if the neighborhood is not random if (!neighborhood.isRandom()) { @@ -87,7 +88,7 @@ public: * initial number of step */ virtual void initParam(EOT & solution) { - moSimpleHCneutralExplorer::initParam(solution); + moSimpleHCneutralExplorer::initParam(solution); step = 0; }; @@ -96,7 +97,7 @@ public: * one more step */ virtual void updateParam(EOT & solution) { - moSimpleHCneutralExplorer::updateParam(solution); + moSimpleHCneutralExplorer::updateParam(solution); step++; }; diff --git a/trunk/paradiseo-mo/src/explorer/moILSexplorer.h b/trunk/paradiseo-mo/src/explorer/moILSexplorer.h index 7debe322e..2c4959153 100644 --- a/trunk/paradiseo-mo/src/explorer/moILSexplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moILSexplorer.h @@ -47,13 +47,12 @@ /** * Explorer for an Iterated Local Search */ -template< class NHE > -class moILSexplorer : public moNeighborhoodExplorer > > +template< class Neighbor > +class moILSexplorer : public moNeighborhoodExplorer< moDummyNeighbor > { public: - typedef typename NHE::Neighborhood Neighborhood ; - typedef typename Neighborhood::EOT EOT ; - typedef typename Neighborhood::Neighbor Neighbor ; + typedef moNeighborhood Neighborhood ; + typedef typename Neighbor::EOT EOT ; typedef moDummyNeighbor dummyNeighbor; typedef moDummyNeighborhood dummyNeighborhood; @@ -63,7 +62,7 @@ public: * @param _perturb a perturbation operator * @param _acceptCrit a acceptance criteria */ - moILSexplorer(moLocalSearch& _ls, moPerturbation& _perturb, moAcceptanceCriterion& _acceptCrit) : moNeighborhoodExplorer(), ls(_ls), perturb(_perturb), acceptCrit(_acceptCrit){ + moILSexplorer(moLocalSearch& _ls, moPerturbation& _perturb, moAcceptanceCriterion& _acceptCrit) : moNeighborhoodExplorer(), ls(_ls), perturb(_perturb), acceptCrit(_acceptCrit){ firstIteration=true; } @@ -161,7 +160,7 @@ private: //Usefull to use the momory of tabuSearch Neighbor emptyNeighbor; EOT current; - moLocalSearch& ls; + moLocalSearch& ls; moPerturbation & perturb; moAcceptanceCriterion& acceptCrit; diff --git a/trunk/paradiseo-mo/src/explorer/moMetropolisHastingExplorer.h b/trunk/paradiseo-mo/src/explorer/moMetropolisHastingExplorer.h index 8c2b46e8d..328bc1a01 100644 --- a/trunk/paradiseo-mo/src/explorer/moMetropolisHastingExplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moMetropolisHastingExplorer.h @@ -40,6 +40,7 @@ #include #include #include +#include #include @@ -48,15 +49,15 @@ * Only the symetric case is considered when Q(x,y) = Q(y,x) * Fitness must be > 0 */ -template< class Neighborhood > -class moMetropolisHastingExplorer : public moNeighborhoodExplorer +template< class Neighbor > +class moMetropolisHastingExplorer : public moNeighborhoodExplorer { public: - typedef typename Neighborhood::EOT EOT ; - typedef typename Neighborhood::Neighbor Neighbor ; + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; - using moNeighborhoodExplorer::neighborhood; - using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; /** * Constructor @@ -66,7 +67,7 @@ public: * @param _solNeighborComparator a solution vs neighbor comparator * @param _nbStep maximum number of step to do */ - moMetropolisHastingExplorer(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator, unsigned int _nbStep) : moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator), nbStep(_nbStep) { + moMetropolisHastingExplorer(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator, unsigned int _nbStep) : moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator), nbStep(_nbStep) { isAccept = false; current=new Neighbor(); if (!neighborhood.isRandom()) { diff --git a/trunk/paradiseo-mo/src/explorer/moNeighborhoodExplorer.h b/trunk/paradiseo-mo/src/explorer/moNeighborhoodExplorer.h index 27f7cc922..0e67d3f4a 100644 --- a/trunk/paradiseo-mo/src/explorer/moNeighborhoodExplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moNeighborhoodExplorer.h @@ -47,14 +47,13 @@ /** * Explore the neighborhood */ -template< class NH > -class moNeighborhoodExplorer : public eoUF +template< class Neighbor > +class moNeighborhoodExplorer : public eoUF { public: - typedef NH Neighborhood ; - typedef typename Neighborhood::EOT EOT ; + typedef moNeighborhood Neighborhood; + typedef typename Neighbor::EOT EOT; typedef typename EOT::Fitness Fitness ; - typedef typename Neighborhood::Neighbor Neighbor ; moNeighborhoodExplorer():neighborhood(dummyNeighborhood), eval(dummyEval), isMoved(false) {} diff --git a/trunk/paradiseo-mo/src/explorer/moRandomNeutralWalkExplorer.h b/trunk/paradiseo-mo/src/explorer/moRandomNeutralWalkExplorer.h index f3a519bd1..9d2579187 100644 --- a/trunk/paradiseo-mo/src/explorer/moRandomNeutralWalkExplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moRandomNeutralWalkExplorer.h @@ -37,6 +37,7 @@ #include #include +#include /** * Explorer for a random neutral walk @@ -44,15 +45,15 @@ * To sample the neutral networks by random walk, there is no memory * neighborhood must be explored in random order */ -template< class Neighborhood > -class moRandomNeutralWalkExplorer : public moNeighborhoodExplorer +template< class Neighbor > +class moRandomNeutralWalkExplorer : public moNeighborhoodExplorer { public: - typedef typename Neighborhood::EOT EOT ; - typedef typename Neighborhood::Neighbor Neighbor ; + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood Neighborhood; - using moNeighborhoodExplorer::neighborhood; - using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; /** * Constructor @@ -64,7 +65,7 @@ public: moRandomNeutralWalkExplorer(Neighborhood& _neighborhood, moEval& _eval, moSolNeighborComparator& _solNeighborComparator, unsigned _nbStep): - moNeighborhoodExplorer(_neighborhood, _eval), + moNeighborhoodExplorer(_neighborhood, _eval), solNeighborComparator(_solNeighborComparator), nbStep(_nbStep) { isAccept = false; diff --git a/trunk/paradiseo-mo/src/explorer/moRandomWalkExplorer.h b/trunk/paradiseo-mo/src/explorer/moRandomWalkExplorer.h index d8c16fc84..41a6e724c 100644 --- a/trunk/paradiseo-mo/src/explorer/moRandomWalkExplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moRandomWalkExplorer.h @@ -38,19 +38,20 @@ #include #include #include +#include /** * Explorer for a random walk explorer */ -template< class Neighborhood > -class moRandomWalkExplorer : public moNeighborhoodExplorer +template< class Neighbor > +class moRandomWalkExplorer : public moNeighborhoodExplorer { public: - typedef typename Neighborhood::EOT EOT ; - typedef typename Neighborhood::Neighbor Neighbor ; + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; - using moNeighborhoodExplorer::neighborhood; - using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; /** * Constructor @@ -58,7 +59,7 @@ public: * @param _eval the evaluation function * @param _nbStep maximum number of step to do */ - moRandomWalkExplorer(Neighborhood& _neighborhood, moEval& _eval, unsigned _nbStep) : moNeighborhoodExplorer(_neighborhood, _eval), nbStep(_nbStep) { + moRandomWalkExplorer(Neighborhood& _neighborhood, moEval& _eval, unsigned _nbStep) : moNeighborhoodExplorer(_neighborhood, _eval), nbStep(_nbStep) { isAccept = false; current=new Neighbor(); // number of step done diff --git a/trunk/paradiseo-mo/src/explorer/moSAexplorer.h b/trunk/paradiseo-mo/src/explorer/moSAexplorer.h index 417935829..05bc893c8 100644 --- a/trunk/paradiseo-mo/src/explorer/moSAexplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moSAexplorer.h @@ -40,6 +40,7 @@ #include #include #include +#include #include @@ -49,15 +50,15 @@ * Fitness must be > 0 * */ -template< class Neighborhood > -class moSAexplorer : public moNeighborhoodExplorer +template< class Neighbor > +class moSAexplorer : public moNeighborhoodExplorer { public: - typedef typename Neighborhood::EOT EOT ; - typedef typename Neighborhood::Neighbor Neighbor ; + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; - using moNeighborhoodExplorer::neighborhood; - using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; /** * Constructor @@ -67,7 +68,7 @@ public: * @param _solNeighborComparator a solution vs neighbor comparator * @param _nbStep maximum number of step to do */ - moSAexplorer(Neighborhood& _neighborhood, moEval& _eval, moSolNeighborComparator& _solNeighborComparator, moCoolingSchedule& _coolingSchedule) : moNeighborhoodExplorer(_neighborhood, _eval), solNeighborComparator(_solNeighborComparator), coolingSchedule(_coolingSchedule) { + moSAexplorer(Neighborhood& _neighborhood, moEval& _eval, moSolNeighborComparator& _solNeighborComparator, moCoolingSchedule& _coolingSchedule) : moNeighborhoodExplorer(_neighborhood, _eval), solNeighborComparator(_solNeighborComparator), coolingSchedule(_coolingSchedule) { isAccept = false; if (!neighborhood.isRandom()) { diff --git a/trunk/paradiseo-mo/src/explorer/moSimpleHCexplorer.h b/trunk/paradiseo-mo/src/explorer/moSimpleHCexplorer.h index 386b7041d..c85c4afec 100644 --- a/trunk/paradiseo-mo/src/explorer/moSimpleHCexplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moSimpleHCexplorer.h @@ -38,19 +38,20 @@ #include #include #include +#include /** * Explorer for a simple Hill-climbing */ -template< class Neighborhood > -class moSimpleHCexplorer : public moNeighborhoodExplorer +template< class Neighbor > +class moSimpleHCexplorer : public moNeighborhoodExplorer { public: - typedef typename Neighborhood::EOT EOT ; - typedef typename Neighborhood::Neighbor Neighbor ; + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; - using moNeighborhoodExplorer::neighborhood; - using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; /** * Constructor @@ -59,7 +60,7 @@ public: * @param _neighborComparator a neighbor comparator * @param _solNeighborComparator solution vs neighbor comparator */ - moSimpleHCexplorer(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator) : moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) { + moSimpleHCexplorer(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator) : moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) { isAccept = false; current=new Neighbor(); best=new Neighbor(); diff --git a/trunk/paradiseo-mo/src/explorer/moSimpleHCneutralExplorer.h b/trunk/paradiseo-mo/src/explorer/moSimpleHCneutralExplorer.h index ca3729e16..cf9e7b1ca 100644 --- a/trunk/paradiseo-mo/src/explorer/moSimpleHCneutralExplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moSimpleHCneutralExplorer.h @@ -38,21 +38,22 @@ #include #include #include +#include #include #include /** * Explorer for a simple neutral Hill-climbing */ -template< class Neighborhood > -class moSimpleHCneutralExplorer : public moNeighborhoodExplorer +template< class Neighbor > +class moSimpleHCneutralExplorer : public moNeighborhoodExplorer { public: - typedef typename Neighborhood::EOT EOT ; - typedef typename Neighborhood::Neighbor Neighbor ; + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; - using moNeighborhoodExplorer::neighborhood; - using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; /** * Constructor @@ -65,7 +66,7 @@ public: moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator) : - moNeighborhoodExplorer(_neighborhood, _eval), + moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) { isAccept = false; diff --git a/trunk/paradiseo-mo/src/explorer/moTSExplorer.h b/trunk/paradiseo-mo/src/explorer/moTSExplorer.h index cd35625ac..5251b35fe 100644 --- a/trunk/paradiseo-mo/src/explorer/moTSExplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moTSExplorer.h @@ -42,17 +42,17 @@ #include #include #include - +#include /** * Explorer for a Tabu Search */ -template< class Neighborhood > -class moTSExplorer : public moNeighborhoodExplorer +template< class Neighbor > +class moTSExplorer : public moNeighborhoodExplorer { public: - typedef typename Neighborhood::EOT EOT ; - typedef typename Neighborhood::Neighbor Neighbor ; + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; /** * Constructor @@ -74,7 +74,7 @@ public: moDiversification & _diversification, moAspiration & _aspiration ) : - moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator), + moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator), tabuList(_tabuList), intensification(_intensification), diversification(_diversification), aspiration(_aspiration) { isAccept = false; @@ -226,8 +226,8 @@ public: protected: - using moNeighborhoodExplorer::neighborhood; - using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; // comparator between solution and neighbor or between neighbors moNeighborComparator& neighborComparator; diff --git a/trunk/paradiseo-mo/test/moTestClass.h b/trunk/paradiseo-mo/test/moTestClass.h index b0d71ee3a..2eea45a33 100644 --- a/trunk/paradiseo-mo/test/moTestClass.h +++ b/trunk/paradiseo-mo/test/moTestClass.h @@ -52,7 +52,7 @@ #include typedef eoBit bitVector; -typedef moBitNeighbor bitNeighbor ; +typedef moBitNeighbor bitNeighbor; class moDummyRndNeighborhood: public moOrderNeighborhood/*, public moRndNeighborhood*/ { public: diff --git a/trunk/paradiseo-mo/test/t-moCheckpoint.cpp b/trunk/paradiseo-mo/test/t-moCheckpoint.cpp index 4bfe440cc..2792dd5e5 100644 --- a/trunk/paradiseo-mo/test/t-moCheckpoint.cpp +++ b/trunk/paradiseo-mo/test/t-moCheckpoint.cpp @@ -59,10 +59,10 @@ int main() { updater1 up2(b); monitor1 mon1(c); monitor2 mon2(d); - moTrueContinuator< bitNeighborhood > cont; + moTrueContinuator< bitNeighbor > cont; - moCheckpoint< bitNeighborhood> test1(cont); - moCheckpoint< bitNeighborhood> test2(cont, 3); + moCheckpoint< bitNeighbor > test1(cont); + moCheckpoint< bitNeighbor > test2(cont, 3); test1.add(up1); test1.add(up2); diff --git a/trunk/paradiseo-mo/test/t-moFirstImprExplorer.cpp b/trunk/paradiseo-mo/test/t-moFirstImprExplorer.cpp index 1d4601d2f..c5fc9cd3c 100644 --- a/trunk/paradiseo-mo/test/t-moFirstImprExplorer.cpp +++ b/trunk/paradiseo-mo/test/t-moFirstImprExplorer.cpp @@ -48,7 +48,7 @@ int main() { moNeighborComparator ncomp; moSolNeighborComparator sncomp; - moFirstImprExplorer test(nh, eval, ncomp, sncomp); + moFirstImprExplorer test(nh, eval, ncomp, sncomp); //on verifie qu'on améliore peut continuer à explorer tant qu'on améliore la solution diff --git a/trunk/paradiseo-mo/test/t-moHCneutralExplorer.cpp b/trunk/paradiseo-mo/test/t-moHCneutralExplorer.cpp index e95e79c81..4022a4cbf 100644 --- a/trunk/paradiseo-mo/test/t-moHCneutralExplorer.cpp +++ b/trunk/paradiseo-mo/test/t-moHCneutralExplorer.cpp @@ -48,7 +48,7 @@ int main() { moNeighborComparator ncomp; moSolNeighborComparator sncomp; - moHCneutralExplorer test(nh, eval, ncomp, sncomp,3); + moHCneutralExplorer test(nh, eval, ncomp, sncomp,3); //on verifie qu'on ameliore bien la solution et que l'exploration dure 3 itérations diff --git a/trunk/paradiseo-mo/test/t-moMetropolisHastingExplorer.cpp b/trunk/paradiseo-mo/test/t-moMetropolisHastingExplorer.cpp index 730db2b6b..6214465a1 100644 --- a/trunk/paradiseo-mo/test/t-moMetropolisHastingExplorer.cpp +++ b/trunk/paradiseo-mo/test/t-moMetropolisHastingExplorer.cpp @@ -46,7 +46,7 @@ int main() { moNeighborComparator ncomp; moSolNeighborComparator sncomp; - moMetropolisHastingExplorer test(nh, eval, ncomp, sncomp, 3); + moMetropolisHastingExplorer test(nh, eval, ncomp, sncomp, 3); //test de l'acceptation d'un voisin améliorant test.initParam(sol); diff --git a/trunk/paradiseo-mo/test/t-moNeighborhoodStat.cpp b/trunk/paradiseo-mo/test/t-moNeighborhoodStat.cpp index b18262a14..8c14abd91 100644 --- a/trunk/paradiseo-mo/test/t-moNeighborhoodStat.cpp +++ b/trunk/paradiseo-mo/test/t-moNeighborhoodStat.cpp @@ -73,7 +73,7 @@ int main() { sol.fitness(7); - moNeighborhoodStat test(n, eval, neighborComp, solNeighborComp); + moNeighborhoodStat test(n, eval, neighborComp, solNeighborComp); test(sol); @@ -92,7 +92,7 @@ int main() { //test of moMaxNeighborStat.h std::cout << "[t-moMaxNeighborStat] => START" << std::endl; - moMaxNeighborStat test2(test); + moMaxNeighborStat test2(test); test2(sol); assert(test2.value()==6); assert(test2.className()=="moMaxNeighborStat"); @@ -100,7 +100,7 @@ int main() { //test of moMinNeighborStat.h std::cout << "[t-moMinNeighborStat] => START" << std::endl; - moMinNeighborStat test3(test); + moMinNeighborStat test3(test); test3(sol); assert(test3.value()==8); assert(test3.className()=="moMinNeighborStat"); @@ -108,7 +108,7 @@ int main() { //test of moNbInfNeighborStat.h std::cout << "[t-moNbInfNeighborStat] => START" << std::endl; - moNbInfNeighborStat test4(test); + moNbInfNeighborStat test4(test); test4(sol); assert(test4.value()==3); assert(test4.className()=="moNbInfNeighborStat"); @@ -116,7 +116,7 @@ int main() { //test of moNbSupNeighborStat.h std::cout << "[t-moNbSupNeighborStat] => START" << std::endl; - moNbSupNeighborStat test5(test); + moNbSupNeighborStat test5(test); test5(sol); assert(test5.value()==7); assert(test5.className()=="moNbSupNeighborStat"); @@ -124,7 +124,7 @@ int main() { //test of moNeutralDegreeNeighborStat.h std::cout << "[t-moNeutralDegreeNeighborStat] => START" << std::endl; - moNeutralDegreeNeighborStat test6(test); + moNeutralDegreeNeighborStat test6(test); test6(sol); assert(test6.value()==0); assert(test6.className()=="moNeutralDegreeNeighborStat"); @@ -132,7 +132,7 @@ int main() { //test of moSecondMomentNeighborStat.h std::cout << "[t-moSecondMomentNeighborStat] => START" << std::endl; - moSecondMomentNeighborStat test7(test); + moSecondMomentNeighborStat test7(test); test7(sol); assert(test7.value().first==6.6); assert(test7.value().second > 0.966 && test7.value().second < 0.967); @@ -141,7 +141,7 @@ int main() { //test of moSizeNeighborStat.h std::cout << "[t-moSizeNeighborStat] => START" << std::endl; - moSizeNeighborStat test8(test); + moSizeNeighborStat test8(test); test8(sol); assert(test8.value()==10); assert(test8.className()=="moSizeNeighborStat"); diff --git a/trunk/paradiseo-mo/test/t-moRandomNeutralWalkExplorer.cpp b/trunk/paradiseo-mo/test/t-moRandomNeutralWalkExplorer.cpp index c8af982de..dd7d52247 100644 --- a/trunk/paradiseo-mo/test/t-moRandomNeutralWalkExplorer.cpp +++ b/trunk/paradiseo-mo/test/t-moRandomNeutralWalkExplorer.cpp @@ -47,7 +47,7 @@ int main() { //test avec la fonction d'eval classique //on verifie qu'on ne trouve pas de voisin de mm fitness - moRandomNeutralWalkExplorer test(nh, eval, sncomp, 3); + moRandomNeutralWalkExplorer test(nh, eval, sncomp, 3); test.initParam(sol); test(sol); @@ -56,7 +56,7 @@ int main() { //test avec une fonction d'eval bidon qui renvoie toujours la mm fitness //on peut donc verifier qu'on s'arette au bout des 3 itérations. - moRandomNeutralWalkExplorer test2(nh, eval2, sncomp, 3); + moRandomNeutralWalkExplorer test2(nh, eval2, sncomp, 3); sol.fitness(2); test2.initParam(sol); diff --git a/trunk/paradiseo-mo/test/t-moRandomWalkExplorer.cpp b/trunk/paradiseo-mo/test/t-moRandomWalkExplorer.cpp index 880e4ebd1..e96f3c3c6 100644 --- a/trunk/paradiseo-mo/test/t-moRandomWalkExplorer.cpp +++ b/trunk/paradiseo-mo/test/t-moRandomWalkExplorer.cpp @@ -45,7 +45,7 @@ int main() { //test avec un neighbordhood ordonné //Du coup on verifie juste qu'on a bien une evolution de la solution et qu'on fait 3 pas avant d'arreter l'exploration - moRandomWalkExplorer test(nh, eval, 3); + moRandomWalkExplorer test(nh, eval, 3); test.initParam(sol); diff --git a/trunk/paradiseo-mo/test/t-moSimpleHCexplorer.cpp b/trunk/paradiseo-mo/test/t-moSimpleHCexplorer.cpp index 1d730a8dd..0209c3df1 100644 --- a/trunk/paradiseo-mo/test/t-moSimpleHCexplorer.cpp +++ b/trunk/paradiseo-mo/test/t-moSimpleHCexplorer.cpp @@ -56,7 +56,7 @@ int main() { moSolNeighborComparator solNeighborComp; //verif constructor - moSimpleHCexplorer test(nh, fulleval, comp, solNeighborComp); + moSimpleHCexplorer test(nh, fulleval, comp, solNeighborComp); //verif operator() et accept: le neigorhood est construit pour qu'on tombe dans les 3 cas suivants: //hasNeighbor() retourne faux a l'entrée de l'operator() donc on doit pas continuer diff --git a/trunk/paradiseo-mo/test/t-moSimpleHCneutralExplorer.cpp b/trunk/paradiseo-mo/test/t-moSimpleHCneutralExplorer.cpp index 5ee7737fc..80b4f91a3 100644 --- a/trunk/paradiseo-mo/test/t-moSimpleHCneutralExplorer.cpp +++ b/trunk/paradiseo-mo/test/t-moSimpleHCneutralExplorer.cpp @@ -48,7 +48,7 @@ int main() { moNeighborComparator ncomp; moSolNeighborComparator sncomp; - moSimpleHCneutralExplorer test(nh, eval, ncomp, sncomp); + moSimpleHCneutralExplorer test(nh, eval, ncomp, sncomp); //test qu'on ameliore bien a chaque itération test.initParam(sol); diff --git a/trunk/paradiseo-mo/test/t-moTSExplorer.cpp b/trunk/paradiseo-mo/test/t-moTSExplorer.cpp index a591fc22e..df03e9634 100644 --- a/trunk/paradiseo-mo/test/t-moTSExplorer.cpp +++ b/trunk/paradiseo-mo/test/t-moTSExplorer.cpp @@ -55,8 +55,8 @@ int main() { moSolVectorTabuList tabuList(4,0); moBestImprAspiration aspir; - moTSExplorer test(nh, eval, ncomp, sncomp, tabuList, intens, diver, aspir); - moTSExplorer test2(emptyNH, eval, ncomp, sncomp, tabuList, intens, diver, aspir); + moTSExplorer test(nh, eval, ncomp, sncomp, tabuList, intens, diver, aspir); + moTSExplorer test2(emptyNH, eval, ncomp, sncomp, tabuList, intens, diver, aspir); //test d'un voisinage vide test2.initParam(sol); @@ -130,7 +130,7 @@ int main() { bitNeighborhood nh2(2); evalOneMax eval2(2); - moTSExplorer test3(nh2, eval2, ncomp, sncomp, tabuList, intens, diver, aspir); + moTSExplorer test3(nh2, eval2, ncomp, sncomp, tabuList, intens, diver, aspir); test3.initParam(sol2); test3(sol2); diff --git a/trunk/paradiseo-mo/test/t-moTrueContinuator.cpp b/trunk/paradiseo-mo/test/t-moTrueContinuator.cpp index 3c8d7d92a..2a0ca7d27 100644 --- a/trunk/paradiseo-mo/test/t-moTrueContinuator.cpp +++ b/trunk/paradiseo-mo/test/t-moTrueContinuator.cpp @@ -43,7 +43,7 @@ int main() { std::cout << "[t-moTrueContinuator] => START" << std::endl; - moTrueContinuator test; + moTrueContinuator test; Solution s; assert(test(s)); diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/CMakeLists.txt b/trunk/paradiseo-mo/tutorial/oneMax/application/CMakeLists.txt index d49acdace..4c6310333 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/CMakeLists.txt +++ b/trunk/paradiseo-mo/tutorial/oneMax/application/CMakeLists.txt @@ -13,7 +13,7 @@ ADD_EXECUTABLE(testMetropolisHasting testMetropolisHasting.cpp) #ADD_EXECUTABLE(testWithMove testWithMove.cpp) ADD_EXECUTABLE(testSimpleTS testSimpleTS.cpp) ADD_EXECUTABLE(testRandomNeutralWalk testRandomNeutralWalk.cpp) -#ADD_EXECUTABLE(testILS testILS.cpp) +ADD_EXECUTABLE(testILS testILS.cpp) ADD_EXECUTABLE(testSimulatedAnnealing testSimulatedAnnealing.cpp) TARGET_LINK_LIBRARIES(testSimpleHC eoutils ga eo) @@ -25,7 +25,7 @@ TARGET_LINK_LIBRARIES(testMetropolisHasting eoutils ga eo) #TARGET_LINK_LIBRARIES(testWithMove eoutils ga eo) TARGET_LINK_LIBRARIES(testSimpleTS eoutils ga eo) TARGET_LINK_LIBRARIES(testRandomNeutralWalk eoutils ga eo) -#TARGET_LINK_LIBRARIES(testILS eoutils ga eo) +TARGET_LINK_LIBRARIES(testILS eoutils ga eo) TARGET_LINK_LIBRARIES(testSimulatedAnnealing eoutils ga eo) diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testFirstImpr.cpp b/trunk/paradiseo-mo/tutorial/oneMax/application/testFirstImpr.cpp index 5ce85ceb6..d37538700 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testFirstImpr.cpp +++ b/trunk/paradiseo-mo/tutorial/oneMax/application/testFirstImpr.cpp @@ -149,7 +149,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moFirstImprExplorer explorer(neighborhood, fulleval, comparator, solComparator); + moFirstImprExplorer explorer(neighborhood, fulleval, comparator, solComparator); /* ========================================================= @@ -158,9 +158,9 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moTrueContinuator continuator;//always continue + moTrueContinuator continuator;//always continue - moLocalSearch< moFirstImprExplorer > localSearch(explorer, continuator, eval); + moLocalSearch< Neighbor > localSearch(explorer, continuator, eval); /* ========================================================= * diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testHCneutral.cpp b/trunk/paradiseo-mo/tutorial/oneMax/application/testHCneutral.cpp index 037a8c698..0b053efde 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testHCneutral.cpp +++ b/trunk/paradiseo-mo/tutorial/oneMax/application/testHCneutral.cpp @@ -153,7 +153,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moHCneutralExplorer explorer(neighborhood, fulleval, comparator, solComparator, nbStep); + moHCneutralExplorer explorer(neighborhood, fulleval, comparator, solComparator, nbStep); /* ========================================================= @@ -162,9 +162,9 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moTrueContinuator continuator;//always continue + moTrueContinuator continuator;//always continue - moLocalSearch< moHCneutralExplorer > localSearch(explorer, continuator, eval); + moLocalSearch localSearch(explorer, continuator, eval); /* ========================================================= * diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testILS.cpp b/trunk/paradiseo-mo/tutorial/oneMax/application/testILS.cpp index 523d0eaf1..0e614423b 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testILS.cpp +++ b/trunk/paradiseo-mo/tutorial/oneMax/application/testILS.cpp @@ -164,7 +164,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moSimpleHCexplorer explorer(neighborhood, fulleval, comparator, solComparator); + moSimpleHCexplorer explorer(neighborhood, fulleval, comparator, solComparator); /* ========================================================= @@ -173,28 +173,28 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moTrueContinuator continuator;//always continue + moTrueContinuator continuator;//always continue - moLocalSearch< NHE > hc(explorer, continuator, eval); + moLocalSearch< Neighbor > hc(explorer, continuator, eval); eoBitMutation monOp(1.0/vecSize); - //moMonOpPerturb perturb(monOp, eval); + moMonOpPerturb perturb(monOp, eval); //moRestartPerturb perturb(random, eval, 5); - moNeighborhoodPerturb perturb(neighborhood2, fulleval); + //moNeighborhoodPerturb perturb(neighborhood2, fulleval); moSolComparator comp; //moAlwaysAcceptCrit accept; moBetterAcceptCrit accept(comp); - moILSexplorer< NHE > explorerILS(hc, perturb, accept); + moILSexplorer< Neighbor > explorerILS(hc, perturb, accept); - moIterContinuator continuatorILS(100); + moIterContinuator continuatorILS(100); - moLocalSearch< moILSexplorer< moSimpleHCexplorer > >localSearch(explorerILS, continuatorILS, eval); + moLocalSearchlocalSearch(explorerILS, continuatorILS, eval); /* ========================================================= diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testMetropolisHasting.cpp b/trunk/paradiseo-mo/tutorial/oneMax/application/testMetropolisHasting.cpp index d647f60dc..37804e0d6 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testMetropolisHasting.cpp +++ b/trunk/paradiseo-mo/tutorial/oneMax/application/testMetropolisHasting.cpp @@ -153,7 +153,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moMetropolisHastingExplorer explorer(neighborhood, fulleval, comparator, solComparator, nbStep); + moMetropolisHastingExplorer explorer(neighborhood, fulleval, comparator, solComparator, nbStep); /* ========================================================= @@ -162,9 +162,9 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moTrueContinuator continuator;//always continue + moTrueContinuator continuator;//always continue - moLocalSearch< moMetropolisHastingExplorer > localSearch(explorer, continuator, eval); + moLocalSearch localSearch(explorer, continuator, eval); /* ========================================================= * diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testRandomNeutralWalk.cpp b/trunk/paradiseo-mo/tutorial/oneMax/application/testRandomNeutralWalk.cpp index 7243d5afa..5a015d4ac 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testRandomNeutralWalk.cpp +++ b/trunk/paradiseo-mo/tutorial/oneMax/application/testRandomNeutralWalk.cpp @@ -171,7 +171,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moRandomNeutralWalkExplorer explorer(neighborhood, nhEval, solComparator, nbStep); + moRandomNeutralWalkExplorer explorer(neighborhood, nhEval, solComparator, nbStep); /* ========================================================= @@ -193,9 +193,9 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moTrueContinuator continuator;//always continue + moTrueContinuator continuator;//always continue - moCheckpoint checkpoint(continuator); + moCheckpoint checkpoint(continuator); moFitnessStat fStat; @@ -203,15 +203,15 @@ void main_function(int argc, char **argv) moDistanceStat distStat(distance, solution); // distance from the intial solution moOrderNeighborhood nh(vecSize); - moNeighborhoodStat< moOrderNeighborhood > neighborhoodStat(nh, nhEval, comparator, solComparator); - moMinNeighborStat< moOrderNeighborhood > minStat(neighborhoodStat); - moSecondMomentNeighborStat< moOrderNeighborhood > secondMomentStat(neighborhoodStat); - moMaxNeighborStat< moOrderNeighborhood > maxStat(neighborhoodStat); + moNeighborhoodStat< Neighbor > neighborhoodStat(nh, nhEval, comparator, solComparator); + moMinNeighborStat< Neighbor > minStat(neighborhoodStat); + moSecondMomentNeighborStat< Neighbor > secondMomentStat(neighborhoodStat); + moMaxNeighborStat< Neighbor > maxStat(neighborhoodStat); - moNbSupNeighborStat< moOrderNeighborhood > nbSupStat(neighborhoodStat); - moNbInfNeighborStat< moOrderNeighborhood > nbInfStat(neighborhoodStat); - moNeutralDegreeNeighborStat< moOrderNeighborhood > ndStat(neighborhoodStat); - moSizeNeighborStat< moOrderNeighborhood > sizeStat(neighborhoodStat); + moNbSupNeighborStat< Neighbor > nbSupStat(neighborhoodStat); + moNbInfNeighborStat< Neighbor > nbInfStat(neighborhoodStat); + moNeutralDegreeNeighborStat< Neighbor > ndStat(neighborhoodStat); + moSizeNeighborStat< Neighbor > sizeStat(neighborhoodStat); eoValueParam genCounter(-1,"Gen"); eoIncrementor increm(genCounter.value()); @@ -248,7 +248,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moLocalSearch< moRandomNeutralWalkExplorer > localSearch(explorer, checkpoint, eval); + moLocalSearch localSearch(explorer, checkpoint, eval); /* ========================================================= * diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testRandomWalk.cpp b/trunk/paradiseo-mo/tutorial/oneMax/application/testRandomWalk.cpp index 3496e4a15..508e91d70 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testRandomWalk.cpp +++ b/trunk/paradiseo-mo/tutorial/oneMax/application/testRandomWalk.cpp @@ -149,7 +149,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moRandomWalkExplorer explorer(neighborhood, nhEval, nbStep); + moRandomWalkExplorer explorer(neighborhood, nhEval, nbStep); /* ========================================================= @@ -158,9 +158,9 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moTrueContinuator continuator;//always continue + moTrueContinuator continuator;//always continue - moCheckpoint checkpoint(continuator); + moCheckpoint checkpoint(continuator); moFitnessStat fStat; eoHammingDistance distance; @@ -208,7 +208,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moLocalSearch< moRandomWalkExplorer > localSearch(explorer, checkpoint, eval); + moLocalSearch localSearch(explorer, checkpoint, eval); /* ========================================================= * diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleHC.cpp b/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleHC.cpp index 7d37a93fc..5fc728d2e 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleHC.cpp +++ b/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleHC.cpp @@ -149,7 +149,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moSimpleHCexplorer explorer(neighborhood, fulleval, comparator, solComparator); + moSimpleHCexplorer explorer(neighborhood, fulleval, comparator, solComparator); /* ========================================================= @@ -158,9 +158,9 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moTrueContinuator continuator;//always continue + moTrueContinuator continuator;//always continue - moLocalSearch< moSimpleHCexplorer > localSearch(explorer, continuator, eval); + moLocalSearch< Neighbor > localSearch(explorer, continuator, eval); /* ========================================================= * diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleHCneutral.cpp b/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleHCneutral.cpp index 8db916671..226fc8290 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleHCneutral.cpp +++ b/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleHCneutral.cpp @@ -149,7 +149,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moSimpleHCneutralExplorer explorer(neighborhood, fulleval, comparator, solComparator); + moSimpleHCneutralExplorer explorer(neighborhood, fulleval, comparator, solComparator); /* ========================================================= @@ -158,9 +158,9 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moTrueContinuator continuator;//always continue + moTrueContinuator continuator;//always continue - moLocalSearch< moSimpleHCneutralExplorer > localSearch(explorer, continuator, eval); + moLocalSearch localSearch(explorer, continuator, eval); /* ========================================================= * diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleTS.cpp b/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleTS.cpp index 996578964..e393b07b2 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleTS.cpp +++ b/trunk/paradiseo-mo/tutorial/oneMax/application/testSimpleTS.cpp @@ -155,7 +155,7 @@ void main_function(int argc, char **argv) moDummyIntensification inten; moDummyDiversification div; moBestImprAspiration asp; - moTSExplorer explorer(neighborhood, eval, comparator, solComparator, tl, inten, div, asp); + moTSExplorer explorer(neighborhood, eval, comparator, solComparator, tl, inten, div, asp); /* ========================================================= @@ -164,9 +164,9 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moTrueContinuator continuator;//always continue + moTrueContinuator continuator;//always continue - moLocalSearch< moTSExplorer > localSearch(explorer, continuator, fulleval); + moLocalSearch localSearch(explorer, continuator, fulleval); /* ========================================================= * diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testSimulatedAnnealing.cpp b/trunk/paradiseo-mo/tutorial/oneMax/application/testSimulatedAnnealing.cpp index 71d14fcbb..46ef2714e 100644 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testSimulatedAnnealing.cpp +++ b/trunk/paradiseo-mo/tutorial/oneMax/application/testSimulatedAnnealing.cpp @@ -158,7 +158,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moSAexplorer explorer(neighborhood, fulleval, solComparator, coolingSchedule); + moSAexplorer explorer(neighborhood, fulleval, solComparator, coolingSchedule); /* ========================================================= * @@ -166,9 +166,9 @@ void main_function(int argc, char **argv) * * ========================================================= */ - moTrueContinuator continuator;//always continue + moTrueContinuator continuator;//always continue - moLocalSearch< moSAexplorer > localSearch(explorer, continuator, eval); + moLocalSearch localSearch(explorer, continuator, eval); /* ========================================================= *