git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1983 331e1502-861f-0410-8da2-ba01fb791d7f

This commit is contained in:
boufaras 2010-11-02 10:42:40 +00:00
commit 261fb95ed1

View file

@ -45,8 +45,7 @@
* the main algorithm of the local search
*/
template<class Neighbor>
class moLocalSearch: public eoMonOp<typename Neighbor::EOT>
{
class moLocalSearch: public eoMonOp<typename Neighbor::EOT> {
public:
typedef moNeighborhood<Neighbor> Neighborhood;
typedef moNeighborhoodExplorer<Neighbor> NeighborhoodExplorer;
@ -58,7 +57,11 @@ public:
* @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) { } ;
moLocalSearch(NeighborhoodExplorer& _searchExpl,
moContinuator<Neighbor> & _cont, eoEvalFunc<EOT>& _fullEval) :
searchExplorer(_searchExpl), cont(&_cont), fullEval(_fullEval) {
}
;
/**
* Run the local search on a solution
@ -76,7 +79,6 @@ public:
cont->init(_solution);
bool b;
do {
// explore the neighborhood of the solution
searchExplorer(_solution);
@ -84,8 +86,7 @@ public:
if (searchExplorer.accept(_solution)) {
searchExplorer.move(_solution);
searchExplorer.moveApplied(true);
}
else
} else
searchExplorer.moveApplied(false);
// update the parameter of the search (for ex. Temperature of the SA)
@ -93,13 +94,13 @@ public:
b = (*cont)(_solution);
}while (b && searchExplorer.isContinue(_solution));
searchExplorer.terminate(_solution);
cont->lastCall(_solution);
return true;
};
}
;
/**
* Set an external continuator