From b76cc09bb737d40ae7d2fbf91b10ed4d1b90b3c9 Mon Sep 17 00:00:00 2001 From: verel Date: Wed, 28 Jul 2010 09:30:37 +0000 Subject: [PATCH] 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 --- .../src/continuator/moFullEvalContinuator.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/trunk/paradiseo-mo/src/continuator/moFullEvalContinuator.h b/trunk/paradiseo-mo/src/continuator/moFullEvalContinuator.h index 9f0014812..bdcf82360 100644 --- a/trunk/paradiseo-mo/src/continuator/moFullEvalContinuator.h +++ b/trunk/paradiseo-mo/src/continuator/moFullEvalContinuator.h @@ -37,7 +37,9 @@ Contact: paradiseo-help@lists.gforge.inria.fr /** * 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 */ template< class Neighbor > @@ -50,8 +52,9 @@ public: * Constructor * @param _eval evaluation function to count * @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 & _eval, unsigned int _maxFullEval): eval(_eval), maxFullEval(_maxFullEval) { + moFullEvalContinuator(eoEvalFuncCounter & _eval, unsigned int _maxFullEval, bool _restartCounter = true): eval(_eval), maxFullEval(_maxFullEval), restartCounter(_restartCounter) { nbEval_start = eval.value(); } @@ -69,7 +72,10 @@ public: * @param _solution a solution */ virtual void init(EOT & _solution) { + if (restartCounter) nbEval_start = eval.value(); + else + nbEval_start = 0; } /** @@ -81,9 +87,10 @@ public: } private: - eoEvalFuncCounter & eval; - unsigned int nbEval_start ; - unsigned int maxFullEval ; + eoEvalFuncCounter & eval; + unsigned int nbEval_start ; + bool restartCounter; + unsigned int maxFullEval ; }; #endif