Add a parameter restartCounter to the constructor of moFullEvalContinuator

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1894 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
verel 2010-07-28 09:30:37 +00:00
commit b76cc09bb7

View file

@ -37,7 +37,9 @@ Contact: paradiseo-help@lists.gforge.inria.fr
/** /**
* Continue until a maximum fixed number of full evaluation is reached * Continue until a maximum fixed number of full evaluation is reached
* *
* Becareful 1: The number of full evaluations considered is within the local search (not before it) *
* Becareful 1: if restartCounter is true, then the number of full evaluations is considered during the local search (not before it)
*
* Becareful 2: Can not be used if the evaluation function is used in parallel * Becareful 2: Can not be used if the evaluation function is used in parallel
*/ */
template< class Neighbor > template< class Neighbor >
@ -50,8 +52,9 @@ public:
* Constructor * Constructor
* @param _eval evaluation function to count * @param _eval evaluation function to count
* @param _maxFullEval number maximum of iterations * @param _maxFullEval number maximum of iterations
* @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative
*/ */
moFullEvalContinuator(eoEvalFuncCounter<EOT> & _eval, unsigned int _maxFullEval): eval(_eval), maxFullEval(_maxFullEval) { moFullEvalContinuator(eoEvalFuncCounter<EOT> & _eval, unsigned int _maxFullEval, bool _restartCounter = true): eval(_eval), maxFullEval(_maxFullEval), restartCounter(_restartCounter) {
nbEval_start = eval.value(); nbEval_start = eval.value();
} }
@ -69,7 +72,10 @@ public:
* @param _solution a solution * @param _solution a solution
*/ */
virtual void init(EOT & _solution) { virtual void init(EOT & _solution) {
if (restartCounter)
nbEval_start = eval.value(); nbEval_start = eval.value();
else
nbEval_start = 0;
} }
/** /**
@ -83,6 +89,7 @@ public:
private: private:
eoEvalFuncCounter<EOT> & eval; eoEvalFuncCounter<EOT> & eval;
unsigned int nbEval_start ; unsigned int nbEval_start ;
bool restartCounter;
unsigned int maxFullEval ; unsigned int maxFullEval ;
}; };