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