diff --git a/eo/tutorial/Lesson2/FirstBitEA.cpp b/eo/tutorial/Lesson2/FirstBitEA.cpp index d89e3e28a..99445846d 100644 --- a/eo/tutorial/Lesson2/FirstBitEA.cpp +++ b/eo/tutorial/Lesson2/FirstBitEA.cpp @@ -74,9 +74,9 @@ void main_function(int argc, char **argv) // Initilisation of population //////////////////////////////// - // based on boolean_generator class (see utils/rnd_generator.h) - eoInitFixedLength - random(VEC_SIZE, boolean_generator()); + // based on boolean_generator class (see utils/eoRndGenerators.h) + eoUniformGenerator uGen; + eoInitFixedLength random(VEC_SIZE, uGen); // Initialization of the population eoPop pop(POP_SIZE, random); diff --git a/eo/tutorial/Lesson2/FirstRealEA.cpp b/eo/tutorial/Lesson2/FirstRealEA.cpp index a6f5e8e22..8d64dd3df 100644 --- a/eo/tutorial/Lesson2/FirstRealEA.cpp +++ b/eo/tutorial/Lesson2/FirstRealEA.cpp @@ -75,8 +75,8 @@ void main_function(int argc, char **argv) // Initilisation of population //////////////////////////////// // based on a uniform generator - eoInitFixedLength > - random(VEC_SIZE, uniform_generator(-1.0, 1.0)); + eoUniformGenerator uGen(-1.0, 1.0); + eoInitFixedLength random(VEC_SIZE, uGen); // Initialization of the population eoPop pop(POP_SIZE, random); diff --git a/eo/tutorial/Lesson2/Makefile b/eo/tutorial/Lesson2/Makefile index f25456af7..57c02328d 100644 --- a/eo/tutorial/Lesson2/Makefile +++ b/eo/tutorial/Lesson2/Makefile @@ -12,3 +12,7 @@ all : $(ALL) clean : @/bin/rm $(ALL) *.o *~ + +FirstRealEA : real_value.h + +FirstBitEA : binary_value.h \ No newline at end of file diff --git a/eo/tutorial/Lesson2/exercise2.3.cpp b/eo/tutorial/Lesson2/exercise2.3.cpp index f7832bf0d..b666216c2 100644 --- a/eo/tutorial/Lesson2/exercise2.3.cpp +++ b/eo/tutorial/Lesson2/exercise2.3.cpp @@ -76,8 +76,8 @@ void main_function(int argc, char **argv) //////////////////////////////// // based on boolean_generator class (see utils/rnd_generator.h) - eoInitFixedLength - random(VEC_SIZE, boolean_generator()); + eoUniformGenerator uGen; + eoInitFixedLength random(VEC_SIZE, uGen); // Initialization of the population eoPop pop(POP_SIZE, random); diff --git a/eo/tutorial/Lesson2/real_value.h b/eo/tutorial/Lesson2/real_value.h index c7a57c109..cc32e633f 100644 --- a/eo/tutorial/Lesson2/real_value.h +++ b/eo/tutorial/Lesson2/real_value.h @@ -11,8 +11,6 @@ double real_value(const std::vector& _ind) double sum = 0; for (unsigned i = 0; i < _ind.size(); i++) { - if ( (_ind[i]<0) || (_ind[i]>1) ) - cout << "Sorti des bornes: " << _ind[i] << " "; sum += _ind[i] * _ind[i]; } return -sum; diff --git a/eo/tutorial/Lesson3/SecondBitEA.cpp b/eo/tutorial/Lesson3/SecondBitEA.cpp index b2eda1a56..c8efce2f9 100644 --- a/eo/tutorial/Lesson3/SecondBitEA.cpp +++ b/eo/tutorial/Lesson3/SecondBitEA.cpp @@ -164,8 +164,8 @@ void main_function(int argc, char **argv) rng.reseed(seed); // a Indi random initializer // based on boolean_generator class (see utils/rnd_generator.h) - eoInitFixedLength - random(vecSize, boolean_generator()); + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); // Init pop from the randomizer: need to use the append function pop.append(popSize, random); diff --git a/eo/tutorial/Lesson3/exercise3.1.cpp b/eo/tutorial/Lesson3/exercise3.1.cpp index 0a67413d4..e80b43ede 100644 --- a/eo/tutorial/Lesson3/exercise3.1.cpp +++ b/eo/tutorial/Lesson3/exercise3.1.cpp @@ -165,8 +165,8 @@ void main_function(int argc, char **argv) rng.reseed(seed); // a Indi random initializer // based on boolean_generator class (see utils/rnd_generator.h) - eoInitFixedLength - random(vecSize, boolean_generator()); + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); // Init pop from the randomizer: need to use the append function pop.append(popSize, random); diff --git a/eo/tutorial/html/FirstBitEA.html b/eo/tutorial/html/FirstBitEA.html index 4089c8ff8..8b7e77fac 100644 --- a/eo/tutorial/html/FirstBitEA.html +++ b/eo/tutorial/html/FirstBitEA.html @@ -162,9 +162,9 @@ The actual code is in boldface and the comment in normal face.  ////////////////////////////////
 // Initilisation of population
 ////////////////////////////////
-  // based on boolean_generator class (see utils/rnd_generator.h)
-  eoInitFixedLength<Indi, boolean_generator>
-      random(VEC_SIZE, boolean_generator());
+  // based on eoUniformGenerator class (see utils/eoRndGenerators.h)
+  eoUniformGenerator<bool> uGen;
+  eoInitFixedLength<Indi> random(VEC_SIZE, uGen);
 // Initialization of the population
 eoPop<Indi> pop(POP_SIZE, random);
 // and evaluate it in one line
diff --git a/eo/tutorial/html/SecondBitEA.html b/eo/tutorial/html/SecondBitEA.html index 914f8ec6b..7715369cb 100644 --- a/eo/tutorial/html/SecondBitEA.html +++ b/eo/tutorial/html/SecondBitEA.html @@ -270,11 +270,11 @@ rng.reseed(seed);
       // a Indi random initializer
       // -based on boolean_generator class (see utils/rnd_generator.h) -
         -eoInitFixedLength<Indi, boolean_generator>  -
            -random(vecSize, boolean_generator()); +based on eoUniformGenerator class (see utils/eoRndGenerators.h) +
       eoUniformGenerator<bool> +uGen; +
       eoInitFixedLength<Indi> +random(vecSize, uGen);
       // Init pop from the randomizer: need to use the append function
         @@ -284,7 +284,7 @@ and evaluate pop (STL syntax) 
         apply<Indi>(eval, pop);
     } // end -of initializatio of the population +of initialization of the population @@ -311,7 +311,6 @@ of initializatio of the population  // The robust tournament selection
 eoDetTournamentSelect<Indi> selectOne(tSize);       - // tSize in [2,POPSIZE]
 // is now encapsulated in a eoSelectPerc (entage)