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

@ -24,13 +24,23 @@ void eoTimedStateSaver::operator()(void)
}
}
void eoCountedStateSaver::doItNow(void)
{
ostrstream os;
os << prefix << counter << '.' << extension << ends;
state.save(os.str());
}
void eoCountedStateSaver::operator()(void)
{
if (++counter % interval == 0)
{
ostrstream os;
os << prefix << counter << '.' << extension << ends;
state.save(os.str());
}
};
doItNow();
}
void eoCountedStateSaver::lastCall(void)
{
if (saveOnLastCall)
doItNow();
}