diff --git a/eo/src/do/make_checkpoint.h b/eo/src/do/make_checkpoint.h index f700a519..99aca2bf 100644 --- a/eo/src/do/make_checkpoint.h +++ b/eo/src/do/make_checkpoint.h @@ -9,35 +9,20 @@ // (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2000 /* - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Contact: todos@geneura.ugr.es, http://geneura.ugr.es Marc.Schoenauer@polytechnique.fr @@ -59,14 +44,12 @@ #include #endif +#include + #include - #include // for minimizing_fitness() - #include - #include - #include @@ -83,10 +66,10 @@ bool testDirRes(std::string _dirName, bool _erase); /** - * - * CHANGE (March 2008): now receiving an eoValueParam instead of an eoEvalFuncCounter. This function is just interested - * in the value of the parameter calculated on the evaluation function, not in the actual function itself!! -*/ + * + * CHANGE (March 2008): now receiving an eoValueParam instead of an eoEvalFuncCounter. This function is just interested + * in the value of the parameter calculated on the evaluation function, not in the actual function itself!! +*/ template eoCheckPoint& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValueParam& _eval, eoContinue& _continue) { diff --git a/eo/src/do/make_checkpoint_FDC.h b/eo/src/do/make_checkpoint_FDC.h index d198c9dd..80686c93 100644 --- a/eo/src/do/make_checkpoint_FDC.h +++ b/eo/src/do/make_checkpoint_FDC.h @@ -3,7 +3,7 @@ //----------------------------------------------------------------------------- // make_checkpoint.h // (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2000 -/* +/* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -27,6 +27,8 @@ #ifndef _make_checkpoint_h #define _make_checkpoint_h +#include + #include #include // for minimizing_fitness() #include @@ -56,7 +58,7 @@ eoCheckPoint& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval eoValueParam *generationCounter = new eoValueParam(0, "Gen."); // Create an incrementor (sub-class of eoUpdater). eoIncrementor* increment = new eoIncrementor(generationCounter->value()); - // Add it to the checkpoint, + // Add it to the checkpoint, checkpoint->add(*increment); // and store it in the state _state.storeFunctor(increment); @@ -90,7 +92,7 @@ eoCheckPoint& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval eoValueParam& fileBestParam = _parser.createParam(false, "fileBestStat", "Output bes/avg/std to file", '\0', "Output - Disk"); eoBestFitnessStat *bestStat = NULL; - if ( printBestParam.value() || plotBestParam.value() || fileBestParam.value() ) + if ( printBestParam.value() || plotBestParam.value() || fileBestParam.value() ) // we need the bestStat for at least one of the 3 above { bestStat = new eoBestFitnessStat; @@ -164,11 +166,11 @@ eoCheckPoint& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval // The monitors /////////////// // do we want an eoStdoutMonitor? - bool needStdoutMonitor = printBestParam.value() || printFDCParam.value() + bool needStdoutMonitor = printBestParam.value() || printFDCParam.value() || printPopParam.value() ; - // The Stdout monitor will print parameters to the screen ... - if ( needStdoutMonitor ) + // The Stdout monitor will print parameters to the screen ... + if ( needStdoutMonitor ) { eoStdoutMonitor *monitor = new eoStdoutMonitor(false); _state.storeFunctor(monitor); @@ -192,7 +194,7 @@ eoCheckPoint& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval } // first handle the dir test - if we need at least one file - if ( ( fileBestParam.value() || plotBestParam.value() || + if ( ( fileBestParam.value() || plotBestParam.value() || plotFDCParam.value() || plotHistogramParam.value() ) && !dirOK ) // just in case we add something before dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE @@ -207,7 +209,7 @@ eoCheckPoint& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval // and feed with some statistics fileMonitor->add(*generationCounter); fileMonitor->add(_eval); - fileMonitor->add(*bestStat); + fileMonitor->add(*bestStat); fileMonitor->add(*secondStat); } @@ -235,7 +237,7 @@ eoCheckPoint& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval // then to a Gnuplot monitor eoGnuplot1DSnapshot *fdcGnuplot = new eoGnuplot1DSnapshot(*fdcFileSnapshot); _state.storeFunctor(fdcGnuplot); - + // and of course add them to the checkPoint checkpoint->add(*fdcFileSnapshot); checkpoint->add(*fdcGnuplot); @@ -272,12 +274,12 @@ eoCheckPoint& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval unsigned freq = (saveFrequencyParam.value()>0 ? saveFrequencyParam.value() : UINT_MAX ); std::string stmp = dirNameParam.value() + "/generations"; - eoCountedStateSaver *stateSaver1 = new eoCountedStateSaver(freq, _state, stmp); + eoCountedStateSaver *stateSaver1 = new eoCountedStateSaver(freq, _state, stmp); _state.storeFunctor(stateSaver1); checkpoint->add(*stateSaver1); } - // save state every T seconds + // save state every T seconds eoValueParam& saveTimeIntervalParam = _parser.createParam(unsigned(0), "saveTimeInterval", "Save every T seconds (0 or absent = never)", '\0',"Persistence" ); if (_parser.isItThere(saveTimeIntervalParam) && saveTimeIntervalParam.value()>0) { @@ -286,7 +288,7 @@ eoCheckPoint& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE std::string stmp = dirNameParam.value() + "/time"; - eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp); + eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp); _state.storeFunctor(stateSaver2); checkpoint->add(*stateSaver2); } diff --git a/eo/src/do/make_checkpoint_assembled.h b/eo/src/do/make_checkpoint_assembled.h index 125d46f9..96518f61 100644 --- a/eo/src/do/make_checkpoint_assembled.h +++ b/eo/src/do/make_checkpoint_assembled.h @@ -34,6 +34,7 @@ #include #endif +#include #include #include @@ -147,7 +148,7 @@ eoCheckPoint& do_make_checkpoint_assembled(eoParser& _parser, eoState& _sta eoScalarFitnessStat *fitStat = new eoScalarFitnessStat; _state.storeFunctor(fitStat); checkpoint->add(*fitStat); -#ifdef HAVE_GNUPLOT +#ifdef HAVE_GNUPLOT // a gnuplot-based monitor for snapshots: needs a dir name eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirName); _state.storeFunctor(fitSnapshot); diff --git a/eo/src/do/make_checkpoint_pareto.h b/eo/src/do/make_checkpoint_pareto.h index 715f395a..50b7253e 100644 --- a/eo/src/do/make_checkpoint_pareto.h +++ b/eo/src/do/make_checkpoint_pareto.h @@ -27,7 +27,8 @@ #ifndef _make_checkpoint_pareto_h #define _make_checkpoint_pareto_h -#include +#include +#include #include #include "EO.h"