From e71aea497fa62098651452db706e8824971e295a Mon Sep 17 00:00:00 2001 From: evomarc Date: Fri, 13 Apr 2001 08:57:40 +0000 Subject: [PATCH] Few cosmetic modifs: put the #define of some boolean in eoData.h added some include that were missing (unnoticed because of include) some checks in eoXXXTournamentSelect --- eo/src/eo | 19 +------------------ eo/src/eoDetTournamentSelect.h | 2 +- eo/src/eoEasyEA.h | 1 + eo/src/eoStochTournamentSelect.h | 6 +++++- eo/src/utils/checkpointing | 2 +- eo/src/utils/eoData.h | 16 ++++++++++++++++ 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/eo/src/eo b/eo/src/eo index 9e637cbd..3b7c78b6 100644 --- a/eo/src/eo +++ b/eo/src/eo @@ -28,25 +28,8 @@ #ifndef _eo_ #define _eo_ -// some defines to make things easier to get at first sight - -// tunigni the amount of output using a boolean argument: -// true should always mean more output -#define eo_verbose true -#define eo_no_verbose false -// to be used in selection / replacement procedures to indicate whether -// the argument (rate, a double) shoudl be treated as a rate (number=rate*popSize) -// or as an absolute integer (number=rate regardless of popsize). -// the default value shoudl ALWAYS be true (eo_as_a_rate). -// -// this construct is mandatory because in some cases you might not know the -// population size that will enter the replacement for instance - so you -// cannot simply have a pre-computed (double) rate of 1/popSize -#define eo_is_a_rate true -#define eo_is_an_integer false //----------------------------------------------------------------------------- - -// gneral purpose +// general purpose #include #include #include diff --git a/eo/src/eoDetTournamentSelect.h b/eo/src/eoDetTournamentSelect.h index 667577fb..df25ff45 100755 --- a/eo/src/eoDetTournamentSelect.h +++ b/eo/src/eoDetTournamentSelect.h @@ -50,7 +50,7 @@ template class eoDetTournamentSelect: public eoSelectOne eoDetTournamentSelect(unsigned _tSize = 2 ):eoSelectOne(), tSize(_tSize) { // consistency check if (tSize < 2) { - cout << "Warning, Tournament size should be >= 2\nAdjusted\n"; + cout << "Warning, Tournament size should be >= 2\nAdjusted to 2\n"; tSize = 2; } } diff --git a/eo/src/eoEasyEA.h b/eo/src/eoEasyEA.h index a152abfa..d28f62af 100644 --- a/eo/src/eoEasyEA.h +++ b/eo/src/eoEasyEA.h @@ -27,6 +27,7 @@ //----------------------------------------------------------------------------- +#include #include #include #include diff --git a/eo/src/eoStochTournamentSelect.h b/eo/src/eoStochTournamentSelect.h index 0b9989e3..75a8b508 100755 --- a/eo/src/eoStochTournamentSelect.h +++ b/eo/src/eoStochTournamentSelect.h @@ -46,11 +46,15 @@ template class eoStochTournamentSelect: public eoSelectOne /// eoStochTournamentSelect(float _Trate = 1.0 ) : eoSelectOne(), Trate(_Trate) { - // consistency check + // consistency checks if (Trate < 0.5) { cerr << "Warning, Tournament rate should be > 0.5\nAdjusted to 0.55\n"; Trate = 0.55; } + if (Trate > 1) { + cerr << "Warning, Tournament rate should be < 1\nAdjusted to 1\n"; + Trate = 1; + } } /** Perform the stochastic tournament */ diff --git a/eo/src/utils/checkpointing b/eo/src/utils/checkpointing index e570183a..dfa65934 100644 --- a/eo/src/utils/checkpointing +++ b/eo/src/utils/checkpointing @@ -13,4 +13,4 @@ #include #include #include -#include \ No newline at end of file +#include diff --git a/eo/src/utils/eoData.h b/eo/src/utils/eoData.h index 1ba35860..b7327687 100644 --- a/eo/src/utils/eoData.h +++ b/eo/src/utils/eoData.h @@ -59,6 +59,22 @@ using namespace std; #endif //----------------------------------------------------------------------------- +// some defines to make things easier to get at first sight + +// tuning the amount of output using a boolean argument: +// true should always mean more output +#define eo_verbose true +#define eo_no_verbose false +// to be used in selection / replacement procedures to indicate whether +// the argument (rate, a double) shoudl be treated as a rate (number=rate*popSize) +// or as an absolute integer (number=rate regardless of popsize). +// the default value shoudl ALWAYS be true (eo_as_a_rate). +// +// this construct is mandatory because in some cases you might not know the +// population size that will enter the replacement for instance - so you +// cannot simply have a pre-computed (double) rate of 1/popSize +#define eo_is_a_rate true +#define eo_is_an_integer false #endif EODATA_H