Passage du code dans un pretty printer
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1813 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
cc31901008
commit
3d8057ac4d
88 changed files with 2726 additions and 2720 deletions
|
|
@ -36,36 +36,36 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
|
||||
/**
|
||||
* 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 ;
|
||||
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";
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
// the explorer of the simple HC
|
||||
moDummyExplorer<Neighbor> explorer;
|
||||
// always true continuator
|
||||
moTrueContinuator<Neighbor> trueCont;
|
||||
// the explorer of the simple HC
|
||||
moDummyExplorer<Neighbor> explorer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
/**
|
||||
* First improvement HC:
|
||||
* Hill-Climber 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
|
||||
|
|
@ -50,55 +50,55 @@ template<class Neighbor>
|
|||
class moFirstImprHC: public moLocalSearch<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
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)
|
||||
{}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{}
|
||||
|
||||
private:
|
||||
// always true continuator
|
||||
moTrueContinuator<Neighbor> trueCont;
|
||||
// compare the fitness values of neighbors: true is 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;
|
||||
// always true continuator
|
||||
moTrueContinuator<Neighbor> trueCont;
|
||||
// compare the fitness values of neighbors: true is 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
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class moILS: public moLocalSearch<moDummyNeighbor<typename Neighbor::EOT> >
|
|||
{
|
||||
public:
|
||||
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
|
||||
/**
|
||||
|
|
@ -59,12 +59,12 @@ public:
|
|||
* @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)
|
||||
{}
|
||||
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
|
||||
|
|
@ -73,12 +73,12 @@ public:
|
|||
* @param _op the operator used to perturb solution
|
||||
* @param _cont a continuator
|
||||
*/
|
||||
moILS(moLocalSearch<Neighbor>& _ls, eoEvalFunc<EOT>& _fullEval, eoMonOp<EOT>& _op, moContinuator<moDummyNeighbor<EOT> >& _cont):
|
||||
moLocalSearch<moDummyNeighbor<EOT> >(explorer, _cont, _fullEval),
|
||||
iterCont(0),
|
||||
defaultPerturb(_op, _fullEval),
|
||||
explorer(_ls, defaultPerturb, defaultAccept)
|
||||
{}
|
||||
moILS(moLocalSearch<Neighbor>& _ls, eoEvalFunc<EOT>& _fullEval, eoMonOp<EOT>& _op, moContinuator<moDummyNeighbor<EOT> >& _cont):
|
||||
moLocalSearch<moDummyNeighbor<EOT> >(explorer, _cont, _fullEval),
|
||||
iterCont(0),
|
||||
defaultPerturb(_op, _fullEval),
|
||||
explorer(_ls, defaultPerturb, defaultAccept)
|
||||
{}
|
||||
|
||||
/**
|
||||
* General constructor for Iterated Local Search
|
||||
|
|
@ -88,23 +88,25 @@ public:
|
|||
* @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):
|
||||
moLocalSearch<moDummyNeighbor<EOT> >(explorer, _cont, _fullEval),
|
||||
iterCont(0),
|
||||
defaultPerturb(dummyOp, _fullEval),
|
||||
explorer(_ls, _perturb, _accept)
|
||||
{}
|
||||
moILS(moLocalSearch<Neighbor>& _ls, eoEvalFunc<EOT>& _fullEval, moContinuator<moDummyNeighbor<EOT> >& _cont, moMonOpPerturb<Neighbor>& _perturb, moAcceptanceCriterion<Neighbor>& _accept):
|
||||
moLocalSearch<moDummyNeighbor<EOT> >(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> explorer;
|
||||
class dummmyMonOp: public eoMonOp<EOT> {
|
||||
public:
|
||||
bool operator()(EOT&) {
|
||||
return false;
|
||||
}
|
||||
}dummyOp;
|
||||
moIterContinuator<moDummyNeighbor<EOT> > iterCont;
|
||||
moMonOpPerturb<Neighbor> defaultPerturb;
|
||||
moAlwaysAcceptCrit<Neighbor> defaultAccept;
|
||||
moILSexplorer<Neighbor> explorer;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ template<class Neighbor>
|
|||
class moLocalSearch: public eoMonOp<typename Neighbor::EOT>
|
||||
{
|
||||
public:
|
||||
typedef moNeighborhood<Neighbor> Neighborhood;
|
||||
typedef moNeighborhoodExplorer<Neighbor> NeighborhoodExplorer;
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood;
|
||||
typedef moNeighborhoodExplorer<Neighbor> NeighborhoodExplorer;
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
/**
|
||||
* Constructor of a moLocalSearch
|
||||
|
|
@ -101,23 +101,23 @@ public:
|
|||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set an external continuator
|
||||
* @param _cont the external continuator
|
||||
*/
|
||||
void setContinuator(moContinuator<Neighbor> & _cont) {
|
||||
cont = &_cont ;
|
||||
}
|
||||
void setContinuator(moContinuator<Neighbor> & _cont) {
|
||||
cont = &_cont ;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* external continuator object
|
||||
*
|
||||
*
|
||||
* @overload
|
||||
* @return the external continuator
|
||||
* @return the external continuator
|
||||
*/
|
||||
moContinuator<Neighbor>* getContinuator() const {
|
||||
return cont ;
|
||||
}
|
||||
moContinuator<Neighbor>* getContinuator() const {
|
||||
return cont ;
|
||||
}
|
||||
|
||||
protected:
|
||||
// make the exploration of the neighborhood according to a local search heuristic
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
* 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
|
||||
|
|
@ -53,58 +53,58 @@ template<class Neighbor>
|
|||
class moMetropolisHasting: public moLocalSearch<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
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)
|
||||
{}
|
||||
|
||||
/**
|
||||
* 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: true is 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 HC with neutral move (equals fitness move)
|
||||
moMetropolisHastingExplorer<Neighbor> explorer;
|
||||
// always true continuator
|
||||
moTrueContinuator<Neighbor> trueCont;
|
||||
// compare the fitness values of neighbors: true is 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 HC with neutral move (equals fitness move)
|
||||
moMetropolisHastingExplorer<Neighbor> explorer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -49,58 +49,58 @@ template<class Neighbor>
|
|||
class moNeutralHC: public moLocalSearch<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
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)
|
||||
{}
|
||||
|
||||
/**
|
||||
* 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: true is 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 HC with neutral move (equals fitness move)
|
||||
moNeutralHCexplorer<Neighbor> explorer;
|
||||
// always true continuator
|
||||
moTrueContinuator<Neighbor> trueCont;
|
||||
// compare the fitness values of neighbors: true is 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 HC with neutral move (equals fitness move)
|
||||
moNeutralHCexplorer<Neighbor> explorer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
/**
|
||||
* Random Best HC:
|
||||
* Hill-Climber 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
|
||||
|
|
@ -50,55 +50,55 @@ template<class Neighbor>
|
|||
class moRandomBestHC: public moLocalSearch<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
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)
|
||||
{}
|
||||
|
||||
/**
|
||||
* 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: true is 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 HC with random choice of the best solution
|
||||
moRandomBestHCexplorer<Neighbor> explorer;
|
||||
// always true continuator
|
||||
moTrueContinuator<Neighbor> trueCont;
|
||||
// compare the fitness values of neighbors: true is 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 HC with random choice of the best solution
|
||||
moRandomBestHCexplorer<Neighbor> explorer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
/**
|
||||
* 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
|
||||
|
|
@ -48,55 +48,55 @@ template<class Neighbor>
|
|||
class moRandomNeutralWalk: public moLocalSearch<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
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)
|
||||
{}
|
||||
|
||||
/**
|
||||
* 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: true if strictly greater
|
||||
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
|
||||
// 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: true if strictly greater
|
||||
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
/**
|
||||
* 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
|
||||
|
|
@ -48,43 +48,43 @@ template<class Neighbor>
|
|||
class moRandomSearch: public moLocalSearch<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
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";
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
// always true continuator
|
||||
moTrueContinuator<Neighbor> trueCont;
|
||||
// the explorer of the random walk
|
||||
moRandomSearchExplorer<Neighbor> explorer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
/**
|
||||
* 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
|
||||
|
|
@ -48,39 +48,39 @@ template<class Neighbor>
|
|||
class moRandomWalk: public moLocalSearch<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
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, trueCont, _fullEval),
|
||||
explorer(_neighborhood, _eval, _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
|
||||
*/
|
||||
moRandomWalk(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned _nbStepMax, moContinuator<Neighbor>& _cont):
|
||||
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||
explorer(_neighborhood, _eval, _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
|
||||
*/
|
||||
moRandomWalk(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned _nbStepMax):
|
||||
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
|
||||
explorer(_neighborhood, _eval, _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
|
||||
*/
|
||||
moRandomWalk(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned _nbStepMax, moContinuator<Neighbor>& _cont):
|
||||
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||
explorer(_neighborhood, _eval, _nbStepMax)
|
||||
{}
|
||||
|
||||
private:
|
||||
// always true continuator
|
||||
moTrueContinuator<Neighbor> trueCont;
|
||||
// the explorer of the random walk
|
||||
moRandomWalkExplorer<Neighbor> explorer;
|
||||
// always true continuator
|
||||
moTrueContinuator<Neighbor> trueCont;
|
||||
// the explorer of the random walk
|
||||
moRandomWalkExplorer<Neighbor> explorer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class moSA: public moLocalSearch<Neighbor>
|
|||
{
|
||||
public:
|
||||
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
|
||||
|
||||
|
|
@ -60,11 +60,11 @@ public:
|
|||
* @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)
|
||||
{}
|
||||
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
|
||||
|
|
@ -73,11 +73,11 @@ public:
|
|||
* @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)
|
||||
{}
|
||||
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
|
||||
|
|
@ -88,19 +88,19 @@ public:
|
|||
* @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)
|
||||
{}
|
||||
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;
|
||||
moTrueContinuator<Neighbor> trueCont;
|
||||
moSimpleCoolingSchedule<EOT> defaultCool;
|
||||
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
|
||||
moSAexplorer<Neighbor> explorer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
/**
|
||||
* Simple HC:
|
||||
* Hill-Climber 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
|
||||
|
|
@ -50,55 +50,55 @@ template<class Neighbor>
|
|||
class moSimpleHC: public moLocalSearch<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
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)
|
||||
{}
|
||||
|
||||
/**
|
||||
* 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: true is 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 simple HC
|
||||
moSimpleHCexplorer<Neighbor> explorer;
|
||||
// always true continuator
|
||||
moTrueContinuator<Neighbor> trueCont;
|
||||
// compare the fitness values of neighbors: true is 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 simple HC
|
||||
moSimpleHCexplorer<Neighbor> explorer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class moTS: public moLocalSearch<Neighbor>
|
|||
{
|
||||
public:
|
||||
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
|
||||
/**
|
||||
|
|
@ -62,17 +62,17 @@ public:
|
|||
* @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)
|
||||
{}
|
||||
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
|
||||
|
|
@ -82,16 +82,16 @@ public:
|
|||
* @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)
|
||||
{}
|
||||
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
|
||||
|
|
@ -106,31 +106,31 @@ public:
|
|||
* @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)
|
||||
{}
|
||||
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)
|
||||
{}
|
||||
|
||||
|
||||
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;
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue