diff --git a/eo/tutorial/html/eoLesson3.html b/eo/tutorial/html/eoLesson3.html index 80726afe8..faa3fe58d 100644 --- a/eo/tutorial/html/eoLesson3.html +++ b/eo/tutorial/html/eoLesson3.html @@ -171,7 +171,8 @@ and optionally by a short (1 character) keyword. -
               +
              + --longKeyword=value     or     -cvalue    if 'c' is the short keyword (though -c=value @@ -182,18 +183,21 @@ so, after compiling the executable for Lesson 3 (ma lesson3 at system prompt in Unix), you can try to type in -
                +
               + SecondBitEA
and see the algorithm run as before (OneMax optimized on 8-bits bitstrings). But you can now type in -
                +
               + SecondBitEA --vecSize=100
and see the output of the optimization of OneMax on 100-bit bitstrings.
 
  • Take a look at all available parameters by typing in
  • -
                    +
                   + SecondBitEA --help
    or by going into the code: all parameter inputs have been grouped in the @@ -206,7 +210,6 @@ used as parameter input file: change the file name (e.g. to SecondBitEA @SecondBitEA.param
    and you will see all values that you defined into the file taken into account. @@ -217,7 +220,7 @@ so you can still override the values in the parameter file by giving a new value directly on the command-line. -
    eoParser: +
    eoParser: Programming parameter input:
    The code of SeconBitEA provides examples of parameters reading. Lets take the example of the random number diff --git a/eo/tutorial/html/eoLesson4.html b/eo/tutorial/html/eoLesson4.html index 087bf4960..4057f9721 100644 --- a/eo/tutorial/html/eoLesson4.html +++ b/eo/tutorial/html/eoLesson4.html @@ -750,7 +750,8 @@ detailed explanations).

    There are 2 types of make_xxx files: the ones that do depend on representation, defining the genotype and -initialization (make_genotype_xxx, +initialization +(make_genotype_xxx, with xxx being the type of genotype) and variation operators (make_op_xxx), and the one that are truly representation-independent (make_pop, make_continue, make _checkpoint, make_algo and @@ -794,6 +795,8 @@ and src/es more complex to understand, first because of the indirection needed for pre-compilation with a given template, and second because of the memory management that this imposes. +
      +
     

    Programmer's guide: Memory management
    As already said, all functions have an eoState @@ -803,7 +806,52 @@ see Programming hints for more detailed explanations and take a look at the code of make_continue for instance, you will see the implementation of the memory management in action. -
      +

    Programmer's +guide: Memory management of eoParam +objects +

    It has been seen in Lesson 3 that parameters could be read from command-line +and/or a parameter file using an eoParser +object. However, the memory mangement problem also concerns EO parameter +objects (eoParam): +the way there are read in Lesson3 +makes them local variables of the function they are defined in. +
    It is however possible to ask the eoParser +to hold them, as done for instance in eoContinue for the maximum number +of generations. Local declaration would amount to something like : +

    eoValueParam<unsigned +int>& maxGenParam(100, "maxGen", "Maximum number of generations () += none)",'G'); +
     parser.processParam( +maxGenParam, "Stopping criterion" ); +
     unsigned maxGen = +maxGenParam.value(); +

    while if you want the parser to hold those eoParam objects, you will +write something like +

    eoValueParam<unsigned>& +maxGenParam = _parser.createParam(unsigned(100), "maxGen", "Maximum number +of generations () = none)",'G',"Stopping criterion"); +

    and then use maxGenParam.value() +to get the value enterred by the user. In that case, you get a reference +to an eoParam object that is hold by the eoParser - and deleted whith it. +
    Note that there are two important differences +between the arguments of the constructor of an eoParam object and the method +createParam of an eoParser object: first, you need to provide the additional +section parameter (used only when outputting the eoParser); second you +must make sure that the first argument +is of the correct type otherwise the compiler will complain. +

    Note that if you don't later need the eoParam, but simply its value, +you can even diretly write +

    unsigned maxGen = _parser.createParam(unsigned(100), +"maxGen", "Maximum number of generations () = none)",'G',"Stopping criterion").value(); +

    Getting parameter values in different functions: +

    It is often useful (though probably very bad +programming style :-))) to be able to get the value of a user-defined +parameter in two different places of the code without passing it around +through many levels of call. You can then use the alternate function getORcreateParam +with exactly the same syntax than createParam. +
    Be careful that the link between both parameters is made through their +longmanes (second argument), and that you must so hard-code +that name in two different places with of course exactly the same spelling!!!


    Lesson 3 -