Correction des continuators, Ajout dans lesson 1
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1765 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
121597c875
commit
d613e38c20
9 changed files with 968 additions and 25 deletions
|
|
@ -36,27 +36,32 @@ 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 2: Can not be used if the evaluation function is used in parallel
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moFullEvalContinuator : public moContinuator<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
* @param _eval evaluation function to count
|
||||
* @param _maxFullEval number maximum of iterations
|
||||
*/
|
||||
moFullEvalContinuator(eoEvalFuncCounter<EOT> & _eval, unsigned int _maxFullEval): maxFullEval(_maxFullEval){}
|
||||
|
||||
moFullEvalContinuator(eoEvalFuncCounter<EOT> & _eval, unsigned int _maxFullEval): eval(_eval), maxFullEval(_maxFullEval) {
|
||||
nbEval_start = eval.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if continue
|
||||
*@param _solution a solution
|
||||
*@return true if number of evaluations < maxFullEval
|
||||
*/
|
||||
virtual bool operator()(EOT & _solution) {
|
||||
return (eval.value() < maxFullEval);
|
||||
return (eval.value() - nbEval_start < maxFullEval);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -64,12 +69,21 @@ public:
|
|||
* @param _solution a solution
|
||||
*/
|
||||
virtual void init(EOT & _solution) {
|
||||
eval.value() = 0;
|
||||
nbEval_start = eval.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* the current number of evaluation from the begining
|
||||
* @return the number of evaluation
|
||||
*/
|
||||
unsigned int value() {
|
||||
return eval.value() - nbEval_start ;
|
||||
}
|
||||
|
||||
private:
|
||||
eoEvalFuncCounter<EOT> & eval;
|
||||
unsigned int maxFullEval;
|
||||
unsigned int nbEval_start ;
|
||||
unsigned int maxFullEval ;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue