Added the time counter in make_checkpoint

This commit is contained in:
evomarc 2002-03-22 11:01:30 +00:00
commit 32f1c98630
2 changed files with 9 additions and 1 deletions

View file

@ -51,6 +51,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
//////////////////
// is nb Eval to be used as counter?
eoValueParam<bool>& useEvalParam = _parser.createParam(true, "useEval", "Use nb of eval. as counter (vs nb of gen.)", '\0', "Output");
eoValueParam<bool>& useTimeParam = _parser.createParam(true, "useTime", "Display time (s) every generation", '\0', "Output");
// Create anyway a generation-counter parameter
eoValueParam<unsigned> *generationCounter = new eoValueParam<unsigned>(0, "Gen.");
@ -159,6 +160,13 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
monitor->add(*generationCounter);
if (useEvalParam.value()) // we want nb of evaluations
monitor->add(_eval);
if (useTimeParam.value()) // we want time
{
eoTimeCounter * tCounter = new eoTimeCounter;
_state.storeFunctor(tCounter);
checkpoint->add(*tCounter);
monitor->add(*tCounter);
}
if (printBestParam.value())
{
monitor->add(*bestStat);

View file

@ -94,7 +94,7 @@ eoContinue<Indi> & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu
}
// Same thing with Eval - but here default value is 0
eoValueParam<unsigned>& maxEvalParam = _parser.createParam(unsigned(0), "maxEval", "Maximum number of evaluations (0 = none)",'E',"Stopping criterion");
eoValueParam<unsigned long>& maxEvalParam = _parser.createParam((unsigned long)0, "maxEval", "Maximum number of evaluations (0 = none)",'E',"Stopping criterion");
if (maxEvalParam.value()) // positive: -> define and store
{