Encore de la doc

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1660 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jhumeau 2010-01-20 14:49:54 +00:00
commit 9cf5680823
7 changed files with 153 additions and 176 deletions

View file

@ -3,6 +3,7 @@
#include <explorer/moNeighborhoodExplorer.h>
#include <continuator/moContinuator.h>
#include <eoEvalFunc.h>
/**
* the main algorithm of the local search
@ -19,41 +20,47 @@ public:
/**
* Constructor of a moLocalSearch needs a NeighborhooExplorer and a Continuator
*/
moLocalSearch(NeighborhoodExplorer& _searchExpl, Continuator & _continuator) : searchExplorer(_searchExpl), continuator(_continuator) { } ;
moLocalSearch(NeighborhoodExplorer& _searchExpl, Continuator & _continuator, eoEvalFunc<EOT>& _fullEval) : searchExplorer(_searchExpl), continuator(_continuator), 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 external continuator (for example the time, or the number of generations)
continuator.init(_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);
// initialization of the parameter of the search (for example fill empty the tabu list)
searchExplorer.initParam(_solution);
unsigned num = 0;
//A virer par la suite
unsigned int num = 0;
do {
// explore the neighborhood of the solution
searchExplorer(_solution);
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);
// if a solution in the neighborhood can be accepted
if (searchExplorer.accept(_solution))
searchExplorer.move(_solution);
// update the parameter of the search (for ex. Temperature of the SA)
searchExplorer.updateParam(_solution);
// update the parameter of the search (for ex. Temperature of the SA)
searchExplorer.updateParam(_solution);
std::cout << num << " : " << _solution << std::endl ;
num++;
} while (continuator(_solution) && searchExplorer.isContinue(_solution));
//A virer par la suite
std::cout << num << " : " << _solution << std::endl ;
num++;
searchExplorer.terminate(_solution);
}while (continuator(_solution) && searchExplorer.isContinue(_solution));
//A CHANGER
return true;
searchExplorer.terminate(_solution);
//A CHANGER
return true;
};
@ -63,15 +70,10 @@ private:
// external continuator
Continuator& continuator ;
//full evaluation function
eoEvalFunc<EOT>& fullEval;
};
#endif
// Local Variables:
// coding: iso-8859-1
// mode: C++
// c-file-offsets: ((c . 0))
// c-file-style: "Stroustrup"
// fill-column: 80
// End: