Added the time counter in make_checkpoint
This commit is contained in:
parent
a79eb09ea6
commit
32f1c98630
2 changed files with 9 additions and 1 deletions
|
|
@ -51,6 +51,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
|
||||||
//////////////////
|
//////////////////
|
||||||
// is nb Eval to be used as counter?
|
// 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>& 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
|
// Create anyway a generation-counter parameter
|
||||||
eoValueParam<unsigned> *generationCounter = new eoValueParam<unsigned>(0, "Gen.");
|
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);
|
monitor->add(*generationCounter);
|
||||||
if (useEvalParam.value()) // we want nb of evaluations
|
if (useEvalParam.value()) // we want nb of evaluations
|
||||||
monitor->add(_eval);
|
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())
|
if (printBestParam.value())
|
||||||
{
|
{
|
||||||
monitor->add(*bestStat);
|
monitor->add(*bestStat);
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ eoContinue<Indi> & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu
|
||||||
}
|
}
|
||||||
|
|
||||||
// Same thing with Eval - but here default value is 0
|
// 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
|
if (maxEvalParam.value()) // positive: -> define and store
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Reference in a new issue