add reinit flag in the constructor and the init

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1997 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
marieeleonore 2010-11-08 16:07:55 +00:00
commit 56b69b80e0

View file

@ -48,8 +48,9 @@ public :
/**
* Default Constructor
* @param _reInitSol when true the best so far is reinitialized
*/
moBestSoFarStat(): moStat<EOT, EOT>(EOT(), "best") {
moBestSoFarStat(bool _reInitSol = true): moStat<EOT, EOT>(EOT(), "best"), reInitSol(_reInitSol), firstTime(true) {
}
/**
@ -57,7 +58,13 @@ public :
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
value() = _sol;
if (reInitSol)
value() = _sol;
else if (firstTime)
{
value() = _sol;
firstTime = false;
}
}
/**
@ -66,7 +73,9 @@ public :
*/
virtual void operator()(EOT & _sol) {
if (value().fitness() < _sol.fitness())
{
value() = _sol;
}
}
/**
@ -76,6 +85,10 @@ public :
return "moBestSoFarStat";
}
protected:
bool reInitSol;
bool firstTime;
};
#endif