Few cosmetic modifs:
put the #define of some boolean in eoData.h added some include that were missing (unnoticed because of include<eo>) some checks in eoXXXTournamentSelect
This commit is contained in:
parent
51c15ed0b8
commit
e71aea497f
6 changed files with 25 additions and 21 deletions
19
eo/src/eo
19
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 <utils/eoData.h>
|
||||
#include <eoObject.h>
|
||||
#include <eoPrintable.h>
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ template <class EOT> class eoDetTournamentSelect: public eoSelectOne<EOT>
|
|||
eoDetTournamentSelect(unsigned _tSize = 2 ):eoSelectOne<EOT>(), 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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <apply.h>
|
||||
#include <eoAlgo.h>
|
||||
#include <eoContinue.h>
|
||||
#include <eoSelect.h>
|
||||
|
|
|
|||
|
|
@ -46,11 +46,15 @@ template <class EOT> class eoStochTournamentSelect: public eoSelectOne<EOT>
|
|||
///
|
||||
eoStochTournamentSelect(float _Trate = 1.0 ) : eoSelectOne<EOT>(), 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 */
|
||||
|
|
|
|||
|
|
@ -13,4 +13,4 @@
|
|||
#include <utils/eoScalarFitnessStat.h>
|
||||
#include <utils/eoFDCStat.h>
|
||||
#include <utils/eoMOFitnessStat.h>
|
||||
#include <utils/eoPopStat.h>
|
||||
#include <utils/eoPopStat.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
|
||||
|
||||
|
|
|
|||
Reference in a new issue