Modification of continuator/moBestNoImproveContinuator.h to have strictly improvement

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1955 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
verel 2010-10-13 09:33:16 +00:00
commit 2a6b4b9e9d
2 changed files with 9 additions and 2 deletions

View file

@ -45,6 +45,8 @@ public:
typedef typename Neighbor::EOT EOT ;
/**
* Constructor
*
* @param _bestSol the best solution
* @param _maxNoImprove number maximum of iterations
* @param _solComparator a comparator between solutions
@ -56,6 +58,8 @@ public:
bool _verbose = true): bestSol(_bestSol), maxNoImprove(_maxNoImprove), solComparator(_solComparator), verbose(_verbose) {}
/**
* Constructor where the comparator of solutions is the default comparator
*
* @param _bestSol the best solution
* @param _maxNoImprove number maximum of iterations
* @param _verbose true/false : verbose mode on/off
@ -65,11 +69,14 @@ public:
bool _verbose = true): bestSol(_bestSol), maxNoImprove(_maxNoImprove), solComparator(defaultSolComp), verbose(_verbose) {}
/**
* Count and test the number of non improvement of the best solution
* improvement: if the current solution is STRICTLY better than the current best solution
*
*@param _solution a solution
*@return true if counter < maxNoImprove
*/
virtual bool operator()(EOT & _solution) {
if (solComparator(_solution, bestSol))
if (solComparator(_solution, bestSol) || solComparator.equals(_solution, bestSol))
cpt++;
bool res = (cpt < maxNoImprove);

View file

@ -66,7 +66,7 @@ public:
* @param _solution a solution
*/
virtual void init(EOT & _solution) {
cpt = 0;
cpt = 0;
}
/**