diff --git a/trunk/paradiseo-mo/src/continuator/moBestSoFarStat.h b/trunk/paradiseo-mo/src/continuator/moBestSoFarStat.h index 6d1d61878..fa5797139 100644 --- a/trunk/paradiseo-mo/src/continuator/moBestSoFarStat.h +++ b/trunk/paradiseo-mo/src/continuator/moBestSoFarStat.h @@ -48,8 +48,9 @@ public : /** * Default Constructor + * @param _reInitSol when true the best so far is reinitialized */ - moBestSoFarStat(): moStat(EOT(), "best") { + moBestSoFarStat(bool _reInitSol = true): moStat(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