From 142c7d779c39943ae426ec61806eec9f0ffae5f8 Mon Sep 17 00:00:00 2001 From: gustavoromero Date: Fri, 1 Dec 2000 15:46:07 +0000 Subject: [PATCH] adding a lot of includes --- eo/app/gprop/gprop.cc | 46 +++++++++++++++++++++++++------------ eo/configure.in | 2 +- eo/src/eoSelectPerc.h | 30 ++++++++++++------------ eo/src/eoStochTournament.h | 7 +++--- eo/src/utils/eoCheckPoint.h | 1 + 5 files changed, 52 insertions(+), 34 deletions(-) diff --git a/eo/app/gprop/gprop.cc b/eo/app/gprop/gprop.cc index 1ba882805..d5fda9d6b 100644 --- a/eo/app/gprop/gprop.cc +++ b/eo/app/gprop/gprop.cc @@ -2,18 +2,21 @@ // gprop //----------------------------------------------------------------------------- -#include // EXIT_SUCCESS EXIT_FAILURE -#include // exception -#include // cerr cout -#include // ifstream -#include // string -#include // eoParser -#include // eoPop -#include // eoGenContinue -#include // eoProportional -#include // eoStochTournament -#include // eoSGA -#include "gprop.h" // Chrom eoChromInit eoChromMutation eoChromXover eoChromEvaluator +#include // EXIT_SUCCESS EXIT_FAILURE +#include // exception +#include // cerr cout +#include // ifstream +#include // string +#include // eoParser +#include // eoPop +#include // eoGenContinue +#include // eoStochTournament +#include // eoSGA +#include // eoGenContinue +#include // eoCheckPoint +#include // eoSecondMomentStats +#include // eoStdoutMonitor +#include "gprop.h" // Chrom eoChromInit eoChromMutation eoChromXover eoChromEvaluator //----------------------------------------------------------------------------- // global variables @@ -120,8 +123,6 @@ void load_file(mlp::set& set, const string& ext) void ga() { - eoGenContinue continuator(generations.value()); - // create population eoInitChrom init; eoPop pop(pop_size.value(), init); @@ -137,13 +138,28 @@ void ga() // genetic operators eoChromMutation mutation(generations); eoChromXover xover; + + // stop condition + eoGenContinue continuator(generations.value()); + + // checkpoint + eoCheckPoint checkpoint(continuator); + + // monitor + eoStdoutMonitor monitor; + checkpoint.add(monitor); + + // statistics + eoSecondMomentStats stats; + checkpoint.add(stats); + monitor.add(stats); // genetic algorithm eoSGA sga(select, xover, xover_rate.value(), mutation, mut_rate.value(), evaluator, - continuator); + checkpoint); cout << pop << endl; diff --git a/eo/configure.in b/eo/configure.in index 0c492c554..c87744d8b 100644 --- a/eo/configure.in +++ b/eo/configure.in @@ -34,5 +34,5 @@ AC_TYPE_SIZE_T dnl Checks for library functions. AC_CHECK_FUNCS(select) -AC_OUTPUT(src/obsolete/Makefile doc/Makefile src/Makefile src/utils/Makefile src/other/Makefile win/Makefile src/gp/Makefile src/es/Makefile src/ga/Makefile test/Makefile contrib/Makefile Makefile app/Makefile app/gprop/Makefile) +AC_OUTPUT(src/obsolete/Makefile doc/Makefile src/Makefile src/utils/Makefile src/other/Makefile win/Makefile src/gp/Makefile src/es/Makefile src/ga/Makefile test/Makefile contrib/Makefile Makefile app/Makefile app/gprop/Makefile app/mastermind/Makefile) diff --git a/eo/src/eoSelectPerc.h b/eo/src/eoSelectPerc.h index 96fc7c6b6..c0991d72b 100644 --- a/eo/src/eoSelectPerc.h +++ b/eo/src/eoSelectPerc.h @@ -52,21 +52,21 @@ class eoSelectPerc : public eoSelect @param _source the source population @param _dest the resulting population (size of this population is the number of times eoSelectOne is called. It empties the destination and adds the selection into it) */ - virtual void operator()(const eoPop& _source, eoPop& _dest) - { - size_t target = static_cast(floor(rate * _source.size())); - - _dest.resize(target); - - select.setup(_source); - - for (size_t i = 0; i < _dest.size(); ++i) - _dest[i] = select(_source); - } - - private : - eoSelectOne& select; - float rate; + virtual void operator()(const eoPop& _source, eoPop& _dest) + { + size_t target = static_cast(floor(rate * _source.size())); + + _dest.resize(target); + + select.setup(_source); + + for (size_t i = 0; i < _dest.size(); ++i) + _dest[i] = select(_source); + } + +private : + eoSelectOne& select; + float rate; }; #endif diff --git a/eo/src/eoStochTournament.h b/eo/src/eoStochTournament.h index 29ec31c00..78a5f1fd1 100644 --- a/eo/src/eoStochTournament.h +++ b/eo/src/eoStochTournament.h @@ -28,9 +28,10 @@ //----------------------------------------------------------------------------- -#include // -#include // accumulate -#include +#include +#include // accumulate +#include // eoSelectOne +#include // stochastic_tournament //----------------------------------------------------------------------------- /** eoStochTournament: a selection method that selects ONE individual by diff --git a/eo/src/utils/eoCheckPoint.h b/eo/src/utils/eoCheckPoint.h index 810735ee5..d2864aeb6 100644 --- a/eo/src/utils/eoCheckPoint.h +++ b/eo/src/utils/eoCheckPoint.h @@ -28,6 +28,7 @@ #define _eoCheckPoint_h #include +#include template class eoStatBase; template class eoSortedStatBase;