Continuator et chekpoint ajoutées :)

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1674 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jhumeau 2010-01-25 15:24:40 +00:00
commit 476a59e1e7
18 changed files with 492 additions and 24 deletions

View file

@ -42,19 +42,19 @@
/**
* the main algorithm of the local search
*/
template< class NHE , class C >
template<class NHE>
class moLocalSearch: public eoMonOp<typename NHE::EOT>
{
public:
typedef NHE NeighborhoodExplorer ;
typedef C Continuator ;
typedef typename NeighborhoodExplorer::EOT EOT ;
typedef typename NeighborhoodExplorer::Neighborhood Neighborhood ;
/**
* Constructor of a moLocalSearch needs a NeighborhooExplorer and a Continuator
*/
moLocalSearch(NeighborhoodExplorer& _searchExpl, Continuator & _continuator, eoEvalFunc<EOT>& _fullEval) : searchExplorer(_searchExpl), continuator(_continuator), fullEval(_fullEval) { } ;
moLocalSearch(NeighborhoodExplorer& _searchExpl, moContinuator<Neighborhood> & _continuator, eoEvalFunc<EOT>& _fullEval) : searchExplorer(_searchExpl), continuator(_continuator), fullEval(_fullEval) { } ;
/**
* Run the local search on a solution
@ -64,15 +64,14 @@ public:
if(_solution.invalid())
fullEval(_solution);
// initialization of the external continuator (for example the time, or the number of generations)
continuator.init(_solution);
// initialization of the parameter of the search (for example fill empty the tabu list)
searchExplorer.initParam(_solution);
//A virer par la suite
unsigned int num = 0;
// initialization of the external continuator (for example the time, or the number of generations)
continuator.init(_solution);
bool b=continuator(_solution);
do{
// explore the neighborhood of the solution
@ -85,14 +84,13 @@ public:
// update the parameter of the search (for ex. Temperature of the SA)
searchExplorer.updateParam(_solution);
//A virer par la suite
std::cout << num << " : " << _solution << std::endl ;
num++;
}while (continuator(_solution) && searchExplorer.isContinue(_solution));
b=continuator(_solution);
}while (b && searchExplorer.isContinue(_solution));
searchExplorer.terminate(_solution);
continuator.lastCall(_solution);
//A CHANGER
return true;
@ -103,7 +101,7 @@ private:
NeighborhoodExplorer& searchExplorer ;
// external continuator
Continuator& continuator ;
moContinuator<Neighborhood>& continuator ;
//full evaluation function
eoEvalFunc<EOT>& fullEval;