Replace Templates NHE and Neighborhood

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1732 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jhumeau 2010-04-07 15:52:47 +00:00
commit 5f7d120a6e
48 changed files with 236 additions and 227 deletions

View file

@ -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)
##########################################################################################################################################

View file

@ -37,23 +37,24 @@
#include <explorer/moNeighborhoodExplorer.h>
#include <continuator/moContinuator.h>
#include <neighborhood/moNeighborhood.h>
#include <eoEvalFunc.h>
/**
* the main algorithm of the local search
*/
template<class NHE>
class moLocalSearch: public eoMonOp<typename NHE::EOT>
template<class Neighbor>
class moLocalSearch: public eoMonOp<typename Neighbor::EOT>
{
public:
typedef NHE NeighborhoodExplorer ;
typedef typename NeighborhoodExplorer::EOT EOT ;
typedef typename NeighborhoodExplorer::Neighborhood Neighborhood ;
typedef moNeighborhood<Neighbor> Neighborhood;
typedef moNeighborhoodExplorer<Neighbor> NeighborhoodExplorer;
typedef typename Neighbor::EOT EOT ;
/**
* Constructor of a moLocalSearch needs a NeighborhooExplorer and a Continuator
*/
moLocalSearch(moNeighborhoodExplorer<Neighborhood>& _searchExpl, moContinuator<Neighborhood> & _continuator, eoEvalFunc<EOT>& _fullEval) : searchExplorer(_searchExpl), continuator(_continuator), fullEval(_fullEval) { } ;
moLocalSearch(NeighborhoodExplorer& _searchExpl, moContinuator<Neighbor> & _continuator, eoEvalFunc<EOT>& _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<Neighborhood>& searchExplorer ;
moNeighborhoodExplorer<Neighbor>& searchExplorer ;
// external continuator
moContinuator<Neighborhood>& continuator ;
moContinuator<Neighbor>& continuator ;
//full evaluation function
eoEvalFunc<EOT>& fullEval;

View file

@ -39,23 +39,23 @@
#include <utils/eoMonitor.h>
#include <continuator/moStatBase.h>
#include <utils/eoUpdater.h>
#include <neighborhood/moNeighborhood.h>
/**
* Continuator allowing to add others (continuators, stats, monitors or updaters)
*/
template <class NH>
class moCheckpoint : public moContinuator<NH> {
template <class Neighbor>
class moCheckpoint : public moContinuator<Neighbor> {
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<Neighborhood>& _cont, unsigned int _interval=1):interval(_interval), counter(0) {
moCheckpoint(moContinuator<Neighbor>& _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<Neighborhood>& _cont) {
void add(moContinuator<Neighbor>& _cont) {
continuators.push_back(&_cont);
}
@ -153,7 +153,7 @@ public :
private :
/** continuators vector */
std::vector<moContinuator<Neighborhood>*> continuators;
std::vector<moContinuator<Neighbor>*> continuators;
/** statistic operators vector */
std::vector<moStatBase<EOT>*> stats;
/** monitors vector */

View file

@ -36,16 +36,17 @@
#define _moContinuator_h
#include <eoFunctor.h>
#include <neighborhood/moNeighborhood.h>
/**
* To make specific continuator from a solution
*/
template< class NH >
class moContinuator : public eoUF<typename NH::EOT &, bool>
template< class Neighbor >
class moContinuator : public eoUF<typename Neighbor::EOT &, bool>
{
public:
typedef NH Neighborhood ;
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighbor::EOT EOT ;
/**
* Init Continuator parameters

View file

@ -31,15 +31,15 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#define _moIterContinuator_h
#include <continuator/moContinuator.h>
#include <neighborhood/moNeighborhood.h>
/**
* Continue until a maximum fixed number of iterations is reached
*/
template< class NH >
class moIterContinuator : public moContinuator<NH>
template< class Neighbor >
class moIterContinuator : public moContinuator<Neighbor>
{
public:
typedef typename NH::EOT EOT ;
typedef typename Neighbor::EOT EOT ;
/**
* @param _maxIter number maximum of iterations

View file

@ -37,15 +37,15 @@
#include <continuator/moStat.h>
#include <continuator/moNeighborhoodStat.h>
#include <neighborhood/moNeighborhood.h>
/**
* From moNeighborhoodStat, to compute the max fitness in the neighborhood
*/
template< class Neighborhood >
class moMaxNeighborStat : public moStat<typename Neighborhood::EOT, typename Neighborhood::EOT::Fitness>
template< class Neighbor >
class moMaxNeighborStat : public moStat<typename Neighbor::EOT, typename Neighbor::EOT::Fitness>
{
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<Neighborhood> & _nhStat):
moMaxNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, Fitness>(Fitness(), "min"), nhStat(_nhStat) {}
/**
@ -74,7 +74,7 @@ public :
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighborhood> & nhStat;
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -37,15 +37,15 @@
#include <continuator/moStat.h>
#include <continuator/moNeighborhoodStat.h>
#include <neighborhood/moNeighborhood.h>
/**
* From moNeighborhoodStat, to compute the min fitness in the neighborhood
*/
template< class Neighborhood >
class moMinNeighborStat : public moStat<typename Neighborhood::EOT, typename Neighborhood::EOT::Fitness>
template< class Neighbor >
class moMinNeighborStat : public moStat<typename Neighbor::EOT, typename Neighbor::EOT::Fitness>
{
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<Neighborhood> & _nhStat):
moMinNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, Fitness>(Fitness(), "min"), nhStat(_nhStat) {}
/**
@ -74,7 +74,7 @@ public :
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighborhood> & nhStat;
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -37,18 +37,18 @@
#include <continuator/moStat.h>
#include <continuator/moNeighborhoodStat.h>
#include <neighborhood/moNeighborhood.h>
/**
*
* 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<typename Neighborhood::EOT, unsigned>
template< class Neighbor >
class moNbInfNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
{
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<Neighborhood> & _nhStat):
moNbInfNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, unsigned>(0, "nb inf"), nhStat(_nhStat) {}
/**
@ -77,7 +77,7 @@ public :
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighborhood> & nhStat;
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -37,18 +37,18 @@
#include <continuator/moStat.h>
#include <continuator/moNeighborhoodStat.h>
#include <neighborhood/moNeighborhood.h>
/**
*
* 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<typename Neighborhood::EOT, unsigned>
template< class Neighbor >
class moNbSupNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
{
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<Neighborhood> & _nhStat):
moNbSupNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, unsigned>(0, "nb sup"), nhStat(_nhStat) {}
/**
@ -77,7 +77,7 @@ public :
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighborhood> & nhStat;
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -40,17 +40,18 @@
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
/**
* All possible statitic on the neighborhood fitness
* to combine with other specific statistic to print them
*/
template< class Neighborhood >
class moNeighborhoodStat : public moStat<typename Neighborhood::EOT, bool>
template< class Neighbor >
class moNeighborhoodStat : public moStat<typename Neighbor::EOT, bool>
{
public :
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighborhood::Neighbor Neighbor ;
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
typedef typename EOT::Fitness Fitness ;
using moStat< EOT, bool >::value;

View file

@ -43,11 +43,11 @@
* which is the number of solutions in the neighborhood
* with equals fitness
*/
template< class Neighborhood >
class moNeutralDegreeNeighborStat : public moStat<typename Neighborhood::EOT, unsigned>
template< class Neighbor >
class moNeutralDegreeNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
{
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<Neighborhood> & _nhStat):
moNeutralDegreeNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, unsigned>(0, "neutral degree"), nhStat(_nhStat) {}
/**
@ -76,7 +76,7 @@ public :
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighborhood> & nhStat;
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -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<typename Neighborhood::EOT, std::pair<double, double> >
template< class Neighbor >
class moSecondMomentNeighborStat : public moStat<typename Neighbor::EOT, std::pair<double, double> >
{
public :
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighbor::EOT EOT ;
typedef typename EOT::Fitness Fitness ;
using moStat< EOT, std::pair<double, double> >::value;
@ -54,7 +54,7 @@ public :
* Default Constructor
* @param _nhStat a neighborhoodStat
*/
moSecondMomentNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
moSecondMomentNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, std::pair<double, double> >(std::make_pair(0.0,0.0), "average and stdev"), nhStat(_nhStat) {}
/**
@ -75,7 +75,7 @@ public :
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighborhood> & nhStat;
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -42,11 +42,11 @@
* From moNeighborhoodStat, to compute the number of solutions in the neighborhood
*
*/
template< class Neighborhood >
class moSizeNeighborStat : public moStat<typename Neighborhood::EOT, unsigned>
template< class Neighbor >
class moSizeNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
{
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<Neighborhood> & _nhStat):
moSizeNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, unsigned>(0, "size"), nhStat(_nhStat) {}
/**
@ -75,7 +75,7 @@ public :
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighborhood> & nhStat;
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -40,11 +40,11 @@
/**
* Continuator always return True
*/
template< class NH >
class moTrueContinuator : public moContinuator<NH>
template< class Neighbor >
class moTrueContinuator : public moContinuator<Neighbor>
{
public:
typedef typename NH::EOT EOT ;
typedef typename Neighbor::EOT EOT ;
// empty constructor
moTrueContinuator() {} ;

View file

@ -38,19 +38,20 @@
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
/**
* Explorer for a first imporvement heuristic
*/
template< class Neighborhood >
class moFirstImprExplorer : public moNeighborhoodExplorer<Neighborhood>
template< class Neighbor>
class moFirstImprExplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighborhood::Neighbor Neighbor ;
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
using moNeighborhoodExplorer<Neighborhood>::neighborhood;
using moNeighborhoodExplorer<Neighborhood>::eval;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::eval;
/**
* Constructor
@ -59,7 +60,7 @@ public:
* @param _neighborComparator a neighbor comparator
* @param _solNeighborComparator a solution vs neighbor comparator
*/
moFirstImprExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator) : moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) {
moFirstImprExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator) : moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) {
isAccept = false;
current=new Neighbor();
}

View file

@ -38,23 +38,24 @@
#include <explorer/moSimpleHCneutralExplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
/**
* Explorer for a neutral Hill-climbing
*/
template< class Neighborhood >
class moHCneutralExplorer : public moSimpleHCneutralExplorer<Neighborhood>
template< class Neighbor >
class moHCneutralExplorer : public moSimpleHCneutralExplorer<Neighbor>
{
public:
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighborhood::Neighbor Neighbor ;
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
using moNeighborhoodExplorer<Neighborhood>::neighborhood;
using moSimpleHCneutralExplorer<Neighborhood>::solNeighborComparator;
using moSimpleHCneutralExplorer<Neighborhood>::isAccept;
using moSimpleHCneutralExplorer<Neighborhood>::bestVector;
using moSimpleHCneutralExplorer<Neighborhood>::initParam;
using moSimpleHCneutralExplorer<Neighborhood>::updateParam;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moSimpleHCneutralExplorer<Neighbor>::solNeighborComparator;
using moSimpleHCneutralExplorer<Neighbor>::isAccept;
using moSimpleHCneutralExplorer<Neighbor>::bestVector;
using moSimpleHCneutralExplorer<Neighbor>::initParam;
using moSimpleHCneutralExplorer<Neighbor>::updateParam;
/**
* Constructor
@ -69,7 +70,7 @@ public:
moNeighborComparator<Neighbor>& _neighborComparator,
moSolNeighborComparator<Neighbor>& _solNeighborComparator,
unsigned _nbStep) :
moSimpleHCneutralExplorer<Neighborhood>(_neighborhood, _eval, _neighborComparator, _solNeighborComparator),
moSimpleHCneutralExplorer<Neighbor>(_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<Neighborhood>::initParam(solution);
moSimpleHCneutralExplorer<Neighbor>::initParam(solution);
step = 0;
};
@ -96,7 +97,7 @@ public:
* one more step
*/
virtual void updateParam(EOT & solution) {
moSimpleHCneutralExplorer<Neighborhood>::updateParam(solution);
moSimpleHCneutralExplorer<Neighbor>::updateParam(solution);
step++;
};

View file

@ -47,13 +47,12 @@
/**
* Explorer for an Iterated Local Search
*/
template< class NHE >
class moILSexplorer : public moNeighborhoodExplorer<moDummyNeighborhood<moDummyNeighbor<typename NHE::Neighborhood::EOT, typename NHE::Neighborhood::EOT::Fitness> > >
template< class Neighbor >
class moILSexplorer : public moNeighborhoodExplorer< moDummyNeighbor<typename Neighbor::EOT, typename Neighbor::EOT::Fitness> >
{
public:
typedef typename NHE::Neighborhood Neighborhood ;
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighborhood::Neighbor Neighbor ;
typedef moNeighborhood<Neighbor> Neighborhood ;
typedef typename Neighbor::EOT EOT ;
typedef moDummyNeighbor<EOT,typename EOT::Fitness> dummyNeighbor;
typedef moDummyNeighborhood<dummyNeighbor> dummyNeighborhood;
@ -63,7 +62,7 @@ public:
* @param _perturb a perturbation operator
* @param _acceptCrit a acceptance criteria
*/
moILSexplorer(moLocalSearch<NHE>& _ls, moPerturbation<Neighbor>& _perturb, moAcceptanceCriterion<Neighbor>& _acceptCrit) : moNeighborhoodExplorer<dummyNeighborhood>(), ls(_ls), perturb(_perturb), acceptCrit(_acceptCrit){
moILSexplorer(moLocalSearch<Neighbor>& _ls, moPerturbation<Neighbor>& _perturb, moAcceptanceCriterion<Neighbor>& _acceptCrit) : moNeighborhoodExplorer<dummyNeighbor>(), 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<NHE>& ls;
moLocalSearch<Neighbor>& ls;
moPerturbation<Neighbor> & perturb;
moAcceptanceCriterion<Neighbor>& acceptCrit;

View file

@ -40,6 +40,7 @@
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
#include <utils/eoRNG.h>
@ -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<Neighborhood>
template< class Neighbor >
class moMetropolisHastingExplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighborhood::Neighbor Neighbor ;
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
using moNeighborhoodExplorer<Neighborhood>::neighborhood;
using moNeighborhoodExplorer<Neighborhood>::eval;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::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<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator, unsigned int _nbStep) : moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator), nbStep(_nbStep) {
moMetropolisHastingExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator, unsigned int _nbStep) : moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator), nbStep(_nbStep) {
isAccept = false;
current=new Neighbor();
if (!neighborhood.isRandom()) {

View file

@ -47,14 +47,13 @@
/**
* Explore the neighborhood
*/
template< class NH >
class moNeighborhoodExplorer : public eoUF<typename NH::EOT&, void>
template< class Neighbor >
class moNeighborhoodExplorer : public eoUF<typename Neighbor::EOT&, void>
{
public:
typedef NH Neighborhood ;
typedef typename Neighborhood::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood;
typedef typename Neighbor::EOT EOT;
typedef typename EOT::Fitness Fitness ;
typedef typename Neighborhood::Neighbor Neighbor ;
moNeighborhoodExplorer():neighborhood(dummyNeighborhood), eval(dummyEval), isMoved(false) {}

View file

@ -37,6 +37,7 @@
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
/**
* 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<Neighborhood>
template< class Neighbor >
class moRandomNeutralWalkExplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighborhood::Neighbor Neighbor ;
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<Neighbor> Neighborhood;
using moNeighborhoodExplorer<Neighborhood>::neighborhood;
using moNeighborhoodExplorer<Neighborhood>::eval;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::eval;
/**
* Constructor
@ -64,7 +65,7 @@ public:
moRandomNeutralWalkExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval,
moSolNeighborComparator<Neighbor>& _solNeighborComparator,
unsigned _nbStep):
moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval),
moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval),
solNeighborComparator(_solNeighborComparator),
nbStep(_nbStep) {
isAccept = false;

View file

@ -38,19 +38,20 @@
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
/**
* Explorer for a random walk explorer
*/
template< class Neighborhood >
class moRandomWalkExplorer : public moNeighborhoodExplorer<Neighborhood>
template< class Neighbor >
class moRandomWalkExplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighborhood::Neighbor Neighbor ;
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
using moNeighborhoodExplorer<Neighborhood>::neighborhood;
using moNeighborhoodExplorer<Neighborhood>::eval;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::eval;
/**
* Constructor
@ -58,7 +59,7 @@ public:
* @param _eval the evaluation function
* @param _nbStep maximum number of step to do
*/
moRandomWalkExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, unsigned _nbStep) : moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval), nbStep(_nbStep) {
moRandomWalkExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, unsigned _nbStep) : moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval), nbStep(_nbStep) {
isAccept = false;
current=new Neighbor();
// number of step done

View file

@ -40,6 +40,7 @@
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moSolNeighborComparator.h>
#include <coolingSchedule/moCoolingSchedule.h>
#include <neighborhood/moNeighborhood.h>
#include <utils/eoRNG.h>
@ -49,15 +50,15 @@
* Fitness must be > 0
*
*/
template< class Neighborhood >
class moSAexplorer : public moNeighborhoodExplorer<Neighborhood>
template< class Neighbor >
class moSAexplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighborhood::Neighbor Neighbor ;
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
using moNeighborhoodExplorer<Neighborhood>::neighborhood;
using moNeighborhoodExplorer<Neighborhood>::eval;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::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<Neighbor>& _eval, moSolNeighborComparator<Neighbor>& _solNeighborComparator, moCoolingSchedule<EOT>& _coolingSchedule) : moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval), solNeighborComparator(_solNeighborComparator), coolingSchedule(_coolingSchedule) {
moSAexplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moSolNeighborComparator<Neighbor>& _solNeighborComparator, moCoolingSchedule<EOT>& _coolingSchedule) : moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval), solNeighborComparator(_solNeighborComparator), coolingSchedule(_coolingSchedule) {
isAccept = false;
if (!neighborhood.isRandom()) {

View file

@ -38,19 +38,20 @@
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
/**
* Explorer for a simple Hill-climbing
*/
template< class Neighborhood >
class moSimpleHCexplorer : public moNeighborhoodExplorer<Neighborhood>
template< class Neighbor >
class moSimpleHCexplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighborhood::Neighbor Neighbor ;
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
using moNeighborhoodExplorer<Neighborhood>::neighborhood;
using moNeighborhoodExplorer<Neighborhood>::eval;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::eval;
/**
* Constructor
@ -59,7 +60,7 @@ public:
* @param _neighborComparator a neighbor comparator
* @param _solNeighborComparator solution vs neighbor comparator
*/
moSimpleHCexplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator) : moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) {
moSimpleHCexplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator) : moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) {
isAccept = false;
current=new Neighbor();
best=new Neighbor();

View file

@ -38,21 +38,22 @@
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
#include <vector>
#include <utils/eoRNG.h>
/**
* Explorer for a simple neutral Hill-climbing
*/
template< class Neighborhood >
class moSimpleHCneutralExplorer : public moNeighborhoodExplorer<Neighborhood>
template< class Neighbor >
class moSimpleHCneutralExplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighborhood::Neighbor Neighbor ;
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
using moNeighborhoodExplorer<Neighborhood>::neighborhood;
using moNeighborhoodExplorer<Neighborhood>::eval;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::eval;
/**
* Constructor
@ -65,7 +66,7 @@ public:
moEval<Neighbor>& _eval,
moNeighborComparator<Neighbor>& _neighborComparator,
moSolNeighborComparator<Neighbor>& _solNeighborComparator) :
moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval),
moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval),
neighborComparator(_neighborComparator),
solNeighborComparator(_solNeighborComparator) {
isAccept = false;

View file

@ -42,17 +42,17 @@
#include <memory/moTabuList.h>
#include <memory/moIntensification.h>
#include <memory/moDiversification.h>
#include <neighborhood/moNeighborhood.h>
/**
* Explorer for a Tabu Search
*/
template< class Neighborhood >
class moTSExplorer : public moNeighborhoodExplorer<Neighborhood>
template< class Neighbor >
class moTSExplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighborhood::Neighbor Neighbor ;
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
/**
* Constructor
@ -74,7 +74,7 @@ public:
moDiversification<Neighbor> & _diversification,
moAspiration<Neighbor> & _aspiration
) :
moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator),
moNeighborhoodExplorer<Neighbor>(_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>::neighborhood;
using moNeighborhoodExplorer<Neighborhood>::eval;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::eval;
// comparator between solution and neighbor or between neighbors
moNeighborComparator<Neighbor>& neighborComparator;

View file

@ -52,7 +52,7 @@
#include <utils/eoUpdater.h>
typedef eoBit<eoMinimizingFitness> bitVector;
typedef moBitNeighbor<eoMinimizingFitness> bitNeighbor ;
typedef moBitNeighbor<eoMinimizingFitness> bitNeighbor;
class moDummyRndNeighborhood: public moOrderNeighborhood<bitNeighbor>/*, public moRndNeighborhood<bitNeighbor>*/ {
public:

View file

@ -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);

View file

@ -48,7 +48,7 @@ int main() {
moNeighborComparator<bitNeighbor> ncomp;
moSolNeighborComparator<bitNeighbor> sncomp;
moFirstImprExplorer<bitNeighborhood> test(nh, eval, ncomp, sncomp);
moFirstImprExplorer<bitNeighbor> test(nh, eval, ncomp, sncomp);
//on verifie qu'on améliore peut continuer à explorer tant qu'on améliore la solution

View file

@ -48,7 +48,7 @@ int main() {
moNeighborComparator<bitNeighbor> ncomp;
moSolNeighborComparator<bitNeighbor> sncomp;
moHCneutralExplorer<bitNeighborhood> test(nh, eval, ncomp, sncomp,3);
moHCneutralExplorer<bitNeighbor> test(nh, eval, ncomp, sncomp,3);
//on verifie qu'on ameliore bien la solution et que l'exploration dure 3 itérations

View file

@ -46,7 +46,7 @@ int main() {
moNeighborComparator<bitNeighbor> ncomp;
moSolNeighborComparator<bitNeighbor> sncomp;
moMetropolisHastingExplorer<bitNeighborhood> test(nh, eval, ncomp, sncomp, 3);
moMetropolisHastingExplorer<bitNeighbor> test(nh, eval, ncomp, sncomp, 3);
//test de l'acceptation d'un voisin améliorant
test.initParam(sol);

View file

@ -73,7 +73,7 @@ int main() {
sol.fitness(7);
moNeighborhoodStat<bitNeighborhood> test(n, eval, neighborComp, solNeighborComp);
moNeighborhoodStat<bitNeighbor> 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<bitNeighborhood> test2(test);
moMaxNeighborStat<bitNeighbor> 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<bitNeighborhood> test3(test);
moMinNeighborStat<bitNeighbor> 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<bitNeighborhood> test4(test);
moNbInfNeighborStat<bitNeighbor> 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<bitNeighborhood> test5(test);
moNbSupNeighborStat<bitNeighbor> 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<bitNeighborhood> test6(test);
moNeutralDegreeNeighborStat<bitNeighbor> 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<bitNeighborhood> test7(test);
moSecondMomentNeighborStat<bitNeighbor> 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<bitNeighborhood> test8(test);
moSizeNeighborStat<bitNeighbor> test8(test);
test8(sol);
assert(test8.value()==10);
assert(test8.className()=="moSizeNeighborStat");

View file

@ -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<bitNeighborhood> test(nh, eval, sncomp, 3);
moRandomNeutralWalkExplorer<bitNeighbor> 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<bitNeighborhood> test2(nh, eval2, sncomp, 3);
moRandomNeutralWalkExplorer<bitNeighbor> test2(nh, eval2, sncomp, 3);
sol.fitness(2);
test2.initParam(sol);

View file

@ -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<bitNeighborhood> test(nh, eval, 3);
moRandomWalkExplorer<bitNeighbor> test(nh, eval, 3);
test.initParam(sol);

View file

@ -56,7 +56,7 @@ int main() {
moSolNeighborComparator<moDummyNeighborTest> solNeighborComp;
//verif constructor
moSimpleHCexplorer<moDummyNeighborhoodTest> test(nh, fulleval, comp, solNeighborComp);
moSimpleHCexplorer<moDummyNeighborTest> 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

View file

@ -48,7 +48,7 @@ int main() {
moNeighborComparator<bitNeighbor> ncomp;
moSolNeighborComparator<bitNeighbor> sncomp;
moSimpleHCneutralExplorer<bitNeighborhood> test(nh, eval, ncomp, sncomp);
moSimpleHCneutralExplorer<bitNeighbor> test(nh, eval, ncomp, sncomp);
//test qu'on ameliore bien a chaque itération
test.initParam(sol);

View file

@ -55,8 +55,8 @@ int main() {
moSolVectorTabuList<bitNeighbor> tabuList(4,0);
moBestImprAspiration<bitNeighbor> aspir;
moTSExplorer<bitNeighborhood> test(nh, eval, ncomp, sncomp, tabuList, intens, diver, aspir);
moTSExplorer<bitNeighborhood> test2(emptyNH, eval, ncomp, sncomp, tabuList, intens, diver, aspir);
moTSExplorer<bitNeighbor> test(nh, eval, ncomp, sncomp, tabuList, intens, diver, aspir);
moTSExplorer<bitNeighbor> 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<bitNeighborhood> test3(nh2, eval2, ncomp, sncomp, tabuList, intens, diver, aspir);
moTSExplorer<bitNeighbor> test3(nh2, eval2, ncomp, sncomp, tabuList, intens, diver, aspir);
test3.initParam(sol2);
test3(sol2);

View file

@ -43,7 +43,7 @@ int main() {
std::cout << "[t-moTrueContinuator] => START" << std::endl;
moTrueContinuator<moDummyNeighborhoodTest> test;
moTrueContinuator<moDummyNeighborTest> test;
Solution s;
assert(test(s));

View file

@ -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)

View file

@ -149,7 +149,7 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moFirstImprExplorer<Neighborhood> explorer(neighborhood, fulleval, comparator, solComparator);
moFirstImprExplorer<Neighbor> explorer(neighborhood, fulleval, comparator, solComparator);
/* =========================================================
@ -158,9 +158,9 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moTrueContinuator<Neighborhood> continuator;//always continue
moTrueContinuator<Neighbor> continuator;//always continue
moLocalSearch< moFirstImprExplorer<Neighborhood> > localSearch(explorer, continuator, eval);
moLocalSearch< Neighbor > localSearch(explorer, continuator, eval);
/* =========================================================
*

View file

@ -153,7 +153,7 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moHCneutralExplorer<Neighborhood> explorer(neighborhood, fulleval, comparator, solComparator, nbStep);
moHCneutralExplorer<Neighbor> explorer(neighborhood, fulleval, comparator, solComparator, nbStep);
/* =========================================================
@ -162,9 +162,9 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moTrueContinuator<Neighborhood> continuator;//always continue
moTrueContinuator<Neighbor> continuator;//always continue
moLocalSearch< moHCneutralExplorer<Neighborhood> > localSearch(explorer, continuator, eval);
moLocalSearch<Neighbor> localSearch(explorer, continuator, eval);
/* =========================================================
*

View file

@ -164,7 +164,7 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moSimpleHCexplorer<Neighborhood> explorer(neighborhood, fulleval, comparator, solComparator);
moSimpleHCexplorer<Neighbor> explorer(neighborhood, fulleval, comparator, solComparator);
/* =========================================================
@ -173,28 +173,28 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moTrueContinuator<Neighborhood> continuator;//always continue
moTrueContinuator<Neighbor> continuator;//always continue
moLocalSearch< NHE > hc(explorer, continuator, eval);
moLocalSearch< Neighbor > hc(explorer, continuator, eval);
eoBitMutation<Indi> monOp(1.0/vecSize);
//moMonOpPerturb<Neighbor> perturb(monOp, eval);
moMonOpPerturb<Neighbor> perturb(monOp, eval);
//moRestartPerturb<Neighbor> perturb(random, eval, 5);
moNeighborhoodPerturb<Neighbor, Neighborhood2> perturb(neighborhood2, fulleval);
//moNeighborhoodPerturb<Neighbor, Neighborhood2> perturb(neighborhood2, fulleval);
moSolComparator<Indi> comp;
//moAlwaysAcceptCrit<Neighbor> accept;
moBetterAcceptCrit<Neighbor> accept(comp);
moILSexplorer< NHE > explorerILS(hc, perturb, accept);
moILSexplorer< Neighbor > explorerILS(hc, perturb, accept);
moIterContinuator<Neighborhood> continuatorILS(100);
moIterContinuator<Neighbor> continuatorILS(100);
moLocalSearch< moILSexplorer< moSimpleHCexplorer<Neighborhood> > >localSearch(explorerILS, continuatorILS, eval);
moLocalSearch<Neighbor>localSearch(explorerILS, continuatorILS, eval);
/* =========================================================

View file

@ -153,7 +153,7 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moMetropolisHastingExplorer<Neighborhood> explorer(neighborhood, fulleval, comparator, solComparator, nbStep);
moMetropolisHastingExplorer<Neighbor> explorer(neighborhood, fulleval, comparator, solComparator, nbStep);
/* =========================================================
@ -162,9 +162,9 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moTrueContinuator<Neighborhood> continuator;//always continue
moTrueContinuator<Neighbor> continuator;//always continue
moLocalSearch< moMetropolisHastingExplorer<Neighborhood> > localSearch(explorer, continuator, eval);
moLocalSearch<Neighbor> localSearch(explorer, continuator, eval);
/* =========================================================
*

View file

@ -171,7 +171,7 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moRandomNeutralWalkExplorer<Neighborhood> explorer(neighborhood, nhEval, solComparator, nbStep);
moRandomNeutralWalkExplorer<Neighbor> explorer(neighborhood, nhEval, solComparator, nbStep);
/* =========================================================
@ -193,9 +193,9 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moTrueContinuator<Neighborhood> continuator;//always continue
moTrueContinuator<Neighbor> continuator;//always continue
moCheckpoint<Neighborhood> checkpoint(continuator);
moCheckpoint<Neighbor> checkpoint(continuator);
moFitnessStat<Indi, unsigned> fStat;
@ -203,15 +203,15 @@ void main_function(int argc, char **argv)
moDistanceStat<Indi, unsigned> distStat(distance, solution); // distance from the intial solution
moOrderNeighborhood<Neighbor> nh(vecSize);
moNeighborhoodStat< moOrderNeighborhood<Neighbor> > neighborhoodStat(nh, nhEval, comparator, solComparator);
moMinNeighborStat< moOrderNeighborhood<Neighbor> > minStat(neighborhoodStat);
moSecondMomentNeighborStat< moOrderNeighborhood<Neighbor> > secondMomentStat(neighborhoodStat);
moMaxNeighborStat< moOrderNeighborhood<Neighbor> > maxStat(neighborhoodStat);
moNeighborhoodStat< Neighbor > neighborhoodStat(nh, nhEval, comparator, solComparator);
moMinNeighborStat< Neighbor > minStat(neighborhoodStat);
moSecondMomentNeighborStat< Neighbor > secondMomentStat(neighborhoodStat);
moMaxNeighborStat< Neighbor > maxStat(neighborhoodStat);
moNbSupNeighborStat< moOrderNeighborhood<Neighbor> > nbSupStat(neighborhoodStat);
moNbInfNeighborStat< moOrderNeighborhood<Neighbor> > nbInfStat(neighborhoodStat);
moNeutralDegreeNeighborStat< moOrderNeighborhood<Neighbor> > ndStat(neighborhoodStat);
moSizeNeighborStat< moOrderNeighborhood<Neighbor> > sizeStat(neighborhoodStat);
moNbSupNeighborStat< Neighbor > nbSupStat(neighborhoodStat);
moNbInfNeighborStat< Neighbor > nbInfStat(neighborhoodStat);
moNeutralDegreeNeighborStat< Neighbor > ndStat(neighborhoodStat);
moSizeNeighborStat< Neighbor > sizeStat(neighborhoodStat);
eoValueParam<unsigned int> genCounter(-1,"Gen");
eoIncrementor<unsigned int> increm(genCounter.value());
@ -248,7 +248,7 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moLocalSearch< moRandomNeutralWalkExplorer<Neighborhood> > localSearch(explorer, checkpoint, eval);
moLocalSearch<Neighbor> localSearch(explorer, checkpoint, eval);
/* =========================================================
*

View file

@ -149,7 +149,7 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moRandomWalkExplorer<Neighborhood> explorer(neighborhood, nhEval, nbStep);
moRandomWalkExplorer<Neighbor> explorer(neighborhood, nhEval, nbStep);
/* =========================================================
@ -158,9 +158,9 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moTrueContinuator<Neighborhood> continuator;//always continue
moTrueContinuator<Neighbor> continuator;//always continue
moCheckpoint<Neighborhood> checkpoint(continuator);
moCheckpoint<Neighbor> checkpoint(continuator);
moFitnessStat<Indi, unsigned> fStat;
eoHammingDistance<Indi> distance;
@ -208,7 +208,7 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moLocalSearch< moRandomWalkExplorer<Neighborhood> > localSearch(explorer, checkpoint, eval);
moLocalSearch<Neighbor> localSearch(explorer, checkpoint, eval);
/* =========================================================
*

View file

@ -149,7 +149,7 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moSimpleHCexplorer<Neighborhood> explorer(neighborhood, fulleval, comparator, solComparator);
moSimpleHCexplorer<Neighbor> explorer(neighborhood, fulleval, comparator, solComparator);
/* =========================================================
@ -158,9 +158,9 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moTrueContinuator<Neighborhood> continuator;//always continue
moTrueContinuator<Neighbor> continuator;//always continue
moLocalSearch< moSimpleHCexplorer<Neighborhood> > localSearch(explorer, continuator, eval);
moLocalSearch< Neighbor > localSearch(explorer, continuator, eval);
/* =========================================================
*

View file

@ -149,7 +149,7 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moSimpleHCneutralExplorer<Neighborhood> explorer(neighborhood, fulleval, comparator, solComparator);
moSimpleHCneutralExplorer<Neighbor> explorer(neighborhood, fulleval, comparator, solComparator);
/* =========================================================
@ -158,9 +158,9 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moTrueContinuator<Neighborhood> continuator;//always continue
moTrueContinuator<Neighbor> continuator;//always continue
moLocalSearch< moSimpleHCneutralExplorer<Neighborhood> > localSearch(explorer, continuator, eval);
moLocalSearch<Neighbor> localSearch(explorer, continuator, eval);
/* =========================================================
*

View file

@ -155,7 +155,7 @@ void main_function(int argc, char **argv)
moDummyIntensification<Neighbor> inten;
moDummyDiversification<Neighbor> div;
moBestImprAspiration<Neighbor> asp;
moTSExplorer<Neighborhood> explorer(neighborhood, eval, comparator, solComparator, tl, inten, div, asp);
moTSExplorer<Neighbor> explorer(neighborhood, eval, comparator, solComparator, tl, inten, div, asp);
/* =========================================================
@ -164,9 +164,9 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moTrueContinuator<Neighborhood> continuator;//always continue
moTrueContinuator<Neighbor> continuator;//always continue
moLocalSearch< moTSExplorer<Neighborhood> > localSearch(explorer, continuator, fulleval);
moLocalSearch<Neighbor> localSearch(explorer, continuator, fulleval);
/* =========================================================
*

View file

@ -158,7 +158,7 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moSAexplorer<Neighborhood> explorer(neighborhood, fulleval, solComparator, coolingSchedule);
moSAexplorer<Neighbor> explorer(neighborhood, fulleval, solComparator, coolingSchedule);
/* =========================================================
*
@ -166,9 +166,9 @@ void main_function(int argc, char **argv)
*
* ========================================================= */
moTrueContinuator<Neighborhood> continuator;//always continue
moTrueContinuator<Neighbor> continuator;//always continue
moLocalSearch< moSAexplorer<Neighborhood> > localSearch(explorer, continuator, eval);
moLocalSearch<Neighbor> localSearch(explorer, continuator, eval);
/* =========================================================
*