Add a parameter restartCounter to the constructor of moNeighborEvalContinuator

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1893 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
verel 2010-07-28 09:06:32 +00:00
commit 47ccef8ab5

View file

@ -37,7 +37,9 @@ Contact: paradiseo-help@lists.gforge.inria.fr
/** /**
* Continue until a maximum fixed number of neighbor evaluation is reached * Continue until a maximum fixed number of neighbor evaluation is reached
* *
* Becareful 1: The number of neighbor evaluations (for example incremental evaluations) considered is within the local search (not before it) *
* Becareful 1: if restartCounter is true, then the number of neighbor evaluations (for example incremental 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 neighbor evaluation function to count * @param _eval neighbor evaluation function to count
* @param _maxNeighborEval number maximum of iterations * @param _maxNeighborEval 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
*/ */
moNeighborEvalContinuator(moEvalCounter<Neighbor> & _eval, unsigned int _maxNeighborEval): eval(_eval), maxNeighborEval(_maxNeighborEval) {} moNeighborEvalContinuator(moEvalCounter<Neighbor> & _eval, unsigned int _maxNeighborEval, bool _restartCounter = true): eval(_eval), maxNeighborEval(_maxNeighborEval), restartCounter(_restartCounter) {}
/** /**
* Test if continue * Test if continue
@ -67,7 +70,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;
} }
/** /**
@ -79,9 +85,10 @@ public:
} }
private: private:
moEvalCounter<Neighbor> & eval; moEvalCounter<Neighbor> & eval;
unsigned int maxNeighborEval; unsigned int maxNeighborEval;
unsigned int nbEval_start ; bool restartCounter;
unsigned int nbEval_start ;
}; };
#endif #endif