Added the lastCall construct: if the stopping condition becomes true in eoCheckPoint,

a method called lastCall is called for everything contained in that checkpoint
      (stats, updaters and monitors). This can be extremely useful
      - for stateSavers (see below)
      - for monitoring things like rates of success of operators, where what you
        are interested in is the final result only.
Added of course a virtual method lastCall that does nothing by default in classes
      eoBaseStat, eoBaseSortedStat, eoUpdater and eoMonitor
Added a boolean to control the save of the state in method eoCountedStateSaver::lastCall
      so you can ask that the state is saved at final population, whatever happens.
      I also added the corresponding constructor to take this into account.
This commit is contained in:
evomarc 2000-12-04 06:58:43 +00:00
commit 0e62de2d14
5 changed files with 63 additions and 14 deletions

View file

@ -73,9 +73,9 @@ bool eoCheckPoint<EOT>::operator()(const eoPop<EOT>& _pop)
{
unsigned i;
vector<const EOT*> sorted_pop;
if (!sorted.empty())
{
vector<const EOT*> sorted_pop;
_pop.sort(sorted_pop);
for (i = 0; i < sorted.size(); ++i)
@ -93,7 +93,27 @@ bool eoCheckPoint<EOT>::operator()(const eoPop<EOT>& _pop)
for (i = 0; i < monitors.size(); ++i)
(*monitors[i])();
return cont(_pop);
bool bContinue = cont(_pop);
if (! bContinue) // we're going to stop: lastCall, gentlemen
{
if (!sorted.empty())
{
for (i = 0; i < sorted.size(); ++i)
{
sorted[i]->lastCall(sorted_pop);
}
}
for (i = 0; i < stats.size(); ++i)
stats[i]->lastCall(_pop);
for (i = 0; i < updaters.size(); ++i)
updaters[i]->lastCall();
for (i = 0; i < monitors.size(); ++i)
monitors[i]->lastCall();
}
return bContinue;
}
#endif