Checking in the name changes in selection procedures.

This impacts on many files, creating new entries in src (the old ones are moved
to obsolete dir), modifying t-eoSymreg.cpp and t-eobin.cpp in test,
as well as gprop.cc and mastermind.cc in app dir (not to mention almost all
files in tutorial:-(
This commit is contained in:
evomarc 2001-01-05 05:42:08 +00:00
commit a998ad0a41
36 changed files with 922 additions and 226 deletions

View file

@ -201,7 +201,7 @@ The actual code is in boldface and the comment in normal face.
<td>
<tt><font color="#009900">
<b> &nbsp;</b>// The robust tournament selection<br>
<b> &nbsp;eoDetTournament&lt;Indi> selectOne(T_SIZE); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</b>// T_SIZE in [2,POP_SIZE]<br>
<b> &nbsp;eoDetTournamentSelect&lt;Indi> selectOne(T_SIZE); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</b>// T_SIZE in [2,POP_SIZE]<br>
<a NAME="select_encapsulate"></a>
<b> &nbsp;</b>// is now encapsulated in a eoSelectPerc (entage)<br>
<b> &nbsp;eoSelectPerc&lt;Indi> select(selectOne);</b>// by default rate==1<br>

View file

@ -209,7 +209,7 @@ The actual code is in boldface and the comment in normal face.
<td>
<tt><font color="#009900">
<b> &nbsp;</b>// The robust tournament selection<br>
<b> &nbsp;eoDetTournament&lt;Indi> select(T_SIZE); &nbsp;</b>// T_SIZE in [2,POP_SIZE]<br>
<b> &nbsp;eoDetTournamentSelect&lt;Indi> select(T_SIZE); &nbsp;</b>// T_SIZE in [2,POP_SIZE]<br>
</font></tt>
</td>
</tr>

View file

@ -202,7 +202,7 @@ The actual code is in boldface and the comment in normal face.
<td>
<tt><font color="#009900">
<b> &nbsp;</b>// The robust tournament selection<br>
<b> &nbsp;eoDetTournament&lt;Indi> selectOne(T_SIZE);</b><br>
<b> &nbsp;eoDetTournamentSelect&lt;Indi> selectOne(T_SIZE);</b><br>
<a NAME="select_encapsulate"></a>
<b> &nbsp;</b>// is now encapsulated in a eoSelectPerc (entage)<br>
<b> &nbsp;eoSelectPerc&lt;Indi> select(selectOne);</b>// by default rate==1<br>

View file

@ -209,7 +209,7 @@ The actual code is in boldface and the comment in normal face.
<td>
<tt><font color="#009900">
<b> &nbsp;</b>// The robust tournament selection<br>
<b> &nbsp;eoDetTournament&lt;Indi> select(T_SIZE); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</b>// T_SIZE in [2,POP_SIZE]<br>
<b> &nbsp;eoDetTournamentSelect&lt;Indi> select(T_SIZE); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</b>// T_SIZE in [2,POP_SIZE]<br>
</font></tt>
</td>
</tr>

View file

@ -2,15 +2,15 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.75 [en] (X11; U; Linux 2.2.17-21mdksmp i686) [Netscape]">
<meta name="GENERATOR" content="Mozilla/4.75 [en] (X11; U; Linux 2.2.17-21mdk i686) [Netscape]">
<title>Tutorial: Solutions</title>
</head>
<body text="#000000" link="#0000EE" vlink="#551A8B" alink="#FF0000" background="beige009.jpg">
<a href="eoTutorial.html">Tutorial main page</a> -
<a href="eoTopDown.html">Algorithm-Based
page</a> - <a href="eoBottomUp.html">Component-Based</a> - <a href="eoProgramming.html">Programming
hints</a> -<font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/index.html">EO
documentation</a></font></font>
<a href="eoTopDown.html">Algorithm-Based</a>
- <a href="eoBottomUp.html">Component-Based</a> - <a href="eoProgramming.html">Programming
hints</a> -<b><font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/index.html">EO
documentation</a></font></font></b>
<br>
<hr WIDTH="100%"><!-- -------------- End of header ------------------ --><!-- ----------------------------------------------- -->
<center>
@ -36,8 +36,9 @@ according to the corresponding instructions of the exercise</li>
<li>
compile <b><tt><font color="#660000">mytest.cpp</font></tt></b> by typing
<b><tt><font color="#FF6666">make mytest</font></tt></b> at system prompt,
and you will hopefully get an executable file named <b><tt><font color="#660000">mytest</font></tt></b>
<b><tt><font color="#FF6666">make
mytest</font></tt></b> at system prompt, and you will hopefully get an
executable file named <b><tt><font color="#660000">mytest</font></tt></b>
(for Unix systems: if eventually someone tells me how to do that in Windows,
apart that you'll probably end up with an executable file named <b><tt><font color="#660000">mytest.exe...</font></tt></b>).</li>
</ul>
@ -46,23 +47,25 @@ apart that you'll probably end up with an executable file named <b><tt><font col
<br><b><font color="#000099"><font size=+2>What you may do later:</font></font></b>
<p>All solutions to exercises are in the same<b><font color="#FF6600">
sub-dir</font></b> of the Tutorial directory than the example files (i.e.
Lesson1 for Lesson1, yes!). Hence you may browse through the code, eventually
modifying it, and then simply type, in the corresponding directory,
<br><b><tt><font color="#FF6666">... % make exerciseN</font></tt></b>
<br>which will compile file <b><tt><font color="#660000">exerciseN.cpp</font></tt></b>
into executable <b><tt><font color="#660000">exerciseN</font></tt></b>
Lesson1 for Lesson1, yes!) and are named <b><tt><font color="#990000">exerciseN.p.cpp</font></tt></b>
where N is the lesson number and p the exercise number. Hence you may browse
through the code, eventually modifying it, and then simply type, in the
corresponding directory,
<br><b><tt><font color="#FF6666">... % make exerciseN.p</font></tt></b>
<br>which will compile file <b><tt><font color="#660000">exerciseN.p.cpp</font></tt></b>
into executable <b><tt><font color="#660000">exerciseN.p</font></tt></b>
(for Unix systems: if eventually someone tells me how to do that in Windows,
you'll probably end up with an executable file named <b><tt><font color="#660000">exerciseN.exe</font></tt></b>).
you'll probably end up with an executable file named <b><tt><font color="#660000">exerciseN.p.exe</font></tt></b>).
<p>
<hr WIDTH="100%">
<br><b><font color="#000099"><font size=+2>What you may not do:</font></font></b>
<center>Complain that it does not work under Windows :-)</center>
<hr WIDTH="100%"><a href="eoTutorial.html">Tutorial main page</a> -
<a href="eoTopDown.html">Algorithm-Based
page</a> - <a href="eoBottomUp.html">Component-Based</a> - <a href="eoProgramming.html">Programming
hints</a> - <font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/index.html">EO
documentation</a></font></font>
<a href="eoTopDown.html">Algorithm-Based</a>
- <a href="eoBottomUp.html">Component-Based</a> - <a href="eoProgramming.html">Programming
hints</a> -<b> <font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/index.html">EO
documentation</a></font></font></b>
<br>
<hr>
<address>

View file

@ -310,7 +310,7 @@ of initializatio of the population</font></tt></td>
<table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="100%" BGCOLOR="#99FFCC" NOSAVE >
<tr>
<td><tt><font color="#009900"><b>&nbsp;</b>// The robust tournament selection</font></tt>
<br><tt><font color="#009900"><b>&nbsp;eoDetTournament&lt;Indi> selectOne(tSize);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><tt><font color="#009900"><b>&nbsp;eoDetTournamentSelect&lt;Indi> selectOne(tSize);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</b>// tSize in [2,POPSIZE]</font></tt>
<br><tt><font color="#009900"><b>&nbsp;</b>// is now encapsulated in a

View file

@ -42,21 +42,163 @@ helper classes that are used within selection and replacement procedures
are presented.
<p>
<hr WIDTH="100%"><a NAME="selection"></a><b><font color="#000099"><font size=+2>Selection</font></font></b>
<br>&nbsp;
<br>&nbsp;
<p>The very beginning of the generation loop is the selection phase, where
some individuals from the population are chosen to become the parents,
to be later modified by the variation operators and become the offspring.
This is the first step of the <font color="#009900">artificial Darwinism</font>,
where the <i><font color="#FF6600">fittest individuals are allowed to reproduce</font></i>.
<br>Conceptually, there are two distinct ways to choose the lucky ones:
one by one from the very same population (i.e. with replacement), which
means that at the extreme the same individual can be chosen every time;
or as a whole, in some sort of batch procedure. Of course, repeated selection
of one individual results in a batch selection!
<p>There are hence two basic EO classes for selection: <font color="#009900">eoSelectOne</font>
and <font color="#009900">eoSelect</font>, with different interfaces.
<br>
<hr WIDTH="50%">
<br><b><font color="#000099">eoSelectOne: </font><font color="#FF0000">The
interface</font></b>
<p>The abstract class for selection of a single individual from a population
is <font color="#009900">eoSelectOne</font>, and the interface for its
<tt><font color="#993300">operator()</font></tt>
is
<center>
<p><b><tt><font color="#993300">const EOT &amp; operator()(const eoPop&lt;EOT>&amp;
_parents)</font></tt></b></center>
<p>which you could have guessed from the inheritance tree for class <b><font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/class_eoselectone.html">eoSelectOne</a></font></font></b>.,
as you see there that <font color="#009900">eoSelectOne</font> derives
from <tt><font color="#993300">class eoUF&lt;const eoPop&lt;EOT>&amp;,
const EOT&amp;></font></tt>.
<br>This means that it takes <font color="#FF6600">1 population</font>
(without the right to modify it - see the <b><tt><font color="#993300">const</font></tt></b>
keyword in argument) and returns a const reference to an individual (again,
the <b><tt><font color="#993300">const</font></tt></b> keyword ensures
that nothing will happen to the individual in the population - remember
it returns a reference).
<br>
<hr WIDTH="50%">
<br><b><font color="#000099">eoSelectOne: </font><font color="#FF0000">Instances</font></b>
<ul>
<li>
<b><tt><font color="#009900">eoDetTournamentSelect</font></tt></b> uses
the <a href="#detTournament">(deterministic) tournament</a> to choose one
individual. Its constructor has one parameter, the tournament size (integer
>= 2).</li>
<li>
<b><tt><font color="#009900">eoStochTournamentSelect</font></tt></b> uses
the <a href="#stochTournament">binary stochastic tournament</a> to choose
one individual. Its constructor has one parameter, the tournament rate
(real in [0.5,1]).</li>
<li>
&nbsp;<b><tt><font color="#009900">eoProportionalSelect</font></tt></b>
is the original <font color="#FF6600">roulette wheel</font> selection:
each parent is selected with a probability proportional to its fitness.</li>
<li>
<b><tt><font color="#009900">eoRandomSelect</font></tt></b> is the <font color="#FF6600">random</font>
selection and should give bad results! At the moment, it selects one individual
uniformly, but it would be easy to use any probability distribution.</li>
</ul>
<hr WIDTH="50%">
<br><b><font color="#000099">eoSelect: </font><font color="#FF0000">The
interface</font></b>
<p>The abstract class for batch selection of a&nbsp; whole set of individuals
from a population is <font color="#009900">eoSelect</font>, and the interface
for its
<tt><font color="#993300">operator()</font></tt> is
<center>
<p><b><tt><font color="#993300">void operator()(const eoPop&lt;EOT>&amp;
_source, eoPop&lt;EOT>&amp; _dest)</font></tt></b></center>
<p>which you could have guessed from the inheritance tree for class <b><font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/class_eoselect.html">eoSelect</a></font></font></b>.,
as you see there that <font color="#009900">eoSelect</font> derives from
<tt><font color="#993300">class
eoBF&lt;const eoPop&lt;EOT>&amp;, eoPop&lt;EOT>&amp;, void></font></tt>.
<br>This means that it takes <font color="#FF6600">2 populations</font>,
and fills the second one with individuals from the first one without modifying
it (see the <b><tt><font color="#993300">const</font></tt></b> keyword).
This raises two questions:
<ul>
<li>
How does it know how many individuals to select?</li>
<li>
How to use repeated selection of one individual (see above the <font color="#009900">eoSelectOne</font>
class)?</li>
</ul>
<hr WIDTH="50%">
<br><b><font color="#000099">eoSelect: </font><font color="#FF0000">HowMany</font></b>
<p>There are two ways an&nbsp; can derive the number of individuals it
has to select: either it is a fixed number, or it is some percentage of
the source population size (any positive real number). In both case, this
must be passed to the constructor. In most instances, however, the constructor
will accept a real number (double) and a boolean indicating whether this
real number should be used as an absolute integer or as a rate, thanks
to the <a href="#howmany">eoHowMany</a> class.
<p><b><font color="#FF0000">Note</font></b>: an <font color="#009900">eoSelect</font>
can select more individuals than there are in the original population.
It is the job of the <font color="#009900">replacement</font> to ensure
that the population size does not grow along the generations.
<p>
<hr WIDTH="50%"><b><font color="#000099">eoSelectMany: </font><font color="#FF0000">Encapsulating
eoSelectOne</font></b>
<p>It is clear that repeated selection of a single individual is a way
to do batch selection. This is why it is possible to encapsulate an object
of class <font color="#009900">eoSelectOne</font> into an object of class
<font color="#009900">eoSelect</font>
using the class <font color="#009900">eoSelectMany</font>. Class <font color="#009900">eoSelectMany</font>
is derived from class <font color="#009900">eoSelect</font> and takes in
its constructor an <font color="#009900">eoSelectOne</font> (plus the number
of individuals it should select, according to the <a href="#howmany">eoHowMany</a>
paradigm).
<p><b><font color="#FF0000">Note</font></b>: some procedures for selecting
a single individual require some pre-processing of the whole population
that takes place before any selection, and will be repeated identically
for every individual. The encapsulation of an&nbsp; into an&nbsp; allows
to call such technical processing only once through the use of method setup
of class . This method does nothing by default, but is mandatory
<br>
<hr WIDTH="50%">
<br><b><font color="#000099">eoSelect: </font><font color="#FF0000">Other
instances</font></b>
<ul>
<li>
<b><tt><font color="#009900">eoDetSelect</font></tt></b> selects individuals
<b><font color="#FF6600">deterministically</font></b>,
i.e. starting from the best ones down to the worse ones. If the total number
to select is less than the size of the source populations, the best individuals
are selected once. If more individuals are needed after reaching the bottom
of the population, then the selection starts again at top. It the total
number required is N times that of the source size, all individuals are
selected exactly N times.</li>
</ul>
No other instances of <font color="#009900">eoSelect</font> that are not
encapsualtions of <font color="#009900">eoSelectOne</font> procedures are
avaiable as of today (Jan. 4 2001).
<br>
<hr WIDTH="100%">
<br><a NAME="replacement"></a><b><font color="#000099"><font size=+2>Replacement</font></font></b>
<p>The replacement phase takes place <font color="#FF6600">after the birth
of all offspring</font> through variation operators. The idea is to close
the generation loop, i.e. to end up with a population of individuals that
will be the initial population of next generation. That population will
be <font color="#FF6600">built upon the old parents and the new-born offspring</font>.
In all algorithms that come up with EO, the <font color="#FF6600">population
size</font> is supposed to be <font color="#FF6600">constant</font> from
one generation to the next one - though nothing stops you from writing
an algorithm with varying population size.
<p><b><font color="#000099">Replacement: </font><font color="#FF0000">The
<p>The replacement phase takes plac<font color="#000000">e after the birth
of all offspring through </font>variation operators. This is the second
step of the <font color="#009900">artificial Darwinism</font>, where the
<i><font color="#FF6600">fittest
individuals are allowed to survive</font></i>.
<br>It can also be viewed on the algorithmic side as closing the generation
loop, i.e. building the population that will be the initial population
of next generation. That population will be <font color="#FF6600">built
upon the old parents and the new-born offspring</font>. In all algorithms
that come up with EO, the <font color="#FF6600">population size</font>
is supposed to be <font color="#FF6600">constant</font> from one generation
to the next one - though nothing stops you from writing an algorithm with
varying population size.
<br>
<hr WIDTH="50%">
<br><b><font color="#000099">Replacement: </font><font color="#FF0000">The
interface</font></b>
<p>The abstract class for replacement procedures is the functor class
<font color="#009900">eoReplacement</font>,
@ -75,7 +217,9 @@ void></font></tt>.
and is free to modify both, but the resulting population should be placed
in the first argument (usually called_parents) to close the loop and go
to next generation.
<p><b><font color="#000099">Replacement: </font><font color="#FF0000">Instances</font></b>
<br>
<hr WIDTH="50%">
<br><b><font color="#000099">Replacement: </font><font color="#FF0000">Instances</font></b>
<ul>
<li>
<b><tt><font color="#009900">eoGenerationalReplacement </font></tt></b>This
@ -86,22 +230,27 @@ that offspring and parents are of the same size (but does not check!).</li>
<br>&nbsp;
<li>
<b><tt><font color="#009900">eoMergeReduce</font></tt></b> This is one
the basic types of replacement in EO. It has two major steps, <font color="#FF6600">merging</font>
both populations of parents and offspring, and <font color="#FF6600">reducing</font>
this big population to the right size. It <font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/class_eomegereduce.html">contains
<a NAME="SSGA"></a><b><tt><font color="#009900">eoMergeReduce</font></tt></b>
This is one the basic types of replacement in EO. It has two major steps,
<font color="#FF6600">merging</font> both populations of parents and offspring,
and <font color="#FF6600">reducing</font> this big population to the right
size. It <font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/class_eomegereduce.html">contains
two objects</a></font></font> of respective types <b><font color="#009900"><a href="#merge">eoMerge</a></font></b>
and <b><font color="#009900"><a href="#reduce">eoReduce</a></font></b>
and you can probably guess what each of them actually does :-)</li>
<p><br>Available <font color="#FF6600">instances of eoMergeReduce</font>
replacement include
<br>&nbsp;
<p>&nbsp;
<p>Available <font color="#FF6600">instances of eoMergeReduce</font> replacement
include
<ul>
<li>
<b><tt><font color="#009900">eoCommaReplacement</font></tt></b>, one of
the two standard strategies in <font color="#000000">Evolution Strategies</font>,
<b><font color="#FF6600">selects the best offspring</font></b>. It is an
<b><tt><font color="#993300">eoMergeReduce(eoNoElitism, eoTruncate)</font></tt></b>.</li>
<b><font color="#FF6600">selects
the best offspring</font></b>. It is an
<b><tt><font color="#993300">eoMergeReduce(eoNoElitism,
eoTruncate)</font></tt></b>.</li>
<li>
<b><tt><font color="#009900">eoPlusReplacement</font></tt></b>, the other
@ -112,9 +261,8 @@ eoTruncate)</font></tt></b>.</li>
<li>
<b><tt><font color="#009900">eoEPReplacement</font></tt></b>, used in th<font color="#000000">e
Evolutionary
Programming historical </font>algorithm, does an EP stochastic tournament
among parents + offspring. It is an <b><tt><font color="#993300">eoMergeReduce(eoPlus,
Evolutionary Programming historical </font>algorithm, does an EP stochastic
tournament among parents + offspring. It is an <b><tt><font color="#993300">eoMergeReduce(eoPlus,
eoEPReduce)</font></tt></b> and its constructor requires as argument T,
the size of the tournament (unsigned int).</li>
</ul>
@ -152,7 +300,9 @@ Additional parameter (in the constructor) is the tournament rate, a <b><tt><font
<li>
<b><tt><font color="#009900">eoSurviveAndDie</font></tt></b> is</li>
</ul>
<b><font color="#000099">Replacement: </font><font color="#FF0000">Adding
<hr WIDTH="50%">
<br><b><font color="#000099">Replacement: </font><font color="#FF0000">Adding
(weak) elitism</font></b>
<p>You can add what is called <font color="#FF6600">weak elitism</font>
to any replacement by encapsulating it into an <b><tt><font color="#009900">eoWeakElitismReplacement</font></tt></b>
@ -170,11 +320,13 @@ can be any replacement object):
<br>and use now replace as your replacement procedure within your algorithm.
<p><font color="#FF0000">Note</font>: of course, adding weak elitism to
an elitist replacement makes no sense - but will not harm either :-)
<p><b><font color="#000099">Replacement: </font><font color="#FF0000">Test
<br>
<hr WIDTH="50%">
<br><b><font color="#000099">Replacement: </font><font color="#FF0000">Test
file</font></b>
<p>The file <b><tt><font color="#993300">t-eoReplacement</font></tt></b>
in the <b><font color="#FF6600">test directory</font></b> implements all
above replacmenet procedures within a very simple and easy-to-monitor Dummy
above replacement procedures within a very simple and easy-to-monitor Dummy
EO class.
<p>
<hr WIDTH="100%">
@ -239,10 +391,10 @@ parameter R should be in [0.5,1]. It is implemented in the <b><tt><font color="#
class, a sub-class of eoSelectOne, as well as in the <b><tt><font color="#009900">eoStochTournamentTruncate</font></tt></b>
class that repeatidly removes from the population the "winner" of the inverse
tournament.&nbsp; These objects use the C++ function determinitic_tournament
in&nbsp; <a href="../../doc/html/selectors_h-source.html">selectors.h</a>.<br>
<b><font color="#FF0000">Note</font></b>: A stochastic tournament with
rate 1.0 is strictly identical to a deterministic tournament of size 2.</li>
in&nbsp; <a href="../../doc/html/selectors_h-source.html">selectors.h</a>.</li>
<br><b><font color="#FF0000">Note</font></b>: A stochastic tournament with
rate 1.0 is strictly identical to a deterministic tournament of size 2.
<li>
<a NAME="EPTournament"></a><b><tt><font color="#009900">EP Tournament</font></tt></b>
of size T is a global tournament: it works by assigning a score to all
@ -252,12 +404,13 @@ Everytime I wins, its score in incremented by 1 (and by 0.5 for every draw).
The individuals are then selected deterministically based on their scores
from that procedure. The <b><tt><font color="#009900">EP Tournament</font></tt></b>
is implemented in the&nbsp; <b><tt><font color="#009900">eoEPReduce</font></tt></b>
truncation method used in some replacement procedures.&nbsp;<br>
<b><font color="#FF0000">Note</font></b>: whereas both the determinitic
truncation method used in the <b><tt><font color="#009900">eoEPReplacement</font></tt></b>
procedure.</li>
<br><b><font color="#FF0000">Note</font></b>: whereas both the determinitic
and the stochastic tournament select one individual, the EP tournament
is designed for batch selection. Of course it could be used to select a
single individual, but at a rather high computational cost.</li>
</ul>
single individual, but at a rather high computational cost.</ul>
<p><br>
<hr WIDTH="100%">
@ -266,7 +419,9 @@ populations</font></font></b>
<p>In replacement procedures, one frequently needs to merge two populations
(computed form old parents and new-born offspring). Classes derived from
the abstract class eoMerge are written for that purpose.
<p><b><font color="#000099">eoMerge</font></b>: <b><font color="#FF0000">interface</font></b>
<br>
<hr WIDTH="50%">
<br><b><font color="#000099">eoMerge</font></b>: <b><font color="#FF0000">interface</font></b>
<br>The abstract class for merging procedures is the functor class
<font color="#009900">eoMerge</font>,
and the interface for its <tt><font color="#993300">operator()</font></tt>
@ -282,7 +437,9 @@ void></font></tt>.
<br>This means that it takes <font color="#FF6600">2 populations</font>
and modifies the seond one by adding some individuals from the first one
(which is supposed to remain <b><tt><font color="#993300">const</font></tt></b>ant).
<p><b><font color="#000099">eoMerge</font></b>: <b><font color="#FF0000">instances</font></b>
<br>
<hr WIDTH="50%">
<br><b><font color="#000099">eoMerge</font></b>: <b><font color="#FF0000">instances</font></b>
<br>Available <font color="#FF6600">instances of eoMerge</font> objects
are <b><tt><font color="#009900">eoPlus</font></tt></b>, that simply adds
the parents to the offspring, or <b><tt><font color="#009900">eoElitism</font></tt></b>,
@ -296,7 +453,9 @@ populations</font></font></b>
<p>The other useful component of replacement procedures, <font color="#009900">eoReduce</font>,
<font color="#FF6600">kills
some individuals</font> from a given population.
<p><b><font color="#000099">eoReduce</font></b>: <b><font color="#FF0000">interface</font></b>
<br>
<hr WIDTH="50%">
<br><b><font color="#000099">eoReduce</font></b>: <b><font color="#FF0000">interface</font></b>
<br>The abstract class for reducing procedures is the functor class
<font color="#009900">eoReduce</font>,
and the interface for its <tt><font color="#993300">operator()</font></tt>
@ -311,7 +470,9 @@ as you see there that <font color="#009900">eoReduce</font> derives from
int, void></font></tt>.
<br>An <font color="#009900">eoReduce</font> shoud take a<font color="#FF6600">
population</font> and shrink it to the required size.
<p><b><font color="#000099">eoReduce</font></b>: <b><font color="#FF0000">instances</font></b>
<br>
<hr WIDTH="50%">
<br><b><font color="#000099">eoReduce</font></b>: <b><font color="#FF0000">instances</font></b>
<br>Available <font color="#FF6600">instances of eoReduce</font> are
<ul>
<li>
@ -347,7 +508,6 @@ the population. It requires the rate of the tournament (<b><tt><font color="#993
as parameter in the constructor (default is 0.75).</li>
</ul>
<p><br>
<hr WIDTH="100%">
<br><a NAME="howmany"></a><b><font color="#000099"><font size=+2>eoHowMany:
Choosing a number of individuals</font></font></b>
@ -366,7 +526,9 @@ It receives a <b><tt><font color="#993300">double</font></tt></b>, and
a <b><tt><font color="#993300">boolean</font></tt></b> indicating whether
that double is to be treated <b><font color="#FF6600">as a rate</font></b>
or as <b><font color="#FF6600">an absolute (unisgned) interger.</font></b>
<p><b><font color="#000099">eoHowMany</font></b>: <b><font color="#FF0000">interface</font></b>
<br>
<hr WIDTH="50%">
<br><b><font color="#000099">eoHowMany</font></b>: <b><font color="#FF0000">interface</font></b>
<br>The class interface for its <tt><font color="#993300">operator()</font></tt>
is
<center>

View file

@ -358,27 +358,30 @@ are available!
<li>
You already know the <font color="#FF6600">tournament selection</font></li>
<br><font color="#FF0000">Syntax:&nbsp; </font><tt><font color="#009900"><b>eoDetTournament&lt;Indi>
<br><font color="#FF0000">Syntax:&nbsp; </font><tt><font color="#009900"><b>eoDetTournamentSelect&lt;Indi>
select(T_SIZE);&nbsp;&nbsp; </b>// T_SIZE in [2,POP_SIZE)</font></tt>
<li>
Try the well-known <font color="#FF6600">roulette wheel</font></li>
<br>&nbsp;<font color="#FF0000">Syntax:&nbsp;</font>&nbsp;&nbsp; <b><tt><font color="#009900">eoProportional&lt;Indi>
<br>&nbsp;<font color="#FF0000">Syntax:&nbsp;</font>&nbsp;&nbsp; <b><tt><font color="#009900">eoProportionalSelect&lt;Indi>
select;</font></tt></b>
<li>
Or the <font color="#FF6600">stochastic binary tournament</font></li>
<br><font color="#FF0000">Syntax:&nbsp; </font><tt><font color="#009900"><b>eoStochTournament&lt;Indi>
select(RATE);&nbsp;</b>&nbsp;&nbsp;&nbsp; // RATE in ]0.5,1]</font></tt>
<br><font color="#FF0000">Syntax:&nbsp; </font><b><tt><font color="#009900">eoStochTournamentSelect&lt;Indi>
select(RATE);&nbsp;</font></tt></b><tt><font color="#009900">&nbsp;&nbsp;&nbsp;
// RATE in ]0.5,1]</font></tt>
<li>
and of course the <font color="#FF6600">random</font> selection should
give bad results!</li>
<br><font color="#FF0000">Syntax:&nbsp; </font><b><tt><font color="#009900">eoSelectRandom&lt;Indi>
<br><font color="#FF0000">Syntax:&nbsp; </font><b><tt><font color="#009900">eoRandomSelect&lt;Indi>
select;</font></tt></b></ul>
Note that all these classes of eoObjects are derived from the abstract
class
<b><font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/class_eoselectone.html">eoSelectOne.</a></font></font></b>
To find out exactly how each procedure selects the individuals, read the
corresponding <a href="eoEngine.html#selection">component-based page</a>.
<p>
<hr WIDTH="100%"><b><font color="#000099"><font size=+2>Lessons learned:</font></font></b>
<ul>

View file

@ -69,6 +69,10 @@ object that is a sub-class of the corresponding STL vector class.</font></li>
<br>&nbsp;
<p>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<p><b><font color="#FF0000">Note:</font></b> <font color="#000000">Also,
a non-templatized fitness can be </font><b><font color="#FF6600">compiled
separately</font></b><font color="#000000"> (not done here) into an object
@ -88,6 +92,8 @@ requires.</font></li>
<p>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<p><b><font color="#FF0000">Note:</font></b> <font color="#000000">In the
previous files (<a href="FirstBitGA.html#eval">Bit</a> - <a href="FirstRealGA.html#eval">Real</a>)
, the last 2 types were deduced from the first (2nd argument = fitness
@ -113,6 +119,10 @@ call to <a href="../../doc/html/class_eopop.html#a2">pop.append()</a> function
<br>&nbsp;
<p>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<p><b><font color="#FF0000">Note</font><font color="#CC33CC">: </font></b><font color="#000000">Don't
forget to </font><b><font color="#CC0000">evaluate the population</font></b><font color="#000000">:
the eoPop has no idea of the eval function, so it has to be done from outside!!!</font>
@ -263,7 +273,7 @@ the population in [-2,-1] and the other half in [1,2], with and without
the segment and arithmetic crossovers (and for large values of VEC_SIZE,
the size of the vectors). Amazing, isn't it! Explain that result.</font>
<p><a NAME="Exercise3"></a><b><font size=+2><font color="#000099">Exercise
3:&nbsp; </font><font color="#FF0000">replacement</font></font></b>
3:&nbsp; </font><font color="#FF0000">full selection/replacement</font></font></b>
<br><font color="#000000">You can now twiddle the number of offspring that
will be generated from the parents. But of course you need to adjust the
replacement to keep a constant population size.</font>
@ -281,6 +291,14 @@ into an eoSelectPerc object. For instance, try</font></li>
eoSelectPerc&lt;Indi> select(selectOne,2.0)</font></tt></b>
<br><font color="#000000">to generate twice as many offspring as there
are parents.</font>
<br><font color="#000000">You can also use the other encapsulator that
takes as second argument an absolute number (e.g. if you want to generate
2 offspring whatever the population size):</font>
<br><b><tt><font color="#009900">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
eoSelectNumber&lt;Indi> select(selectOne,2)</font></tt></b>
<br><font color="#000000">Or you can use the <a href="eoEngine.html#howmany">HowMany</a>
paradigm and the </font><b><tt><font color="#009900">eoSelectMany </font></tt></b><font color="#000000">to
do either one depending on some command-line input (advanced).</font>
<li>
<font color="#000000">To </font><font color="#FF6600">keep a constant population
size</font><font color="#000000">, you can use either the </font><b><tt><font color="#009900">eoCommaReplacement</font></tt></b><font color="#000000">
@ -297,21 +315,14 @@ or
Strategies</a>.
<li>
<font color="#FF0000">Question</font><font color="#000000">: what do you
get if you have use a rate of 1/POP_SIZE for the selection, and an </font><b><tt><font color="#009900">eoPlusReplacement</font></tt></b><font color="#000000">
get if you select 1 offspring only, and an </font><b><tt><font color="#009900">eoPlusReplacement</font></tt></b><font color="#000000">
strategy? Yes, you get almost the replace_worst Steady-State GA, though
rather inefficient, as you sort the population at every generation, which
could be avoided - and will be in a later lesson).</font></li>
rather inefficient, as you sort the population at every generation.</font></li>
<li>
<font color="#FF0000">Homework</font><font color="#000000">: Write the
</font><b><tt><font color="#009900">eoCommaPlusReplacement</font></tt></b><font color="#000000">
that would start by taking the best of the offspring, and if some are still
missing to keep the population size constant, take the best of the parents.
Write the </font><b><tt><font color="#009900">eoConservativeReplacement</font></tt></b><font color="#000000">
that starts by taking a percentage of the parents (the best ones) and then
adds the best from the offspring. In both cases, </font><font color="#FF6600">send
use the code </font><font color="#000000">as we haven't done that yet (and
hence there is no solution available at the moment - Nov. 29 :-)</font></li>
<font color="#FF0000">Hint</font><font color="#000000">: there are a few
Steady-State replacement strategies already there in EO. See the <a href="eoEngine.html#SSGA">Replacement
page</a>.</font></li>
</ul>
<font color="#FF0000">Remember</font><font color="#000000">: all solutions
are in the same sub-directory of the Tutorial dir than the examples (i.e.

View file

@ -12,8 +12,8 @@
<a href="eoTutorial.html">Main page</a> -
<a href="eoTopDown.html">Algorithm-Based</a>
- <a href="eoBottomUp.html">Component-Based</a> - <a href="eoProgramming.html">Hints</a>
- <b><font face="Arial,Helvetica"><a href="../../doc/html/index.html">EO
documentation</a></font></b>
- <b><font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/index.html">EO
documentation</a></font></font></b>
<br>
<hr WIDTH="100%"><!-- -------------- End of header ------------------ --><!-- ----------------------------------------------- -->
<center>
@ -102,14 +102,10 @@ operators</a> and the <a href="SecondBitEA.html#engine">evolution engine</a>&nbs
sections are similar to the ones in Lesson2</font></li>
<li>
<font color="#000000">The </font><b><font color="#3366FF">parameter section</font></b><font color="#000000">&nbsp;
is completely different from the previous one. All variables corresponding
to </font><font color="#3366FF">program parameters</font><font color="#000000">
are now </font><a href="SecondBitEA.html#seed_declare">declared</a><font color="#000000">
in the </font><b><tt><font color="#990000"><font size=+1>main_function</font></font></tt></b><font color="#000000">
(as before), but their values are set in a <a href="SecondBitEA.html#parametres">new
function</a>, called </font><b><tt><font color="#660000">read_param.</font></tt></b><font color="#000000">
See the <a href="#parser">eoParser</a> description for more details.</font></li>
<font color="#000000">The <a href="SecondBitEA.html#parametres">parameter
section</a>&nbsp; is completely different from the previous one. All variables
corresponding to </font><font color="#3366FF">program parameters</font><font color="#000000">
are now read at run-time using an object of class <a href="#parser">eoParser</a>.</font></li>
<li>
<font color="#000000">The <a href="SecondBitEA.html#stop">stopping criterion
@ -145,7 +141,9 @@ See the parameter section of the Component-Based tutorial, or wait until
<font color="#000000">The </font><b><tt><font color="#3366FF">eoParser</font></tt></b><font color="#000000">
class, whose only purpose is the input of parameters.</font></li>
</ul>
<b><font color="#FF0000">Modifying parameter values at run-time:</font></b>
<hr WIDTH="50%"><b><font color="#000099">eoParser:</font><font color="#FF0000">
Modifying parameter values at run-time:</font></b>
<br><font color="#000000">Using an eoParser object, the parameter values
are read, by order of priority</font>
<ol>
@ -173,7 +171,7 @@ and optionally by a <font color="#FF6600">short (1 character) keyword</font>.</l
the general syntax to modify parameter value at run-time is (either from
the command-line or in a text file)</li>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><tt><font color="#660000">--longKeyword=value</font></tt></b>&nbsp;&nbsp;&nbsp;&nbsp;
or&nbsp;&nbsp;&nbsp;&nbsp; <b><tt><font color="#660000">-c=value</font></tt></b>&nbsp;&nbsp;&nbsp;
@ -184,12 +182,12 @@ so, after compiling the executable for Lesson 3 (<b><tt><font color="#FF6666">ma
lesson3</font></tt></b> at system prompt in Unix), you can try to type
in</li>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><tt><font color="#FF6666">SecondBitEA</font></tt></b>
<br>and see the algorithm run as before (OneMax optimized on 8-bits bitstrings).
But you can now type in
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><tt><font color="#FF6666">SecondBitEA --vecSize=100</font></tt></b>
<br>and see the output of the optimization of OneMax on 100-bit bitstrings.
@ -197,7 +195,7 @@ But you can now type in
<li>
Take a look at all available parameters by typing in</li>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><tt><font color="#FF6666">SecondBitEA --help</font></tt></b>
<br>or by going into the code: all parameter inputs have been grouped in
@ -210,7 +208,7 @@ it contains the list of all actual parameters used, and can directly be
used as parameter input file: change the file name (e.g. to <b><tt><font color="#660000">SecondBitEA.param</font></tt></b>),
edit it, change whichever parameter you want, and type in</li>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><tt><font color="#FF6666">SecondBitEA @SecondBitEA.param</font></tt></b>
<br>and you will see all values that you defined into the file taken into
account.
@ -220,9 +218,12 @@ The <font color="#FF6600">priority</font> remains to the <font color="#FF6600">c
so you can still override the values in the parameter file by giving a
new value directly on the command-line.</li>
</ul>
<b><font color="#FF0000">Programming parameter input:</font></b>
<br>the code of SeconBitEA provides examples of parameters reading. Lets
take the example of the random number generator <b><tt><font color="#660000">seed</font></tt></b>.&nbsp;
<hr WIDTH="50%"><b><font color="#000099">eoParser:</font><font color="#FF0000">
Programming parameter input:</font></b>
<br>The code of SeconBitEA provides examples of parameters reading. Lets
take the example of the <a href="eoProgramming.html#random">random number
generator </a><b><tt><font color="#660000">seed</font></tt></b>.&nbsp;
Of course, you first need to <a href="SecondBitEA.html#parser_declare">declare
an eoParser object</a> (it needs the standard argc and argv in its constructor).
<ul>
@ -240,7 +241,11 @@ that will be used to make the output of the parser look clean and ordered.</li>
<li>
Finally, you need to <a href="SecondBitEA.html#seed_assign">assign the
value</a> to the variable seed</li>
value</a> to the variable <b><tt><font color="#660000">seed</font></tt></b>.
Note that the <b><tt><font color="#990000">value()</font></tt></b> method
of eoParam returns a reference, so you can eventually modify its value
somewhere else later (though of course this is not any useful for variable
<b><tt><font color="#660000">seed</font></tt></b>!).</li>
</ul>
<hr WIDTH="100%">
@ -296,16 +301,16 @@ an object whose </font><b><tt><font color="#660000">operator()</font></tt></b><f
does what you want to the eoState that you will use as continuator in the
algorithm.</font>
<br>
<hr WIDTH="100%"><a NAME="stop"></a><b><font color="#000099">eoCheckpoint:
Stopping</font></b>
<hr WIDTH="50%"><a NAME="stop"></a><b><font color="#000099">eoCheckpoint:
</font><font color="#FF0000">Stopping</font></b>
<br><font color="#000000">The </font><b><tt><font color="#3366FF">eoContinue</font></tt></b><font color="#000000">
part of an </font><b><tt><font color="#3366FF">eoCheckpoint</font></tt></b><font color="#000000">
is a single object, <a href="SecondBitEA.html#checkpoint">passed to the
constructor</a>. If you want more that one stopping criterion, use an <a href="SecondBitEA.html#stop">eoCombinedContinue</a>
object as described in <a href="eoLesson2.html#combinedContinue">Lesson2</a>.</font>
<br>
<hr WIDTH="100%">
<br><a NAME="stats"></a><b><font color="#000099">eoCheckpoint: Computing
<hr WIDTH="50%">
<br><a NAME="stats"></a><b><font color="#000099">eoCheckpoint: </font><font color="#FF0000">Computing
statistics</font></b>
<br><font color="#000000">Statistics are computed using </font><b><tt><font color="#3366FF">eoStat</font></tt></b><font color="#000000">
objects, i.e. functor objects whose </font><b><tt><font color="#660000">operator()</font></tt></b><font color="#000000">
@ -322,9 +327,10 @@ objects. And this allows </font><b><tt><font color="#3366FF">eoStat</font></tt><
to be used within </font><b><tt><font color="#3366FF">eoMonitor</font></tt></b><font color="#000000">
object, and hence </font><b><font color="#FF6600">displayed</font></b><font color="#000000">
to the user!</font>
<p><b><font color="#FF0000">Available statistics</font></b>: Some widely
used statistics are already available (and of course you can build you
own!).
<p><b><font color="#000099">Statistics: </font><font color="#FF0000">Available
instances</font></b>
<br>Some widely used statistics are already available (and of course you
can build you own!).
<ul>
<li>
<b><tt><font color="#3366FF">eoBestFitnessStat</font></tt></b> returns
@ -344,28 +350,33 @@ diversity in the population: assuming that there is a distance function
defined among individuals, it returns the average inter-individuals distance.
See also Exercise 2.</li>
</ul>
<b><font color="#FF0000">Programming</font></b>: To compute some statistics
within your algorithm, simply <a href="SecondBitEA.html#stat_declare">declare</a>
<b><font color="#000099">Statistics: </font><font color="#FF0000">Adding
to the checkpoint</font></b>
<br>To compute more statistics when your algorithm is running, simply <a href="SecondBitEA.html#stat_declare">declare</a>
the corresponding eoStat objects, and <a href="SecondBitEA.html#stat_pass">add</a>
them to the <b><tt><font color="#3366FF">eoCheckpoint</font></tt></b> you
use in the algorithm.
use in the algorithm. But it hardly makes any sense if you don't <b><font color="#3366FF">monitor</font></b>
those statistics (i.e. either displaying them on the screen, or storing
them into a file): see next section!
<p><b><font color="#FF0000">Note</font></b>: actually, there are 2 distinct
classes that compute and give access to statistics: <b><tt><font color="#3366FF">eoStat</font></tt></b>and
<b><tt><font color="#3366FF">eoSortedStat</font></tt></b>.
As its name indicate, the latter is used whenever computing the statistics
require a sorted population: not only this avoids to sort the population
many times, but also it avoids changing the order of the population at
all as eoSortedStat work on a temporary vector of fitnesses . But <font color="#FF6600">as
all as <b><tt><font color="#3366FF">eoSortedStat</font></tt></b> objects
work on a temporary vector of fitnesses . But <font color="#FF6600">as
far as their usage is concerned, its makes no difference</font>.
<br>
<hr WIDTH="100%">
<br><a NAME="monitor"></a><b><font color="#000099">eoCheckpoint: Displaying
<hr WIDTH="50%">
<br><a NAME="monitor"></a><b><font color="#000099">eoCheckpoint: </font><font color="#FF0000">Monitoring
eoParameters</font></b>
<br><font color="#000000">The </font><b><tt><font color="#3366FF">eoMonitor</font></tt></b><font color="#000000">
objects are used to display a set of </font><b><tt><font color="#3366FF">eoValueParam</font></tt></b><font color="#000000">
objects are used to display or store to a file a set of </font><b><tt><font color="#3366FF">eoValueParam</font></tt></b><font color="#000000">
objects.</font>
<p><b><font color="#FF0000">Available monitors</font></b>: A few monitors
are available in the EO distribution:
<p><b><font color="#000099">Monitors</font></b>: <b><font color="#FF0000">Available
instances</font></b>
<br>A few monitors are available in the EO distribution:
<ul>
<li>
<b><tt><font color="#3366FF">eoStdoutMonitor</font></tt></b> displays its
@ -394,15 +405,16 @@ at the end of the run, while it is otherwise kept (though it will be overwritten
by next call to the same program).</li>
</ul>
<p><br><b><font color="#FF0000">Programming:</font></b> To display something
while the algorithm is running, you need to <a href="SecondBitEA.html#monitor_declare">declare</a>
<p><br><b><font color="#000099">Monitors</font></b>: <b><font color="#FF0000">Adding
to the checkpoint</font></b>
<br>To display something while the algorithm is running, you need to <a href="SecondBitEA.html#monitor_declare">declare</a>
an <b><tt><font color="#3366FF">eoMonitor</font></tt></b> object, <a href="SecondBitEA.html#monitor_add">add</a>
some objects (that must be <b><tt><font color="#3366FF">eoValueParam</font></tt></b>
objects) to that monitor, and of course <a href="SecondBitEA.html#monitor_pass">add</a>
the monitor to the <b><tt><font color="#3366FF">eoCheckpoint</font></tt></b>
you use in the algorithm.
<br>
<hr WIDTH="100%">
<hr WIDTH="50%">
<br><a NAME="update"></a><b><font color="#000099">eoCheckpoint: Updating
things</font></b>
<br><font color="#000000">The last type of objects that&nbsp; </font><b><tt><font color="#3366FF">eoCheckpoint</font></tt></b><font color="#000000">
@ -411,8 +423,8 @@ objects. You should simply encapsulate in an </font><b><tt><font color="#3366FF"
anything you wish to do which does not fit into one of the above category.
Note that their </font><b><tt><font color="#660000">operator() method</font></tt></b><font color="#000000">
does not receive any argument.</font>
<p><b><font color="#FF0000">Available monitors</font></b>: A few updaters
are available in the EO distribution:
<p><b><font color="#000099">Updater: </font><font color="#FF0000">Available
instances</font></b>: A few updaters are available in the EO distribution:
<ul>
<li>
<b><tt><font color="#3366FF">eoIncrementor</font></tt></b> A simple updater
@ -430,7 +442,8 @@ be used to <font color="#FF6600">save</font> some existing <b><tt><font color="#
generation count (e.g. every 4 generations) or based on the clock (e.g.
every 5 seconds).</li>
</ul>
<b><font color="#FF0000">Programming:</font></b>
<b><font color="#000099">Updater: </font><font color="#FF0000">Adding to
the checkpoint</font></b>
<br>A very simple example of using an <b><tt><font color="#3366FF">eoUpdater</font></tt></b>
is given in the code for SecondBitEA: First <a href="SecondBitEA.html#param_declare">declare</a>
an <b><tt><font color="#3366FF">eoValueParam</font></tt></b> object, then
@ -468,8 +481,8 @@ otherwise the standard deviations won't make any sense here.</font></li>
<li>
<font color="#000000">Then run</font></li>
<br><b><tt><font color="#660000"><font size=+1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
exercise1 --vecSize=1000 --maxGen=1000</font></font></tt></b>
<br><b><tt><font color="#660000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
exercise1 --vecSize=1000 --maxGen=1000</font></tt></b>
<br><font color="#000000">to get a chance to see something happening before
the program ends!</font></ul>
@ -479,9 +492,9 @@ stat computation and test it. Thanks to send us the code!</font>
<br>
<hr WIDTH="100%">
<br><b><font color="#000099"><font size=+2>Exercise 3:</font></font></b>
<br><font color="#000000">Write the code for an </font><b><tt><font color="#3366FF"><font size=+1>eoGnuplot1DwithErrorbarsMonitor</font></font></tt></b><font color="#000000">
that would take into account the standard deviations and display them as
error-bars.</font>
<br><font color="#000000">Write the code for an </font><b><tt><font color="#3366FF">eoGnuplotSecondStatMonitor</font></tt></b><font color="#000000">
that would display the </font><b><tt><font color="#3366FF">eoSecondMomentStat</font></tt></b><font color="#000000">
(i.e. take into account the standard deviations and display them as error-bars.</font>
<br><font color="#000000">Again, send us the code afterwards, thanks :-)</font>
<br>
<hr WIDTH="100%">
@ -489,32 +502,30 @@ error-bars.</font>
<ul>
<li>
Value of program parameters can be set <b><font color="#FF6600">at run-time</font></b>
using the <b><tt><font color="#3366FF"><font size=+1>eoParser</font></font></tt></b>
class.</li>
using the <b><tt><font color="#3366FF">eoParser</font></tt></b> class.</li>
<li>
<b><font color="#FF6600">Snapshots</font></b> of the algorithms can easily
be <font color="#FF6600">saved</font> (and <font color="#FF6600">restored</font>)
thanks to the <b><tt><font color="#3366FF"><font size=+1>eoState</font></font></tt></b>
class.</li>
thanks to the <b><tt><font color="#3366FF">eoState</font></tt></b> class.</li>
<li>
The <b><tt><font color="#3366FF"><font size=+1>eoCheckpoint</font></font></tt></b>
mechanism let you <b><font color="#FF6600">do things every generation</font></b>
The <b><tt><font color="#3366FF">eoCheckpoint</font></tt></b> mechanism
let you <b><font color="#FF6600">do things every generation</font></b>
without modifying existing algorithms, by simply writing the necessary
code and encapsulating it into an object that <b><tt><font color="#3366FF"><font size=+1>eoCheckpoint</font></font></tt></b>
code and encapsulating it into an object that <b><tt><font color="#3366FF">eoCheckpoint</font></tt></b>
is aware of, that are at the moment the following:</li>
<li>
computing <b><font color="#FF6600">statistics</font></b>, <b><font color="#FF6600">displaying
</font></b>parameters
(e.g. statistics),&nbsp; <b><font color="#FF6600">saving</font></b> the
<b><tt><font color="#3366FF"><font size=+1>(eo)State</font></font></tt></b>
<b><tt><font color="#3366FF">(eo)State</font></tt></b>
of the program.</li>
</ul>
In next lesson you will find out that many <a href="intro.html#adaptive">adaptive
techniques</a> (the state-of-the-art in Evolutionary Computation) can easily
be programmed through the <b><tt><font color="#3366FF"><font size=+1>eoUpdater</font></font></tt></b>
be programmed through the <b><tt><font color="#3366FF">eoUpdater</font></tt></b>
construct.
<br>
<hr WIDTH="100%"><a href="eoLesson2.html">Lesson 2</a> -
@ -523,14 +534,14 @@ construct.
<a href="eoTutorial.html">Main page</a> -
<a href="eoTopDown.html">Algorithm-Based</a>
- <a href="eoBottomUp.html">Component-Based</a> - <a href="eoProgramming.html">Hints</a>
-<b> <font face="Arial,Helvetica"><a href="../../doc/html/index.html">EO
documentation</a></font></b>
-<b> <font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/index.html">EO
documentation</a></font></font></b>
<br>
<hr>
<address>
<a href="mailto:Marc.Schoenauer@polytechnique.fr">Marc Schoenauer</a></address>
<br><!-- Created: Fri Nov 3 18:49:12 CET 2000 --><!-- hhmts start -->Last
modified: Mon Nov 27 8:49:12 CET 2000<!-- hhmts end -->
modified: None of your business!<!-- hhmts end -->
</body>
</html>
</html>

View file

@ -26,9 +26,9 @@ of "lessons" for you.
<li>
<a href="eoLesson1.html">Lesson 1 </a>- a gentle introduction to the <font color="#FF6600">EO
way</font>: your first steps into <b><font color="#999900">EO representations</font></b>
using a simple generational GA. Please, <b><font color="#FF0000">spend
the necessary time</font></b> on that one, since all basic constructs presented
there are used throughout EO.</li>
using a simple generational GA. Please, <b><blink><font color="#FF0000">spend
the necessary time</font></blink></b> on that one, since all basic constructs
presented there are used throughout EO.</li>
<li>
<a href="eoLesson2.html">Lesson 2</a> - <font color="#FF6600">encapsulate</font>,
@ -47,32 +47,40 @@ populations,
<b><font color="#3366FF">restart</font></b> stopped runs,
...).</li>
<br>&nbsp;
<p>&nbsp;
<p>Current version (Nov. 29, 2000) stops here, but here are the plans (subjected
to many changes, of course!)
<p><br>Current version (Jan. 5, 2001) stops here, but ...
<p>From there on, you don't need to follow the lesson order any more: you
can go directly to any lesson and experiment. Of course, you will need
to bring together the different pieces to write exactly what you want -
but only because we had no idea of what you exactly want :-)
<br>&nbsp;
<li>
Lesson 4 - More about checkpointing: write your first <font color="#FF6600">adaptive
mechanism</font>, and find out how easy it is to <b><font color="#3366FF">update</font></b>
and <b><font color="#3366FF">monitor </font></b><font color="#FF6600">dynamic
parameters</font></li>
Lesson 4 - More about <b><font color="#3366FF">checkpointing</font></b>:
write your first <b><font color="#FF6600">adaptive mechanism</font></b>,
and find out how easy it is to <b><font color="#3366FF">update</font></b>
and <b><font color="#3366FF">monitor </font><font color="#FF6600">dynamic
parameters</font></b></li>
<li>
Lesson 5 - more general operators: e.g. binary, n-ary, or even specific
mate selection (your brain and my beauty)!</li>
Lesson 5 - More <b><font color="#CC33CC">general operators</font></b>:
e.g. binary, n-ary, or even specific mate selection (your brain and my
beauty)!</li>
<li>
Lesson 6 - why not go parallel? From the simple asynchronous SSGA to the
more sophisticated island model (no totally distributed population yet).</li>
Lesson 6 - Why not go <b><font color="#993300">parallel</font></b>? From
the simple asynchronous SSGA to the more sophisticated island model (no
totally distributed population yet).</li>
<li>
Lesson 7 - ...</li>
Lesson 7 - Use your own <b><font color="#999900">representation</font></b>.
You need only to write the base individual class, the initilization class
and the variation operators. EO provides many helps: The <b><font color="#999900">eoExternal</font></b>
paradigm let you encapsulate into EO classes existing code. And the <b><font color="#999900">eoFixedLength</font></b>
and <b><font color="#999900">eoVariableLength</font></b> super classes
allow quick definition of new genotypes that handle identical Atoms.</li>
</ul>
Of course, in each lesson, you have links to the Component-Based of the
corresponding component of an EA you are modifying.
<br>( ... Well, to tell you the truth, as of today, November 28, this is
not true :-)
Of course, in each lesson, you have links to the corresponding Component-Based
page. ( ... Well, to tell you the truth, as of today, Jan. 5, 2001, this
is not exactly true :-)
<br>
<hr WIDTH="100%">
<br><a href="eoTutorial.html">Tutorial main page </a>- <a href="eoTopDown.html">Algorithm-Based</a>

199
eo/tutorial/html/index.html Normal file
View file

@ -0,0 +1,199 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.75 [en] (X11; U; Linux 2.2.17-21mdk i686) [Netscape]">
<title>Tutorial EO</title>
</head>
<body text="#000000" link="#0000EF" vlink="#51188E" alink="#FF0000" background="beige009.jpg">
<a href="eoTopDown.html">Algorithm-Based</a> - <a href="eoBottomUp.html">Component-Based</a>
- <a href="eoProgramming.html">Programming hints</a> - <b><font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/index.html">EO
documentation</a></font></font></b>
<hr WIDTH="100%">
<center><b><font color="#FF0000">Welcome to EO, the Evolving Objects library,
and to</font></b>
<b><font color="#FF0000"></font></b>&nbsp;
<h1>
<font color="#FF0000">EO Tutorial</font></h1></center>
<center><font color="#FF0000">Version 0.92 - Jan. 5 2001</font></center>
<p>The short term idea of this tutorial is to help you <font color="#FF6600">build
your own Evolutionary Algorithms</font> using EO - while the long term
idea is that you will be able to contribute to EO, and ultimately write
<font color="#FF6600">our</font>
EAs :-)
<h3>
<hr WIDTH="100%"><b><font color="#000099"><font size=+2>About this tutorial</font></font></b></h3>
This tutorial can be used in 2 different ways: algorithm-based and component-based.
<ul>
<li>
<a href="eoTopDown.html">Algorithm-Based</a> means you start from a <font color="#FF6600">very
simple, ready-to-run algorithm,</font> and gradually modify it, making
it both more powerful and more complex.</li>
<li>
<a href="eoBottomUp.html">Component-Based</a> means you start by examining
the
<font color="#FF6600">components of an EA one by one</font>, down to
the level of complexity you feel comfortable with, and then build the whole
algorithm using those components you need (or the one you are mastering).
Such approach might be viewed as going through a simplified user guide,
too.</li>
</ul>
However, it is <b><font color="#FF6600">strongly recommended</font></b>
that you take some time on the first lesson of the Algorithm-Based approach
to get familiar with the basic concepts that are used throughout EO. Anyway,
as of today, December 19, the Component-Based is only very sparsely written
:-)
<p>
<hr WIDTH="100%"><b><font color="#000099"><font size=+2>Links and Related
documents</font></font></b>
<ul>
<li>
There are of course a few (very few) <a href="eoProgramming.html">programming
hints</a> that you should know.</li>
<li>
THe <a href="../../doc/html/index.html">EO documentation </a>- automatically
generated from the comments in the code - is very helpful to get an idea
of the <b><font color="#FF6600">inheritance diagrams</font></b> of EO classes,
and to quickly reach some specific part of the code.</li>
<br>The top page of each class documentation is for instance the inheritance
diagram of the class, and you'll learn a lot by simply looking at it.
<li>
And, last but not least, we assume you know approximately that an Evolutionary
Algorithm looks like this, but otherwise you can try this <a href="eoIntroEA.html">very
brief introduction</a> (not written yet, Jan. 2001, sorry).</li>
</ul>
<p><br>
<hr WIDTH="100%"><b><font color="#000099"><font size=+2>Colors and navigation:</font></font></b>
<p>You will see this diagram in quite many places, as for instance at the
top of all examples - usually it will be clickable and will help you navigate
among the different parts of an EO program. See the <a href="eoIntroEA.html">brief
introduction to Evolutionary Computation</a> for a detailed explanation.
<center>
<p><img SRC="EA_tutorial.jpg" ></center>
<a NAME="colors"></a>
<p>But in the text itself, <b><font color="#FF6600">colors are important</font></b>,
as they will be used throughout this tutorial to clearly mark which part
of the algorithm we are discussing. So please keep in mind that, whereas
<b><font color="#FF6600">orange
is for emphasis</font></b>,
<ul>
<li>
<b><font color="#999900">Yellowish</font></b> is for <b><font color="#999900">representation</font></b>,
i.e. the choice of the <b><font color="#999900">genotype</font></b></li>
<li>
<font color="#CC33CC">Magenta</font> is for the <font color="#CC33CC">stochastic
operators</font> that are <b><font color="#999900">representation-dependent</font>,</b>
i.e. <font color="#CC33CC">initialisation</font> and variation operators
(<font color="#CC33CC">crossover</font>, <font color="#CC33CC">mutation</font>
and the like).</li>
<li>
<font color="#009900">Green</font> is for the implementation of <font color="#009900">Darwinism</font>,
i.e. the way the individuals are <font color="#009900">selected</font>
for reproduction and <font color="#009900">survive.</font></li>
<li>
<font color="#CC0000">Red</font> is for evaluation, i.e. the computation
of the <font color="#CC0000">fitness</font> of all individuals</li>
<li>
<font color="#3366FF">Blue</font> is for interactions of the user and the
program, as for instance choice of <font color="#3366FF">stopping criterion</font>,
on-line display of nice <font color="#3366FF">statistics</font> or initial
<font color="#3366FF">choice
of all program parameters</font>.</li>
<li>
<font color="#993300">Brown</font> is for everything that is NOT part of
any of the above, i.e. random number generator, or basic C++/STL syntax
.</li>
<li>
Note that <font color="#FF6666">pink</font> will be used to describe the
syntax of compile orders (i.e. at the operating system level, see e.g.
<a href="#install">below</a>).</li>
<li>
<b><font face="Arial,Helvetica"><font size=+1>Last, but not least, all
links into EO documentation will use the Helvetica typeface, like this
line you are now reading.</font></font></b></li>
</ul>
<hr WIDTH="100%"><b><font color="#000099"><font size=+1>This tutorial is
not</font></font></b>
<ul>
<li>
A course on Evolutionary Computation. You can find such things on the Internet,
maybe you can start <a href="http://www.wi.leidenuniv.nl/~gusz/Flying_Circus/">here.</a></li>
<li>
An interface that would allow you to build your Evolutionary Programs by
a few clicks; such a thing does exist, is called <a href="http://www-rocq.inria.fr/EASEA/">EASEA</a>,
and is complementary to this tutorial as it helps the user to build some
simple EO programs from simple description. But there are things that EASEA
cannot do, and you will have to do it yourself and will need to increase
your knowledge about EO for that - hence this tutorial.</li>
<li>
A coffee machine - though you might want to spend some time here when you're
tired of everything else, to improve your knowledge of EO slowly and gradually
rather than when you have something urgent to code :-)</li>
</ul>
<hr WIDTH="100%"><a NAME="install"></a><b><font color="#000099"><font size=+1>Before
you start</font></font></b>
<p>You should of course have downloaded and installed the whole <a href="http://www.sourceforge.net/projects/eodev">EO
library</a> (how did you get this file if not???).
<br>So we'll assume that you are now in the Tutorial directory, and that
your prompt looks something like
<p><b><tt><font color="#FF6666">(myname@myhost) EOdir/Tutorial %</font></tt></b>
<p>so you should now type in
<p><b><tt><font color="#FF6666">make lesson1</font></tt></b>
<p>and see something like
<p><font face="Courier New,Courier"><font color="#000000">(myname@myhost)
EOdir/Tutorial % make lesson1</font></font>
<br><b><tt><font color="#FF6666">c++ -DPACKAGE=\"eo\" -DVERSION=\"0.9.1\"
-I. -I../../src -Wall -g -c FirstBitGA.cpp</font></tt></b>
<br><b><tt><font color="#FF6666">c++ -Wall -g -o FirstBitGA FirstBitGA.o
../../src/libeo.a ../../src/utils/libeoutils.a</font></tt></b>
<br><b><tt><font color="#FF6666">c++ -DPACKAGE=\"eo\" -DVERSION=\"0.9.1\"
-I. -I../../src -Wall -g -c FirstRealGA.cpp</font></tt></b>
<br><b><tt><font color="#FF6666">c++ -Wall -g -o FirstRealGA FirstRealGA.o
../../src/libeo.a ../../src/utils/libeoutils.a</font></tt></b>
<p>and two now executable files should have appeared in the subdirectory
Lesson1, namely <b><tt><font color="#990000">FirstBitGA</font></tt></b>
and <b><tt><font color="#990000">FirstRealGA</font></tt></b> (see <a href="eoLesson1.html">First
lesson</a> to know more about these two ready-to-run programs). If this
doesn't work, please go back to the main EO directory and run the installation
program.
<p>You should also test that you can access the EO documentation in the
menu line below: you might not need to go there immediately, but just in
case you make rapid progress ... This menu bar should be on all pages of
this tutorial, allowing you to navigate easily.
<p>Last, but not least: EO is improving only&nbsp; from the good will of
contributors. This is also true for this tutorial: If you find anything
that you think could be improved, you are welcome to <a href="mailto:Marc.Schoenauer@polytechnique.fr">e-mail
me</a>.
<center>
<p><font color="#000099"><font size=+2>Enjoy!
<hr WIDTH="100%"></font></font><a href="eoTopDown.html">Algorithm-Based</a>
- <a href="eoBottomUp.html">Component-Based</a> - <a href="eoProgramming.html">Programming
hints</a> -<b><font size=+1> <font face="Arial,Helvetica"><a href="../../doc/html/index.html">EO
documentation</a></font></font></b></center>
<hr>
<address>
<a href="mailto:Marc.Schoenauer@polytechnique.fr">Marc Schoenauer</a></address>
<br><!-- Created: Mon Oct 30 07:27:13 CET 2000 --><!-- hhmts start -->Last
modified: Fri Nov 28 2000&nbsp;<!-- hhmts end -->
</body>
</html>