Migration from SVN

This commit is contained in:
quemy 2012-08-30 11:30:11 +02:00
commit 8cd56f37db
29069 changed files with 0 additions and 4096888 deletions

View file

@ -0,0 +1,56 @@
/*
<moDummyMonOp.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moDummyMonOp_h
#define _moDummyMonOp_h
#include <eoOp.h>
/**
* The mutation operator that does nothing at all !
*/
template<class EOT>
class eoDummyMonOp: public eoMonOp<EOT> {
public:
/**
* Do nothing on the solution
* @param _solution the related solution
*/
virtual bool operator()(EOT & _solution) {
return true;
}
};
#endif

71
mo/src/algo/moDummyLS.h Normal file
View file

@ -0,0 +1,71 @@
/*
<moDummyLS.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moDummyLS_h
#define _moDummyLS_h
#include <algo/moLocalSearch.h>
#include <explorer/moDummyExplorer.h>
#include <continuator/moTrueContinuator.h>
/**
* Dummy Local Search:
*
* To do nothing, only the full evaluation of the solution if necessary ;-)
*/
template<class Neighbor>
class moDummyLS: public moLocalSearch<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<Neighbor> Neighborhood ;
/**
* Simple constructor
* @param _fullEval the full evaluation function
*/
moDummyLS(eoEvalFunc<EOT>& _fullEval):
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval)
{}
/**
* @return name of the class
*/
virtual std::string className(void) const {
return "moDummyLS";
}
private:
// always true continuator
moTrueContinuator<Neighbor> trueCont;
// dummy Explorer
moDummyExplorer<Neighbor> explorer;
};
#endif

120
mo/src/algo/moFirstImprHC.h Normal file
View file

@ -0,0 +1,120 @@
/*
<moFirstImprHC.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moFirstImprHC_h
#define _moFirstImprHC_h
#include <algo/moLocalSearch.h>
#include <explorer/moFirstImprHCexplorer.h>
#include <continuator/moTrueContinuator.h>
#include <eval/moEval.h>
#include <eoEvalFunc.h>
/**
* First improvement HC:
* Hill-Climbing local search
*
* At each iteration,
* one of the random solution in the neighborhood is selected
* if the selected neighbor have higher fitness than the current solution
* then the solution is replaced by the selected neighbor
* the algorithm stops when there is no higher neighbor
*/
template<class Neighbor>
class moFirstImprHC: public moLocalSearch<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<Neighbor> Neighborhood ;
/**
* Basic constructor for a hill-climber
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
*/
moFirstImprHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval):
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp)
{}
/**
* Simple constructor for a hill-climber
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _cont an external continuator
*/
moFirstImprHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp)
{}
/**
* General constructor for a hill-climber
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _cont an external continuator
* @param _compN a neighbor vs neighbor comparator
* @param _compSN a solution vs neighbor comparator
*/
moFirstImprHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont, moNeighborComparator<Neighbor>& _compN, moSolNeighborComparator<Neighbor>& _compSN):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_neighborhood, _eval, _compN, _compSN)
{}
/**
* to never stop the hill climbing
*
*/
virtual void alwaysContinue() {
explorer.alwaysContinue();
}
/**
* Return the class id.
* @return the class name as a std::string
*/
virtual std::string className() const {
return "moFirstImprHV";
}
private:
// always true continuator
moTrueContinuator<Neighbor> trueCont;
// compare the fitness values of neighbors: true if strictly greater
moNeighborComparator<Neighbor> defaultNeighborComp;
// compare the fitness values of the solution and the neighbor: true if strictly greater
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
// the explorer of the first improvement HC
moFirstImprHCexplorer<Neighbor> explorer;
};
#endif

118
mo/src/algo/moILS.h Normal file
View file

@ -0,0 +1,118 @@
/*
<moILS.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moILS_h
#define _moILS_h
#include <algo/moLocalSearch.h>
#include <explorer/moILSexplorer.h>
#include <continuator/moIterContinuator.h>
#include <eoOp.h>
#include <neighborhood/moDummyNeighbor.h>
#include <perturb/moMonOpPerturb.h>
#include <perturb/moPerturbation.h>
#include <acceptCrit/moAlwaysAcceptCrit.h>
#include <eval/moEval.h>
#include <eoEvalFunc.h>
/**
* Iterated Local Search
*/
template<class Neighbor, class NeighborLO = moDummyNeighbor<typename Neighbor::EOT> >
class moILS: public moLocalSearch< NeighborLO >
{
public:
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<Neighbor> Neighborhood ;
/**
* Basic constructor for Iterated Local Search
* @param _ls the local search to iterates
* @param _fullEval the full evaluation function
* @param _op the operator used to perturb solution
* @param _nbIteration the time limit for search
*/
moILS(moLocalSearch<Neighbor>& _ls, eoEvalFunc<EOT>& _fullEval, eoMonOp<EOT>& _op, unsigned int _nbIteration):
moLocalSearch< moDummyNeighbor<EOT> >(explorer, iterCont, _fullEval),
iterCont(_nbIteration),
defaultPerturb(_op, _fullEval),
explorer(_ls, defaultPerturb, defaultAccept)
{}
/**
* Simple constructor for Iterated Local Search
* @param _ls the local search to iterates
* @param _fullEval the full evaluation function
* @param _op the operator used to perturb solution
* @param _cont a continuator
*/
moILS(moLocalSearch<Neighbor>& _ls, eoEvalFunc<EOT>& _fullEval, eoMonOp<EOT>& _op, moContinuator<NeighborLO>& _cont):
moLocalSearch< NeighborLO >(explorer, _cont, _fullEval),
iterCont(0),
defaultPerturb(_op, _fullEval),
explorer(_ls, defaultPerturb, defaultAccept)
{}
/**
* General constructor for Iterated Local Search
* @param _ls the local search to iterates
* @param _fullEval the full evaluation function
* @param _cont a continuator
* @param _perturb a perturbation operator
* @param _accept a acceptance criteria
*/
// moILS(moLocalSearch<Neighbor>& _ls, eoEvalFunc<EOT>& _fullEval, moContinuator<moDummyNeighbor<EOT> >& _cont, moMonOpPerturb<Neighbor>& _perturb, moAcceptanceCriterion<Neighbor>& _accept):
// moILS(moLocalSearch<Neighbor>& _ls, eoEvalFunc<EOT>& _fullEval, moContinuator<NeighborLO>& _cont, moPerturbation<Neighbor>& _perturb):
moILS(moLocalSearch<Neighbor>& _ls, eoEvalFunc<EOT>& _fullEval, moContinuator<NeighborLO>& _cont, moPerturbation<Neighbor>& _perturb, moAcceptanceCriterion<Neighbor>& _accept):
moLocalSearch<NeighborLO>(explorer, _cont, _fullEval),
iterCont(0),
defaultPerturb(dummyOp, _fullEval),
explorer(_ls, _perturb, _accept)
{}
private:
class dummmyMonOp: public eoMonOp<EOT> {
public:
bool operator()(EOT&) {
return false;
}
} dummyOp;
moIterContinuator<moDummyNeighbor<EOT> > iterCont;
moMonOpPerturb<Neighbor> defaultPerturb;
moAlwaysAcceptCrit<Neighbor> defaultAccept;
moILSexplorer< Neighbor , NeighborLO > explorer; // inherits from moNeighborhoodExplorer< NeighborLO >
};
#endif

146
mo/src/algo/moLocalSearch.h Normal file
View file

@ -0,0 +1,146 @@
/*
<moLocalSearch.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moLocalSearch_h
#define _moLocalSearch_h
#include <explorer/moNeighborhoodExplorer.h>
#include <continuator/moContinuator.h>
#include <neighborhood/moNeighborhood.h>
#include <eoEvalFunc.h>
#include <eoOp.h>
/**
* the main algorithm of the local search
*/
template<class Neighbor>
class moLocalSearch: public eoMonOp<typename Neighbor::EOT> {
public:
typedef moNeighborhood<Neighbor> Neighborhood;
typedef moNeighborhoodExplorer<Neighbor> NeighborhoodExplorer;
typedef typename Neighbor::EOT EOT;
/**
* Constructor of a moLocalSearch
* @param _searchExpl a neighborhood explorer
* @param _cont an external continuator (can be a checkpoint!)
* @param _fullEval a full evaluation function
*/
moLocalSearch(NeighborhoodExplorer& _searchExpl,
moContinuator<Neighbor> & _cont, eoEvalFunc<EOT>& _fullEval) :
searchExplorer(_searchExpl), cont(&_cont), fullEval(_fullEval) {
}
;
/**
* Run the local search on a solution
* @param _solution the related solution
*/
virtual bool operator()(EOT & _solution) {
if (_solution.invalid())
fullEval(_solution);
// initialization of the parameter of the search (for example fill empty the tabu list)
searchExplorer.initParam(_solution);
// initialization of the external continuator (for example the time, or the number of generations)
cont->init(_solution);
bool b;
do {
// explore the neighborhood of the solution
searchExplorer(_solution);
// if a solution in the neighborhood can be accepted
if (searchExplorer.accept(_solution)) {
searchExplorer.move(_solution);
searchExplorer.moveApplied(true);
} else
searchExplorer.moveApplied(false);
// update the parameter of the search (for ex. Temperature of the SA)
searchExplorer.updateParam(_solution);
b = (*cont)(_solution);
} while (b && searchExplorer.isContinue(_solution));
searchExplorer.terminate(_solution);
cont->lastCall(_solution);
return true;
}
;
/**
* Set an external continuator
* @param _cont the external continuator
*/
void setContinuator(moContinuator<Neighbor> & _cont) {
cont = &_cont;
}
/**
* external continuator object
*
* @overload
* @return the external continuator
*/
moContinuator<Neighbor>* getContinuator() const {
return cont;
}
/**
* to get the neighborhood explorer
*
* @overload
* @return the neighborhood explorer
*/
moNeighborhoodExplorer<Neighbor> & getNeighborhoodExplorer() const {
return searchExplorer;
}
protected:
// make the exploration of the neighborhood according to a local search heuristic
moNeighborhoodExplorer<Neighbor>& searchExplorer;
// external continuator
moContinuator<Neighbor> * cont;
//full evaluation function
eoEvalFunc<EOT>& fullEval;
};
#endif

View file

@ -0,0 +1,110 @@
/*
<moMetropolisHasting.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moMetropolisHasting_h
#define _moMetropolisHasting_h
#include <algo/moLocalSearch.h>
#include <explorer/moMetropolisHastingExplorer.h>
#include <continuator/moTrueContinuator.h>
#include <eval/moEval.h>
#include <eoEvalFunc.h>
/**
* Metropolis-Hasting local search
* Only the symetric case is considered when Q(x,y) = Q(y,x)
* Fitness must be > 0
*
* At each iteration,
* one of the random solution in the neighborhood is selected
* if the selected neighbor have higher or equal fitness than the current solution
* then the solution is replaced by the selected neighbor
* if a random number from [0,1] is lower than fitness(neighbor) / fitness(solution)
* then the solution is replaced by the selected neighbor
* the algorithm stops when the number of iterations is too large
*/
template<class Neighbor>
class moMetropolisHasting: public moLocalSearch<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<Neighbor> Neighborhood ;
/**
* Basic constructor of the Metropolis-Hasting
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _nbStep maximum step to do
*/
moMetropolisHasting(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned int _nbStep):
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _nbStep)
{}
/**
* Simple constructor of the Metropolis-Hasting
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _nbStep maximum step to do
* @param _cont an external continuator
*/
moMetropolisHasting(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned int _nbStep, moContinuator<Neighbor>& _cont):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _nbStep)
{}
/**
* General constructor of the Metropolis-Hasting
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _nbStep maximum step to do
* @param _cont an external continuator
* @param _compN a neighbor vs neighbor comparator
* @param _compSN a solution vs neighbor comparator
*/
moMetropolisHasting(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned int _nbStep, moContinuator<Neighbor>& _cont, moNeighborComparator<Neighbor>& _compN, moSolNeighborComparator<Neighbor>& _compSN):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_neighborhood, _eval, _compN, _compSN, _nbStep)
{}
private:
// always true continuator
moTrueContinuator<Neighbor> trueCont;
// compare the fitness values of neighbors
moNeighborComparator<Neighbor> defaultNeighborComp;
// compare the fitness values of the solution and the neighbor
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
// MetropolisHasting explorer
moMetropolisHastingExplorer<Neighbor> explorer;
};
#endif

106
mo/src/algo/moNeutralHC.h Normal file
View file

@ -0,0 +1,106 @@
/*
<moNeutralHC.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moNeutralHC_h
#define _moNeutralHC_h
#include <algo/moLocalSearch.h>
#include <explorer/moNeutralHCexplorer.h>
#include <continuator/moTrueContinuator.h>
#include <eval/moEval.h>
#include <eoEvalFunc.h>
/**
* Hill-Climbing local search
*
* At each iteration,
* one of the random best solution in the neighborhood is selected
* if the selected neighbor have higher or equal fitness than the current solution
* then the solution is replaced by the selected neighbor
* the algorithm stops when there is no higher or equal neighbor, or if the number of iterations is too large
*/
template<class Neighbor>
class moNeutralHC: public moLocalSearch<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<Neighbor> Neighborhood ;
/**
* Basic constructor for a hill-climber
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _nbStep maximum step to do
*/
moNeutralHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned int _nbStep):
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _nbStep)
{}
/**
* Simple constructor for a hill-climber
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _nbStep maximum step to do
* @param _cont an external continuator
*/
moNeutralHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned int _nbStep, moContinuator<Neighbor>& _cont):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _nbStep)
{}
/**
* General constructor for a hill-climber
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _nbStep maximum step to do
* @param _cont an external continuator
* @param _compN a neighbor vs neighbor comparator
* @param _compSN a solution vs neighbor comparator
*/
moNeutralHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned int _nbStep, moContinuator<Neighbor>& _cont, moNeighborComparator<Neighbor>& _compN, moSolNeighborComparator<Neighbor>& _compSN):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_neighborhood, _eval, _compN, _compSN, _nbStep)
{}
private:
// always true continuator
moTrueContinuator<Neighbor> trueCont;
// compare the fitness values of neighbors
moNeighborComparator<Neighbor> defaultNeighborComp;
// compare the fitness values of the solution and the neighbor
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
// the explorer of the HC with neutral move (equals fitness move)
moNeutralHCexplorer<Neighbor> explorer;
};
#endif

View file

@ -0,0 +1,104 @@
/*
<moRandomBestHC.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moRandomBestHC_h
#define _moRandomBestHC_h
#include <algo/moLocalSearch.h>
#include <explorer/moRandomBestHCexplorer.h>
#include <continuator/moTrueContinuator.h>
#include <eval/moEval.h>
#include <eoEvalFunc.h>
/**
* Random Best HC:
* Hill-Climbing local search
*
* At each iteration,
* one of the random best solution in the neighborhood is selected
* if the selected neighbor have higher fitness than the current solution
* then the solution is replaced by the selected neighbor
* the algorithm stops when there is no higher neighbor
*/
template<class Neighbor>
class moRandomBestHC: public moLocalSearch<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<Neighbor> Neighborhood ;
/**
* Basic constructor for a hill-climber
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
*/
moRandomBestHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval):
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp)
{}
/**
* Simple constructor for a hill-climber
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _cont an external continuator
*/
moRandomBestHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp)
{}
/**
* General constructor for a hill-climber
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _cont an external continuator
* @param _compN a neighbor vs neighbor comparator
* @param _compSN a solution vs neighbor comparator
*/
moRandomBestHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont, moNeighborComparator<Neighbor>& _compN, moSolNeighborComparator<Neighbor>& _compSN):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_neighborhood, _eval, _compN, _compSN)
{}
private:
// always true continuator
moTrueContinuator<Neighbor> trueCont;
// compare the fitness values of neighbors
moNeighborComparator<Neighbor> defaultNeighborComp;
// compare the fitness values of the solution and the neighbor
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
// the explorer of the HC with random choice of the best solution
moRandomBestHCexplorer<Neighbor> explorer;
};
#endif

View file

@ -0,0 +1,102 @@
/*
<moRandomNeutralWalk.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moRandomNeutralWalk_h
#define _moRandomNeutralWalk_h
#include <algo/moLocalSearch.h>
#include <explorer/moRandomNeutralWalkExplorer.h>
#include <continuator/moTrueContinuator.h>
#include <eval/moEval.h>
#include <eoEvalFunc.h>
/**
* Random Neutral Walk:
* Random Neutral walk local search
*
* At each iteration,
* one random neighbor with the same fitness is selected and replace the current solution
* the algorithm stops when the number of steps is reached
*/
template<class Neighbor>
class moRandomNeutralWalk: public moLocalSearch<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<Neighbor> Neighborhood ;
/**
* Basic constructor for a random walk
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _nbStepMax number of step of the walk
*/
moRandomNeutralWalk(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned _nbStepMax):
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
explorer(_neighborhood, _eval, defaultSolNeighborComp, _nbStepMax)
{}
/**
* Simple constructor for a random walk
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _nbStepMax number of step of the walk
* @param _cont an external continuator
*/
moRandomNeutralWalk(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned _nbStepMax, moContinuator<Neighbor>& _cont):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_neighborhood, _eval, defaultSolNeighborComp, _nbStepMax)
{}
/**
* General constructor for a random walk
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _nbStepMax number of step of the walk
* @param _cont an external continuator
* @param _comp a solution vs neighbor comparator
*/
moRandomNeutralWalk(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned _nbStepMax, moContinuator<Neighbor>& _cont, moSolNeighborComparator<Neighbor>& _comp):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_neighborhood, _eval, _comp, _nbStepMax)
{}
private:
// always true continuator
moTrueContinuator<Neighbor> trueCont;
// the explorer of the random walk
moRandomNeutralWalkExplorer<Neighbor> explorer;
// compare the fitness values of the solution and the neighbor
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
};
#endif

View file

@ -0,0 +1,90 @@
/*
<moRandomSearch.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moRandomSearch_h
#define _moRandomSearch_h
#include <algo/moLocalSearch.h>
#include <explorer/moRandomSearchExplorer.h>
#include <continuator/moTrueContinuator.h>
#include <eoInit.h>
#include <eoEvalFunc.h>
/**
* Random Search:
* Pure random search local search
*
* At each iteration,
* one random solution is selected and replace the current solution
* the algorithm stops when the number of solution is reached
*/
template<class Neighbor>
class moRandomSearch: public moLocalSearch<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* Simple constructor for a random search
* @param _init the solution initializer, to explore at random the search space
* @param _fullEval the full evaluation function
* @param _nbSolMax number of solutions
*/
moRandomSearch(eoInit<EOT> & _init, eoEvalFunc<EOT>& _fullEval, unsigned _nbSolMax):
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
explorer(_init, _fullEval, _nbSolMax>0?_nbSolMax - 1:0)
{}
/**
* General constructor for a random search
* @param _init the solution initializer, to explore at random the search space
* @param _fullEval the full evaluation function
* @param _nbSolMax number of solutions
* @param _cont external continuator
*/
moRandomSearch(eoInit<EOT> & _init, eoEvalFunc<EOT>& _fullEval, unsigned _nbSolMax, moContinuator<Neighbor>& _cont):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_init, _fullEval, _nbSolMax>0?_nbSolMax - 1:0)
{}
/**
* @return name of the class
*/
virtual std::string className(void) const {
return "moRandomSearch";
}
private:
// always true continuator
moTrueContinuator<Neighbor> trueCont;
// the explorer of the random walk
moRandomSearchExplorer<Neighbor> explorer;
};
#endif

View file

@ -0,0 +1,87 @@
/*
<moRandomWalk.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moRandomWalk_h
#define _moRandomWalk_h
#include <algo/moLocalSearch.h>
#include <explorer/moRandomWalkExplorer.h>
#include <continuator/moIterContinuator.h>
#include <eval/moEval.h>
#include <eoEvalFunc.h>
/**
* Random Walk:
* Random walk local search
*
* At each iteration,
* one random neighbor is selected and replace the current solution
* the algorithm stops when the number of steps is reached
*/
template<class Neighbor>
class moRandomWalk: public moLocalSearch<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<Neighbor> Neighborhood ;
/**
* Simple constructor for a random walk
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _nbStepMax number of step of the walk
*/
moRandomWalk(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned _nbStepMax):
moLocalSearch<Neighbor>(explorer, iterCont, _fullEval),
iterCont(_nbStepMax),
explorer(_neighborhood, _eval)
{}
/**
* General constructor for a random walk
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _cont a user-defined continuator
*/
moRandomWalk(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
iterCont(0),
explorer(_neighborhood, _eval)
{}
private:
// the continuator to stop on a maximum number of step
moIterContinuator<Neighbor> iterCont;
// the explorer of the random walk
moRandomWalkExplorer<Neighbor> explorer;
};
#endif

120
mo/src/algo/moSA.h Normal file
View file

@ -0,0 +1,120 @@
/*
<moSA.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moSA_h
#define _moSA_h
#include <algo/moLocalSearch.h>
#include <explorer/moSAexplorer.h>
#include <coolingSchedule/moCoolingSchedule.h>
#include <coolingSchedule/moSimpleCoolingSchedule.h>
#include <continuator/moTrueContinuator.h>
#include <eval/moEval.h>
#include <eoEvalFunc.h>
/**
* Simulated Annealing
*/
template<class Neighbor>
class moSA: public moLocalSearch<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<Neighbor> Neighborhood ;
/**
* Basic constructor for a simulated annealing
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _initT initial temperature for cooling schedule (default = 10)
* @param _alpha factor of decreasing for cooling schedule (default = 0.9)
* @param _span number of iteration with equal temperature for cooling schedule (default = 100)
* @param _finalT final temperature, threshold of the stopping criteria for cooling schedule (default = 0.01)
*/
moSA(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, double _initT=10, double _alpha=0.9, unsigned _span=100, double _finalT=0.01):
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
defaultCool(_initT, _alpha, _span, _finalT),
explorer(_neighborhood, _eval, defaultSolNeighborComp, defaultCool)
{}
/**
* Simple constructor for a simulated annealing
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _cool a cooling schedule
*/
moSA(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moCoolingSchedule<EOT>& _cool):
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
defaultCool(0, 0, 0, 0),
explorer(_neighborhood, _eval, defaultSolNeighborComp, _cool)
{}
/**
* General constructor for a simulated annealing
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _cool a cooling schedule
* @param _cont an external continuator
*/
moSA(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moCoolingSchedule<EOT>& _cool, moContinuator<Neighbor>& _cont):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
defaultCool(0, 0, 0, 0),
explorer(_neighborhood, _eval, defaultSolNeighborComp, _cool)
{}
/**
* General constructor for a simulated annealing
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _cool a cooling schedule
* @param _comp a solution vs neighbor comparator
* @param _cont an external continuator
*/
moSA(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moCoolingSchedule<EOT>& _cool, moSolNeighborComparator<Neighbor>& _comp, moContinuator<Neighbor>& _cont):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
defaultCool(0, 0, 0, 0),
explorer(_neighborhood, _eval, _comp, _cool)
{}
private:
moTrueContinuator<Neighbor> trueCont;
moSimpleCoolingSchedule<EOT> defaultCool;
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
moSAexplorer<Neighbor> explorer;
};
#endif

104
mo/src/algo/moSimpleHC.h Normal file
View file

@ -0,0 +1,104 @@
/*
<moSimpleHC.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moSimpleHC_h
#define _moSimpleHC_h
#include <algo/moLocalSearch.h>
#include <explorer/moSimpleHCexplorer.h>
#include <continuator/moTrueContinuator.h>
#include <eval/moEval.h>
#include <eoEvalFunc.h>
/**
* Simple HC:
* Hill-Climbing local search
*
* At each iteration,
* the first best solution in the neighborhood is selected
* if the selected neighbor have higher fitness than the current solution
* then the solution is replaced by the selected neighbor
* the algorithm stops when there is no higher neighbor
*/
template<class Neighbor>
class moSimpleHC: public moLocalSearch<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<Neighbor> Neighborhood ;
/**
* Simple constructor for a hill-climber
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
*/
moSimpleHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval):
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp)
{}
/**
* Simple constructor for a hill-climber
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _cont an external continuator
*/
moSimpleHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp)
{}
/**
* Simple constructor for a hill-climber
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _cont an external continuator
* @param _compN a neighbor vs neighbor comparator
* @param _compSN a solution vs neighbor comparator
*/
moSimpleHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont, moNeighborComparator<Neighbor>& _compN, moSolNeighborComparator<Neighbor>& _compSN):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_neighborhood, _eval, _compN, _compSN)
{}
private:
// always true continuator
moTrueContinuator<Neighbor> trueCont;
// compare the fitness values of neighbors
moNeighborComparator<Neighbor> defaultNeighborComp;
// compare the fitness values of the solution and the neighbor
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
// the explorer of the simple HC
moSimpleHCexplorer<Neighbor> explorer;
};
#endif

164
mo/src/algo/moTS.h Normal file
View file

@ -0,0 +1,164 @@
/*
<moTS.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moTS_h
#define _moTS_h
#include <algo/moLocalSearch.h>
#include <explorer/moTSexplorer.h>
#include <memory/moNeighborVectorTabuList.h>
#include <memory/moIntensification.h>
#include <memory/moDummyIntensification.h>
#include <memory/moDiversification.h>
#include <memory/moDummyDiversification.h>
#include <memory/moAspiration.h>
#include <memory/moBestImprAspiration.h>
#include <continuator/moTimeContinuator.h>
#include <eval/moEval.h>
#include <eoEvalFunc.h>
/**
* Tabu Search
*/
template<class Neighbor>
class moTS: public moLocalSearch<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<Neighbor> Neighborhood ;
/**
* Basic constructor for a tabu search
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _time the time limit for stopping criteria
* @param _tabuListSize the size of the tabu list
*/
moTS(Neighborhood& _neighborhood,
eoEvalFunc<EOT>& _fullEval,
moEval<Neighbor>& _eval,
unsigned int _time,
unsigned int _tabuListSize
):
moLocalSearch<Neighbor>(explorer, timeCont, _fullEval),
timeCont(_time),
tabuList(_tabuListSize,0),
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, tabuList, dummyIntensification, dummyDiversification, defaultAspiration)
{}
/**
* Simple constructor for a tabu search
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _time the time limit for stopping criteria
* @param _tabuList the tabu list
*/
moTS(Neighborhood& _neighborhood,
eoEvalFunc<EOT>& _fullEval,
moEval<Neighbor>& _eval,
unsigned int _time,
moTabuList<Neighbor>& _tabuList):
moLocalSearch<Neighbor>(explorer, timeCont, _fullEval),
timeCont(_time),
tabuList(0,0),
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _tabuList, dummyIntensification, dummyDiversification, defaultAspiration)
{}
/**
* General constructor for a tabu search
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _cont an external continuator
* @param _tabuList the tabu list
* @param _aspiration the aspiration Criteria
*/
moTS(Neighborhood& _neighborhood,
eoEvalFunc<EOT>& _fullEval,
moEval<Neighbor>& _eval,
moContinuator<Neighbor>& _cont,
moTabuList<Neighbor>& _tabuList,
moAspiration<Neighbor>& _aspiration):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
timeCont(0),
tabuList(0,0),
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _tabuList, dummyIntensification, dummyDiversification, _aspiration)
{}
/**
* General constructor for a tabu search
* @param _neighborhood the neighborhood
* @param _fullEval the full evaluation function
* @param _eval neighbor's evaluation function
* @param _neighborComp a comparator between 2 neighbors
* @param _solNeighborComp a solution vs neighbor comparator
* @param _cont an external continuator
* @param _tabuList the tabu list
* @param _intensification the intensification strategy
* @param _diversification the diversification strategy
* @param _aspiration the aspiration Criteria
*/
moTS(Neighborhood& _neighborhood,
eoEvalFunc<EOT>& _fullEval,
moEval<Neighbor>& _eval,
moNeighborComparator<Neighbor>& _neighborComp,
moSolNeighborComparator<Neighbor>& _solNeighborComp,
moContinuator<Neighbor>& _cont,
moTabuList<Neighbor>& _tabuList,
moIntensification<Neighbor>& _intensification,
moDiversification<Neighbor>& _diversification,
moAspiration<Neighbor>& _aspiration):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
timeCont(0),
tabuList(0,0),
explorer(_neighborhood, _eval, _neighborComp, _solNeighborComp, _tabuList, _intensification, _diversification, _aspiration)
{}
/*
* To get the explorer and then to be abble to get the best solution so far
* @return the TS explorer
*/
moTSexplorer<Neighbor>& getExplorer() {
return explorer;
}
private:
moTimeContinuator<Neighbor> timeCont;
moNeighborComparator<Neighbor> defaultNeighborComp;
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
moNeighborVectorTabuList<Neighbor> tabuList;
moDummyIntensification<Neighbor> dummyIntensification;
moDummyDiversification<Neighbor> dummyDiversification;
moBestImprAspiration<Neighbor> defaultAspiration;
moTSexplorer<Neighbor> explorer;
};
#endif

75
mo/src/algo/moVNS.h Normal file
View file

@ -0,0 +1,75 @@
/*
<moVNS.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moVNS_h
#define _moVNS_h
#include <algo/moLocalSearch.h>
#include <eoOp.h>
#include <comparator/moSolComparator.h>
#include <continuator/moContinuator.h>
#include <explorer/moVNSexplorer.h>
#include <neighborhood/moVariableNeighborhoodSelection.h>
#include <acceptCrit/moAcceptanceCriterion.h>
/**
* the "Variable Neighborhood Search" metaheuristic
*/
template<class Neighbor>
class moVNS: public moLocalSearch< Neighbor >
{
public:
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<Neighbor> Neighborhood ;
/**
* full constructor for a VNS
* @param _selection selection the "neighborhood" search heuristics during the search
* @param _acceptCrit acceptance criteria which compare and accept or not the two solutions
* @param _fullEval the full evaluation function
* @param _cont an external continuator
*/
moVNS(moVariableNeighborhoodSelection<EOT> & _selection,
moAcceptanceCriterion<Neighbor>& _acceptCrit,
eoEvalFunc<EOT>& _fullEval,
moContinuator<Neighbor>& _cont) :
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_selection, _acceptCrit)
{}
private:
// the explorer of the VNS
moVNSexplorer<Neighbor> explorer;
};
#endif