diff --git a/eo/tutorial/html/SecondBitEA.html b/eo/tutorial/html/SecondBitEA.html index e5fa3868e..8090e42a8 100644 --- a/eo/tutorial/html/SecondBitEA.html +++ b/eo/tutorial/html/SecondBitEA.html @@ -47,15 +47,13 @@ istrstream
#include <fstream>
// the general include for eo
#include <eo> -
// specific includes -
#include "eoSGATransform.h" -
#include "eoPropCombinedOp.h" - +
#include "binary_value.h"// a simple fitness function that computes the number of ones of a bitstring
+#include "binary_value.h"
@@ -76,14 +74,14 @@ parameters as constants, read them: or -o=value)
//        or in a parameter file (same syntax, order independent,  -
//                                                        +
//                                    # = usual comment character 
//        or in the environment (TODO)
// note that the parameters are passed by reference so they can be updated -
void read_param(int argc, char *argv[],  -
uint32 & +
void read_param(eoParser & _parser,  +
uint32 & _seed,
unsigned int & _vecSize,
unsigned int & _popSize, @@ -102,104 +100,100 @@ _seed
,

double & _oneBitRate
)
-
// define a -parser from the command-line arguments -
     eoParser parser(argc, -argv);
     // For each parameter, define Parameters directly in the parser, 
     // and assign the value to the variable
    -eoValueParam<uint32>& seedParam = parser.createParam<uint32>(time(0), +eoValueParam<uint32>& seedParam = _parser.createParam<uint32>(time(0), "seed", "Random number seed", 'S');
     _seed = seedParam.value();

     eoValueParam<unsigned -int>& vecSizeParam = parser.createParam<unsigned int>(8, "vecSize", +int>& vecSizeParam = _parser.createParam<unsigned int>(8, "vecSize", "Genotype size",'V', "Representation");
     _vecSize = vecSizeParam.value();

     eoValueParam<unsigned -int>& popSizeParam = parser.createParam<unsigned int>(10, "popSize", +int>& popSizeParam = _parser.createParam<unsigned int>(10, "popSize", "Population size",'P', "Evolution");
     _popSize = popSizeParam.value();
     eoValueParam<unsigned -int>& tSizeParam = parser.createParam<unsigned int>(10, "tSize", +int>& tSizeParam = _parser.createParam<unsigned int>(10, "tSize", "Tournament size",'T', "Evolution");
     _tSize = tSizeParam.value();

    eoValueParam<string>& -load_nameParam = parser.createParam<string>("", "Load","A save file +load_nameParam = _parser.createParam<string>("", "Load","A save file to restart from",'L', "Persistence");
     _load_name = load_nameParam.value();

     eoValueParam<unsigned -int>& maxGenParam = parser.createParam<unsigned int>(100, "maxGen", +int>& maxGenParam = _parser.createParam<unsigned int>(100, "maxGen", "Maximum number of generations",'G', "Stopping criterion");
     _maxGen = maxGenParam.value();
     eoValueParam<unsigned -int>& minGenParam = parser.createParam<unsigned int>(100, "minGen", +int>& minGenParam = _parser.createParam<unsigned int>(100, "minGen", "Minimum number of generations",'g', "Stopping criterion");
     _minGen = minGenParam.value();
     eoValueParam<unsigned -int>& steadyGenParam = parser.createParam<unsigned int>(100, "steadyGen", +int>& steadyGenParam = _parser.createParam<unsigned int>(100, "steadyGen", "Number of generations with no improvement",'s', "Stopping criterion");
     _steadyGen = steadyGenParam.value();

     eoValueParam<double>& -pCrossParam = parser.createParam<double>(0.6, "pCross", "Probability +pCrossParam = _parser.createParam<double>(0.6, "pCross", "Probability of Crossover", 'C', "Genetic Operators"); 
     _pCross = pCrossParam.value();
     eoValueParam<double>& -pMutParam = parser.createParam<double>(0.1, "pMut", "Probability of +pMutParam = _parser.createParam<double>(0.1, "pMut", "Probability of Mutation", 'M', "Genetic Operators");
     _pMut = pMutParam.value();
     eoValueParam<double>& -onePointRateParam = parser.createParam<double>(1, "onePointRate", "Relative +onePointRateParam = _parser.createParam<double>(1, "onePointRate", "Relative rate for one point crossover", '1', "Genetic Operators");
     _onePointRate = onePointRateParam.value();
     eoValueParam<double>& -twoPointsRateParam = parser.createParam<double>(1, "twoPointRate", "Relative +twoPointsRateParam = _parser.createParam<double>(1, "twoPointRate", "Relative rate for two point crossover", '2', "Genetic Operators");
     _twoPointsRate = twoPointsRateParam.value();
     eoValueParam<double>& -uRateParam = parser.createParam<double>(2, "uRate", "Relative rate for +uRateParam = _parser.createParam<double>(2, "uRate", "Relative rate for uniform crossover", 'U', "Genetic Operators");
     _uRate =  uRateParam.value();
     eoValueParam<double>& -pMutPerBitParam = parser.createParam<double>(0.01, "pMutPerBit", "Probability +pMutPerBitParam = _parser.createParam<double>(0.01, "pMutPerBit", "Probability of flipping 1 bit in bit-flip mutation", 'b', "Genetic Operators");
     _pMutPerBit = pMutPerBitParam.value();
     eoValueParam<double>& -bitFlipRateParam = parser.createParam<double>(0.01, "bitFlipRate", "Relative +bitFlipRateParam = _parser.createParam<double>(0.01, "bitFlipRate", "Relative rate for bit-flip mutation", 'B', "Genetic Operators");
     _bitFlipRate =  bitFlipRateParam.value();
     eoValueParam<double>& -oneBitRateParam = parser.createParam<double>(0.01, "oneBitRate", "Relative +oneBitRateParam = _parser.createParam<double>(0.01, "oneBitRate", "Relative rate for deterministic bit-flip mutation", 'D', "Genetic Operators");
         _oneBitRate = oneBitRateParam.value();

     // the name of the "status" file where all actual parameter values will be saved
     string str_status -= parser.ProgramName() + ".status"; += _parser.ProgramName() + ".status";

     eoValueParam<string>& -status_nameParam = parser.createParam<string>(str_status.c_str(), "status","Status +status_nameParam = _parser.createParam<string>(str_status.c_str(), "status","Status file",'S', "Persistence");
   // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
   // i.e. in case you need parameters somewhere else, postpone these -
     if (parser.userNeedsHelp()) +
     if (_parser.userNeedsHelp())
         {
             -parser.printHelp(cout); +_parser.printHelp(cout);
             exit(1);
         @@ -209,7 +203,7 @@ exit(1);
         {
ofstream os(status_nameParam.value().c_str()); -
os << parser; // and you can +
os << _parser; // and you can use that file as parameter file
         } @@ -254,6 +248,10 @@ parameters for mutations;

   double pMutPerBit;
   double bitFlipRate;
   double oneBitRate; +
   // define a +parser from the command-line arguments +
     eoParser parser(argc, +argv);
   // Now read the parameters of the program
     read_param(argc, @@ -521,10 +519,10 @@ of item the eoCheckpoint can handle: state savers:
     eoState outState;
     // Register -the algorithm into the state (so it has something to save!!) -
     -outState.registerObject(rng); +the algorithm into the state +
     outState.registerObject(parser);
     outState.registerObject(pop); +
     outState.registerObject(rng);
     // and feed the state to state savers