Corrected a few bugs after the first "public" presentation

This commit is contained in:
evomarc 2000-12-08 14:16:13 +00:00
commit 00b435f19a
9 changed files with 496 additions and 99 deletions

View file

@ -166,7 +166,7 @@ The actual code is in boldface and the comment in normal face.
<b> &nbsp; &nbsp; &nbsp;random(VEC_SIZE, boolean_generator());</b><br>
<b> &nbsp;</b>// Initialization of the population<br>
<b> &nbsp;eoPop&lt;Indi> pop(POP_SIZE, random);</b><br>
<b> &nbsp;</b>// and evaluate it in one line<br>
<b> &nbsp;</b>// and evaluate it in one loop<br>
<b> &nbsp;apply&lt;Indi>(eval, pop); </b>// STL syntax<br>
</font></tt>
</td>

View file

@ -117,13 +117,11 @@ The actual code is in boldface and the comment in normal face.
<b> &nbsp;const float P_CROSS = 0.8; </b>// Crossover probability<br>
<b> &nbsp;const float P_MUT = 0.5; </b>// mutation probability<br>
<b> &nbsp;const double EPSILON = 0.01; </b>// range for real uniform mutation<br>
<b> &nbsp;const double SIGMA = 0.01; </b>// std. dev. of normal mutation<br>
<b> &nbsp;</b>// some parameters for chosing among different operators<br>
<b> &nbsp;const double segmentRate = 0.5; &nbsp; &nbsp; &nbsp; &nbsp;</b>// rate for 1-pt Xover<br>
<b> &nbsp;const double arithmeticRate = 0.5; &nbsp; &nbsp; &nbsp; &nbsp;</b>// rate for 2-pt Xover<br>
<b> &nbsp;const double uniformMutRate = 0.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</b>// rate for bit-flip mutation<br>
<b> &nbsp;const double detMutRate = 0.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</b>// rate for one-bit mutation<br>
<b> &nbsp;const double normMutRate = 0.5; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</b>// rate for normal mutation<br>
</font></tt>
</td>
</tr>
@ -169,7 +167,7 @@ The actual code is in boldface and the comment in normal face.
<b> &nbsp; &nbsp;</b>// Initialization of the population<br>
<b> &nbsp;eoPop&lt;Indi> pop(POP_SIZE, random);</b><br>
<b> </b><br>
<b> &nbsp;</b>// and evaluate it in one line<br>
<b> &nbsp;</b>// and evaluate it in one loop<br>
<b> &nbsp;apply&lt;Indi>(eval, pop); </b>// STL syntax<br>
</font></tt>
</td>
@ -244,7 +242,7 @@ The actual code is in boldface and the comment in normal face.
<b> &nbsp;eoArithmeticCrossover&lt;Indi> xoverA;</b><br>
<b> &nbsp;</b>// Combine them with relative rates<br>
<b> &nbsp;eoPropCombinedQuadOp&lt;Indi> xover(xoverS, segmentRate);</b><br>
<b> &nbsp;xover.add(xoverA, arithmeticRate, eo_verbose);</b><br>
<b> &nbsp;xover.add(xoverA, arithmeticRate, true);</b><br>
</font></tt>
</td>
</tr>
@ -254,16 +252,13 @@ The actual code is in boldface and the comment in normal face.
<td>
<tt><font color="#993399">
<b> &nbsp;</b><br>
<b> &nbsp;</b>// Gaussian mutation - std dev as argument<br>
<b> &nbsp;eoNormalMutation&lt;Indi> &nbsp;mutationN(SIGMA); </b><br>
<b> &nbsp;</b>// offspring(i) uniformly chosen in [parent(i)-epsilon, parent(i)+epsilon]<br>
<b> &nbsp;eoUniformMutation&lt;Indi> &nbsp;mutationU(EPSILON); </b><br>
<b> &nbsp;</b>// k (=1) coordinates of parents are uniformly modified<br>
<b> &nbsp;eoDetUniformMutation&lt;Indi> &nbsp;mutationD(EPSILON); </b><br>
<b> &nbsp;</b>// Combine them with relative rates<br>
<b> &nbsp;eoPropCombinedMonOp&lt;Indi> mutation(mutationU, uniformMutRate);</b><br>
<b> &nbsp;mutation.add(mutationD, detMutRate);</b><br>
<b> &nbsp;mutation.add(mutationN, normMutRate, eo_verbose);</b><br>
<b> &nbsp;mutation.add(mutationD, detMutRate, true);</b><br>
<b> &nbsp;</b><br>
<b> &nbsp;</b>// The operators are &nbsp;encapsulated into an eoTRansform object<br>
<b> &nbsp;eoSGATransform&lt;Indi> transform(xover, P_CROSS, mutation, P_MUT);</b><br>

View file

@ -272,7 +272,7 @@ The actual code is in boldface and the comment in normal face.
<td>
<tt><font color="#993399">
<b> &nbsp;</b>// offspring(i) is a linear combination of parent(i)<br>
<b> &nbsp;eoSegmentCrossover&lt;Indi> xover;</b><br>
<b> &nbsp;eoArithmeticCrossover&lt;Indi> xover;</b><br>
</font></tt>
</td>
</tr>

View file

@ -396,7 +396,7 @@ rates</font></tt>
onePointRate);</font></tt></b>
<br><b><tt><font color="#993399">&nbsp;xover.add(xoverU, URate);</font></tt></b>
<br><b><tt><font color="#993399">&nbsp;xover.add(xover2, twoPointsRate,
eo_verbose);</font></tt></b></td>
true);</font></tt></b></td>
</tr>
</table>
<a NAME="mutation"></a>
@ -413,7 +413,7 @@ rates</font></tt>
<br><b><tt><font color="#993399">&nbsp;eoPropCombinedMonOp&lt;Indi> mutation(mutationBitFlip,
bitFlipRate);</font></tt></b>
<br><b><tt><font color="#993399">&nbsp;mutation.add(mutationOneBit, oneBitRate,
eo_verbose);</font></tt></b>
true);</font></tt></b>
<br><tt><font color="#993399"><b>&nbsp;</b>// The operators are&nbsp; encapsulated
into an eoTRansform object</font></tt>
<br><b><tt><font color="#993399">&nbsp;eoSGATransform&lt;Indi> transform(xover,

View file

@ -2,12 +2,13 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.72 [en] (X11; U; Linux 2.2.16 i686) [Netscape]">
<title>Genetic Engine</title>
</head>
<body>
<body text="#000000" link="#0000EF" vlink="#51188E" alink="#FF0000" background="beige009.jpg">
<a href="eoTopDown.html">Top-Down page</a> - <a href="eoBottomUp.html">Bottom-up
page</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>
<h1>
<b><font color="#CC0000">Evolution Engine</font></b></h1></center>
@ -27,33 +28,156 @@ Replacement</li>
Popular evolution engines</li>
</ul>
<p><br>The term evolution engine denotes the different parts that simulate
the Darwinism in Evolutionary Algorithms.<font color="#33CC00"></font>
<p><br><b><font color="#000099"><font size=+2>Introduction</font></font></b>
<br>The term evolution engine denotes the different parts that simulate
the Darwinism in Evolutionary Algorithms.
<center>
<p><i><font color="#33CC00">The fittest individuals are more likely to
<p><i><font color="#009900">The fittest individuals are more likely to
reproduce and survive.</font></i></center>
<p>Darwinism takes place in two different phases of an EA, though in many
<a href="#popular">popular variants</a>, only one phase is activated.
<a href="#popular">popular
variants</a>, only one phase is activated.
<p><a href="#selection">Selection</a> is the Darwinistic choice of parents
that will be allowed to <font color="#33CC00">reproduce</font><font color="#CC33CC">.</font>
that will be allowed to <b><font color="#009900">reproduce</font></b><font color="#CC33CC">.</font>
<br><a href="#replacement">Replacement</a> takes place after reproduction,
and is the Darwinistic choice of those individuals that will <font color="#33CC00">survive</font>,
and is the Darwinistic choice of those individuals that will <b><font color="#009900">survive</font></b>,
i.e. become the parents of the next generation.
<p><a NAME="selection"></a><b><font color="#000099"><font size=+2>Selection</font></font></b>
<br>&nbsp;
<p><a NAME="replacement"></a><b><font color="#000099"><font size=+2>Replacement</font></font></b>
<br>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
interface</font></b>
<br>The abstract class for replacement procedures is the functor class
<font color="#009900">eoReplacement</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;
_parents, eoPop&lt;EOT>&amp; _offspring)</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_eoreplacement.html">eoReplacement</a></font></font></b>.,
as you see there that <font color="#009900">eoReplacement</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>
(called, for obvious anthropomorphic reasons, _parents and _offspring :-)
and puts the result into population offspring (as _parents is passed as
<b><tt><font color="#993300">const</font></tt></b>ant
population).
<p><b><font color="#FF0000">Note</font></b>: After the replacement step,
all algorithms swap the parents and offspring populations - this is why
the result of the replacement is put into the _offspring population --
the _parents being there untouched until the very last moment.
<p><b><font color="#000099">Replacement: </font><font color="#FF0000">Instances</font></b>
<ul>
<li>
The most straightforward replacement is ... <font color="#FF6600">no replacement</font>,
or, more precisely, <font color="#FF6600">generational replacement</font>:
all offspring replace all parents (used in Holland's and Goldberg's traditional
GAs). In EO, this is implemented in the <b><tt><font color="#009900">eoNoReplacement</font></tt></b>
class, whose <tt><font color="#993300">operator()</font></tt> does ...
<font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/eoreplacement_h-source.html#l00051">exactly
nothing</a></font></font> (remember that _parents and _offspring will be
swapped later on).</li>
<br>&nbsp;
<li>
But the basic type of replacement in EO 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. The functor class is called <b><tt><font color="#009900">eoMergeReduce</font></tt></b>.
and it <font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/eoreplacement_h-source.html#l00064">contains
two objects</a></font></font> of respective types <b><font color="#009900">eoMerge</font></b>
and <b><font color="#009900">eoReduce</font></b> and you can probably guess
what each of them actually does :-)</li>
<br>&nbsp;
<p>&nbsp;
<p>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>,
that adds only some of the (best) parents to the offspring. A special case
of eoElistism is <b><tt><font color="#009900">eoNoElitism</font></tt></b>,
an eoMerge that does nothing.
<br>&nbsp;
<p>Available <font color="#FF6600">instances of eoReduce</font> are <b><tt><font color="#009900">eoTruncate</font></tt></b>,
that deterministically keeps only the required number of individuals, taking
the best ones, and <b><tt><font color="#009900">eoEPReduce</font></tt></b>
that usees the EP stocahstic tournamenent to reduce the population.
<p>Available <font color="#FF6600">instances of eoMergeReduce</font> replacement
procedures are built on the above, and include
<ul>
<li>
<b><tt><font color="#009900">eoCommaReplacement</font></tt></b>, one of
the two standard strategies in <font color="#FF6600">Evolution Strategies</font>,
selects the best offspring. 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
standard <font color="#FF6600">Evolution Startegies</font> replacement,
where the best from offspring+parents become the next generation. It is
an <b><tt><font color="#993300">eoMergeReduce(eoPlus, eoTruncate)</font></tt></b>.</li>
<li>
<b><tt><font color="#009900">eoEPReplacement</font></tt></b>, from <font color="#FF6600">Evolutionary
Programming</font> historical algorithm, doing a stochastic tournament
among parents + offspring. It is an <b><tt><font color="#993300">eoMergeReduce(eoPlus,
eoEPReduce)</font></tt></b>.</li>
</ul>
<li>
Another type of eoReplacement is eoKillReplace in which some individuals
of the population are reaplced by some of the offspring.</li>
</ul>
<p><br><b><font color="#000099">Replacement: </font><font color="#FF0000">Adding
(weak) elitism</font></b>
<br>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>
object. Weak elitism ensures that the overall <font color="#FF6600">best
fitness</font> in the population <font color="#FF6600">will never decrease</font>:
if the best fitness in the new population is less than the best fitness
of the parent population, then the best parent is added back to the new
population, replacing the worse.
<p>Within EO, this is very easy to add:
<p>First, declare your replacement functor (here, generational, but it
can be any replacement object):
<br><b><tt><font color="#009900">eoNoReplacement&lt;Indi> genReplace;</font></tt></b>
<br>Then wrap the weak elitism around it:
<br><b><tt><font color="#009900">eoWeakElitismReplacement&lt;Indi> replace(genReplace);</font></tt></b>
<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><a NAME="popular"></a><b><font color="#000099"><font size=+2>Popular
evolution engines</font></font></b>
<br>&nbsp;
<br>&nbsp;
<p>
<br>The most popular evolution engines are listed below, together with
the way to use them in EO. If you don't find your particuler algorithm,
please send it to us, and we might include it here!
<ul>
<li>
Generational Genetic Algorihtm</li>
</ul>
<p><br>
<hr WIDTH="100%"><a href="eoTopDown.html">Top-Down page</a> - <a href="eoBottomUp.html">Bottom-up
page</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>
<a href="mailto:marc@cmapx.polytechnique.fr">Marc Schoenauer</a></address>
<a href="mailto:Marc.Schoenauer@polytechnique.fr">Marc Schoenauer</a></address>
<br><!-- Created: Mon Oct 30 18:15:16 CET 2000 --><!-- hhmts start -->Last
modified: Mon Oct 30 18:15:17 CET 2000<!-- hhmts end -->
<br><!-- Created: Mon Oct 30 07:27:13 CET 2000 --><!-- hhmts start -->Last
modified: Tue. Dec. 5 2000&nbsp;<!-- hhmts end -->
</body>
</html>

View file

@ -219,7 +219,10 @@ objects of class</font> <b><font face="Arial,Helvetica"><font size=+1><a href=".
(unary operator).&nbsp; These operators are applied in turn to all selected
parents, according to user-defined probabilities.&nbsp; These probabilities
are defined with all other <a href="#parametres">parameters</a>, and will
be passed to the <b><tt><font color="#FF6666"><font size=+1>eoSGA </font></font></tt></b><a href="#parametres">algorithm</a><font color="#000000">.</font></li>
be passed to the <b><tt><font color="#FF6666"><font size=+1>eoSGA </font></font></tt></b><a href="#parametres">algorithm</a><font color="#000000">.&nbsp;
For more details on these classes, go to the <a href="eoOperators.html#crossover">top-down
corresponding pages</a>, or to their respective documentation pages.</font><br>
<BR></li>
<ul>
<li>
@ -240,7 +243,7 @@ bit, which is specific of the bit-flip mutation.&nbsp; Hence, to run the
same algorithm as Goldberg's SGA, the mutation probability (at individual
level) is 1, and the probability of flipping each bit is <b><tt>P_MUT_PER_BIT.</tt></b>
<li>
<a href="FirstRealGA.html#operators">Real</a> The crossover <b><font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/class_eosegmentcrossover.html">eoSegmentCrossover</a></font></font></b>
<a href="FirstRealGA.html#operators">Real</a> The crossover <b><font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/class_eoarithmeticcrossover.html">eoArithmeticCrossover</a></font></font></b>
is the standard <font color="#CC33CC">arithmetic crossover</font> for real-valued
vectors, that chooses a point randomly on the segment between both parents
(also termed <font color="#CC33CC">BLX-0</font>). <b><font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/class_eouniformmutation.html">eoUniformMutation</a></font></font></b>

View file

@ -82,8 +82,10 @@ have to declare 3 template arguments: the type of EO object it will be
applied to, the return type and the type of argument the function actually
requires.</font></li>
<p><br><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>)
<br>&nbsp;
<p>&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
type of EO object, third = first).</font>
<br>&nbsp;
@ -113,24 +115,28 @@ the eoPop has no idea of the eval function, so it has to be done from outside!!!
<a NAME="combined_operators"></a><font color="#000000">You can now use
</font><font color="#CC33CC"><b>different
</b>crossover
</font><font color="#000000">and</font><font color="#CC33CC"> mutation
<b>operators</b></font><font color="#000000">in
the same algorithm, choosing among them according to
</font><font color="#000000">and</font><font color="#CC33CC">
mutation
<b>operators</b></font><font color="#000000">in the same algorithm,
choosing among them according to
</font><b><font color="#FF6600">relative
rates.</font></b><font color="#CC33CC"> </font><font color="#000000">The
class </font><font color="#CC33CC"><b>eoPropCombinedxxxOp</b>,
</font><font color="#000000">where
xxx is either Mon (for mutations, of class </font><font color="#CC33CC"><b><tt>eoMonOp</tt></b>)</font><font color="#000000">
or Quad (for crossovers, of class </font><b><tt><font color="#CC33CC">eoQuadOp</font></tt></b><font color="#000000">),
xxx is either Mon (for mutations, of class <b><font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/class_eomonop.html">eoMonOp</a></font></font></b></font><font color="#CC33CC">)</font><font color="#000000">
or Quad (for crossovers, of class <b><font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/class_eoquadraticop.html">eoQuadOp</a></font></font></b>),
is derived from the corresponding eoxxxOp class. When applying the eoPropCombinedxxxOp,
one of the eoxxxOp it contains is chosen by a <a href="../../doc/html/class_eorng.html#a12">roulette
wheel,</a> according to their respective rates, and is applied to the arguments.</font></li>
wheel,</a> according to their respective rates, and is applied to the arguments.
For more details on these classes, go to the <a href="eoOperators.html#crossover">top-down
corresponding pages</a>, or to their respective documentation pages.</font></li>
<ul>
<li>
<font color="#000000"><a href="FirstBitEA.html#operators">Bit</a>&nbsp;<br>
Three </font><b><font color="#FF6600">crossover operators</font></b><font color="#000000">
are available: the </font><font color="#FF6600">one-point</font><font color="#000000">
<font color="#000000"><a href="FirstBitEA.html#operators">Bit</a></font></li>
<br><font color="#000000">Three </font><b><font color="#FF6600">crossover
operators</font></b><font color="#000000"> are available: the </font><font color="#FF6600">one-point</font><font color="#000000">
crossover is still there (class ), but now you also have the </font><font color="#FF6600">N-point</font><font color="#000000">
crossover </font><font color="#CC33CC">eoBinNxOver</font><font color="#000000">
(the&nbsp; number of points is 2 by default, but as always you can change
@ -138,45 +144,44 @@ that in the constructor), and the </font><font color="#FF6600">Uniform</font><fo
crossover </font><font color="#CC33CC">eoBinUxOver</font><font color="#000000">
(where you can eventually twidle the choice from one parent to the other
by providing a probability in the constructore - defaulted to 0.5, which
amounts to symmetrical choice).<br>
As for </font><b><font color="#FF6600">mutation operators</font></b><font color="#000000">,
apart from the </font><font color="#CC33CC">eoBinMutation</font><font color="#000000">
amounts to symmetrical choice).</font>
<br><font color="#000000">As for </font><b><font color="#FF6600">mutation
operators</font></b><font color="#000000">, apart from the </font><font color="#CC33CC">eoBinMutation</font><font color="#000000">
(standard bitstring mutation flipping one bit with a given probability)
you can also use the </font><font color="#CC33CC">eoDetBitFlip</font><font color="#000000">
that always filps the same number of bits (1 by default, but you can change
that in the constructor), randomly chosen in the bitstring. Even though
the average number of bits flipped is the same if the </font><font color="#CC33CC">eoBinMutation
</font><font color="#000000">is used with a rate of 1/N (N is the bitstring
length) </font><font color="#FF6600">the behavior of these mutation can
be very different</font><font color="#000000"> on many problems.</font></li>
</font><font color="#000000">is
used with a rate of 1/N (N is the bitstring length) </font><font color="#FF6600">the
behavior of these mutation can be very different</font><font color="#000000">
on many problems.</font>
<li>
<font color="#000000"><a href="FirstRealEA.html#operators">Real</a>&nbsp;<br>
Two </font><b><font color="#FF6600">crossover operators</font></b><font color="#000000">
are available: the </font><font color="#CC33CC">eoSegmentCrossover</font><font color="#000000">
<font color="#000000"><a href="FirstRealEA.html#operators">Real</a></font></li>
<br><font color="#000000">Two </font><b><font color="#FF6600">crossover
operators</font></b><font color="#000000"> are available: the </font><font color="#CC33CC">eoSegmentCrossover</font><font color="#000000">
chooses one point uniformly on the segment joining the parents, while the
</font><font color="#CC33CC">eoArithmeticCrossover</font><font color="#000000">
performs a segment crossover on each coordinate independently, which amount
to choosing the offspring uniformly in the hypercube whose diagonal is
the segment joining the parents.<br>
As for </font><b><font color="#FF6600">mutation operators</font></b><font color="#000000">,
apart from the </font><font color="#CC33CC">eoBinMutation</font><font color="#000000">
the segment joining the parents.</font>
<br><font color="#000000">As for </font><b><font color="#FF6600">mutation
operators</font></b><font color="#000000">, apart from the </font><font color="#CC33CC">eoBinMutation</font><font color="#000000">
(standard bitstring mutation flipping one bit with a given probability)
you can also use the </font><font color="#CC33CC">eoDetBitFlip</font><font color="#000000">
that always filps the same number of bits (1 by default, but you can change
that in the constructor), randomly chosen in the bitstring. And last but
not least, the normal mutation eoNormMutation modifies all coordinates
with a Gaussian noise, with standard deviation passed in the constructor.</font><br>
<BR></li>
</ul>
with a Gaussian noise, with standard deviation passed in the constructor.</font></ul>
<b><font color="#FF0000">Note:</font></b> A third optional argument in
method <b><tt><font color="#660000">add</font></tt></b> is a boolean (defaulted
to false). When true, the actual rates for all operators are displayed
on the screen as percentages: you don't have to input rates that sum up
to 1, all rates are scaled anyway.
<p><b><font color="#FF0000">Note:</font></b> The operators have to be encapsulated
into an <b><tt><font color="#CC33CC">eoTransform</font></tt></b> object
(<a href="FirstBitEA.html#transform">Bit</a> - <a href="FirstRealEA.html#transform">Real</a>)
<p><a NAME="transform"></a><b><font color="#FF0000">Note:</font></b> The
operators have to be encapsulated into an <b><tt><font color="#CC33CC">eoTransform</font></tt></b>
object (<a href="FirstBitEA.html#transform">Bit</a> - <a href="FirstRealEA.html#transform">Real</a>)
to be passed to the <b><tt><font color="#FF6666">eoEasyEA </font></tt></b>algorithm.
The <b><tt><font color="#CC33CC">eoSGATransform</font></tt></b> is a simple
<b><tt><font color="#CC33CC">eoTransform</font></tt></b>

View file

@ -2,55 +2,326 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.72 [en] (X11; U; Linux 2.2.16 i686) [Netscape]">
<meta name="GENERATOR" content="Mozilla/4.75 [en] (X11; U; Linux 2.2.17-21mdksmp i686) [Netscape]">
<title>Variation Operators</title>
</head>
<body>
<body text="#000000" link="#0000EF" vlink="#51188E" alink="#FF0000" background="beige009.jpg">
<a href="eoTopDown.html">Top-Down page</a> - <a href="eoBottomUp.html">Bottom-up
page</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%">
<br><b><font color="#FF0000">TOC</font></b> : <a href="#introduction">Introduction</a>
- <a href="#crossover">Crossover</a> - <a href="#mutation">Mutation</a>
- <a href="#proportional_simple">Simple combinations</a> - <a href="#general">General
Operators</a> - <a href="#general_combination">General combinations</a>
<br>
<hr WIDTH="100%">
<center>
<h1>
<b><font color="#000099">Variation Operators</font></b></h1>
Variation operators modify individuals, or, equivalently, move them in
the search space. They are almost always <font color="#FF0000">stochastic</font>,
i.e. they generate random variations. Variation operators are classified
depending on the number of arguments they use and/or modify.
<p>Variation operators involving two individuals are called
<a href="##crossover">crossover operators</a>.
They can either modify one of the parents according
to the material of the other parent, or modify both parents. In EO, the
former are called Binary operators and the latter Quadratic operators.
<br>&nbsp;
<p>Variation operators involving one single individual are called <a href="##mutation">mutation
operators.</a>
<p>Note that in EO you can define and use variatio operators that generate
any number of offspring fromany number of parents. These are called general
operators, and require advanced knowledge of EO.
<p><a NAME="#crossover"></a><b><font color="#000099"><font size=+2>Crossover</font></font></b>
<br>Crossover operators involve two parents, and can modify one of them,
or both of them.
<p>Using crossover operators
<p><a NAME="#mutation"></a><b><font color="#000099"><font size=+2>Mutation</font></font></b>
<br>Mutation operators modify one single individual. The corresponding
EO class is called eoMonOp.
<h2>
<font color="#009900"><font size=+1>Using mutation operators</font></font></h2>
The standard EO genotypes (bistrings and real vectors) have pre-defined
mutation operators.
<br>&nbsp;
<h2>
<font color="#009900"><font size=+1>Writing a mutation operator</font></font></h2>
&nbsp;
<p>&nbsp;
<p><a NAME="general"></a><b><font color="#000099"><font size=+2>General
<b><font color="#CC0000">Variation Operators</font></b></h1></center>
<p><br><a NAME="introduction"></a><b><font color="#000099"><font size=+2>Variation
Operators</font></font></b>
<br>Variation operators modify individuals, or, equivalently, move them
in the search space. They are almost always <b><font color="#FF6600">stochastic</font></b>,
i.e. they are based on random numbers, or equivalently, perform random
modifications of their arguments. Variation operators are classified depending
on the number of arguments they use and/or modify.
<p>Variation operators involving two individuals are called <a href="#crossover">crossover
operators</a>. They can either modify one of the parents according to the
material of the other parent, or modify both parents. In EO, the former
are called Binary operators and the latter Quadratic operators.
<br>Variation operators involving one single individual are called <a href="#mutation">mutation
operators.</a>
<br>In EO you can also define and use variation operators that generate
any number of offspring from any number of parents (sometimes termed <b><font color="#FF6600">orgy</font></b>
operators). They are called <a href="#general">general operators</a>.
<p>Though most the historical evolutionary algorithms used at most one
crossover and one mutation (see e.g. the Simple Genetic Algorithm in <a href="eoLesson1.html">lesson1</a>),
the trend now in evolutionary computation is to combine operators, choosing
at run-time and for each individual which operator to apply. This can be
done in the framework of simple operators, combining for instance several
mutations into a variation operator that chooses one of them according
to user-defined preferences: such combinations are called in EO <a href="#proportional_simple">proportional
combination of simple operators</a> (see e.g. how to define and use such
combined operators in the SGA of <a href="eoLesson2.html">lesson2</a>).
<p>Finally, there are many other ways to combine different variation operators
of different kind. Within EO, you can choose to apply many different types
of operator to the population, either in turn (this is called sequential
combination) or by randomly choosing among a set of operators at a given
time (this is proportional combination, generalizing the one defined for
simple operators). You can of course mix and interleave both approaches
at will, and this is described as <a href="#general_combination">general
combination of general operators</a>.
<p><b><font color="#FF0000">EO implementation</font></b>: all variation
operators in EO derive from the base (abstract) class <b><font face="Arial,Helvetica"><font size=+1><a href="../../doc/html/class_eoop.html">eoOp</a></font></font></b>
(as usual, click to see the inheritance diagram). blabla
<br>
<hr WIDTH="100%">
<br><a NAME="crossover"></a><b><font size=+1><font color="#000099">Simple
operators: </font><font color="#FF0000">Crossover</font></font></b>
<p>The characteristic of crossover operators is that they involve two parents.
However, there are crossover operators that generate two parents, and some
that generate one parent only, and both types are available in EO. The
former type (2 --> 2) is termed quadratic crossover operator, and is implemanted
in the <b><font color="#CC33CC">eoQuadOp</font></b> class; the latter type
(2 --> 1) is termed binary operator and is implemanted in class <b><font color="#CC33CC">eoBinOp</font></b>.
Both classes are, as usual, templatized by the type of individual they
can handle (see documentation for <b><font face="Arial,Helvetica"><font size=+1><a href="doc/html/class_eobinop.html">eoBinOp</a></font></font></b>
and <b><font face="Arial,Helvetica"><font size=+1><a href="doc/html/class_eoquadop.html">eoQuadOp</a></font></font></b>).
<p><b><font color="#FF0000">Note:</font></b> Whereas it is straightforward
to create a binary crossover operator from a quadratic one (by discarding
the changes on the second parent), the reverse might prove impossible (imagine
a binary crossover that simply merges the parents material: there is no
way to generate two new parents from that!).
<p><b><font color="#FF0000">Interfaces</font></b>:
<br>The general approach in EO about simple variation operators is to perform
<b><font color="#FF6600">in-place
modifications</font></b>, i.e. modifying the arguments rather than generating
new (modified) individuals. This results in the following interfaces for
the functor objects eoBinOp and eoQuadOp:
<p><b><tt><font color="#993300">void operator()(EOT &amp; , const EOT &amp;)&nbsp;</font></tt></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
for eoBinOp (note the const)
<br><b><tt><font color="#993300">void operator()(EOT &amp; , EOT &amp;
)&nbsp;</font></tt></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
for eoQuadOp
<p>which you could have guessed from the inheritance diagrams up to the
eoBF abstract class. You can also guess that only the first argument will
be modified by an oeBin object, while both arguments will be modified by
an eoQuad object.
<p><b><font color="#FF0000">Using crossover operators</font></b>:
<br>Directly applying crossover operators is straightforward from the interface
above:
<br><b><tt><font color="#993300">eoBinOpDerivedClass&lt;Indi> myBinOp(parameters);&nbsp;&nbsp;&nbsp;&nbsp;
//&nbsp; use constructor to pass</font></tt></b>
<br><b><tt><font color="#993300">eoQuadOpDerivedClass&lt;Indi> myQuadOp(parameters);&nbsp;&nbsp;
//&nbsp; any useful argument</font></tt></b>
<br><b><tt><font color="#993300">Indi eo1= ..., eo2= ...;&nbsp;&nbsp; //
the candidates to crossover</font></tt></b>
<br><b><tt><font color="#993300">myBinOp(eo1, eo2);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// will modify eo1 only</font></tt></b>
<br><b><tt><font color="#993300">myQuadOp(eo1, eo2);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// will modify eo1 and eo2</font></tt></b>
<p>However, you will hardly have to do so, as operators are used within
other classes, and are applied systematically to whole sets of individuals
(e.g. that have already been selected, in standard generational evolutionary
algorithms).
<br>Hence the way to use such operators will more likely ressemble, if
you are using for instance an SGA, this (<a href="FirstRealGA.html#operators">definition</a>,
<a href="FirstRealGA.html#generation">usage</a>).
See also the different ways that are described below, encapsulating the
operators into combined operators objects.
<br>&nbsp;
<p><a NAME="writing_crossover"></a><b><font color="#FF0000">Writing a crossover
operator:</font></b>
<br>There are only two things to modify in the <a href="../Templates/crossover.tmpl">template
class definitions</a> provided (apart from the name of the class you are
creating!)
<ul>
<li>
The <font color="#FF6600">constructor</font>, where you pass to the object
any useful parameter</li>
<li>
The <font color="#FF6600">operator()</font> method, which performs the
actual crossover.</li>
<li>
<b><font color="#FF6600">Warning</font></b>: don't forget to <b><font color="#FF6600">invalidate</font></b>
the fitness of any individual that has actually been modified. Otherwise,
the l<a href="eoEval.html#lazy">azy fitness evaluation procedure</a> in
EO will not know it should compute the fitness again and will keep the
old value.</li>
</ul>
<p><br>
<hr WIDTH="100%"><a NAME="mutation"></a><b><font color="#000099"><font size=+1>Simple
operators: </font></font><font color="#FF0000"><font size=+2>Mutation</font></font></b>
<br>Mutation operators modify one single individual. The corresponding
EO class is called <b><font color="#CC33CC">eoMonOp</font></b>. and it
si as usual templatized by the type of individual it can handle (see documentation
for <b><font face="Arial,Helvetica"><font size=+1><a href="doc/html/class_eomonop.html">eoMonOp</a></font></font></b>).
<p><b><font color="#FF0000">Interfaces</font></b>:
<br>The general approach in EO about simple variation operators is to perform
<b><font color="#FF6600">in-place
modifications</font></b>, i.e. modifying the arguments rather than generating
new (modified) individuals. This results in the following interface for
the functor objects eoMonOp:
<p><b><tt><font color="#993300">void operator()(EOT &amp; )</font></tt></b>
<p>which you could have guessed from the inheritance diagrams up to the
eoUF abstract class.
<p><b><font color="#FF0000">Using mutation operators</font></b>:
<br>Directly applying mutation operators is straightforward from the interface
above:
<br><b><tt><font color="#993300">eoMonOpDerivedClass&lt;Indi> myMutation(parameters);
//pass parameters in constructor</font></tt></b>
<br><b><tt><font color="#993300">Indi eo1 = ...;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// eo1 is candidate to mutation</font></tt></b>
<br><b><tt><font color="#993300">myMutation(eo1);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// will modify eo1</font></tt></b>
<p>However, you will hardly have to do so, as operators are used within
other classes, and are applied systematically to whole sets of individuals
(e.g. that have already been selected, in standard generational evolutionary
algorithms).
<br>Hence the way to use such operators will more likely ressemble, if
you are using for instance an SGA, this (<a href="FirstRealGA.html#operators">definition</a>,
<a href="FirstRealGA.html#generation">usage</a>).
See also the different ways that are described below, encapsulating the
operators into combined operators objects.
<p><a NAME="writing_mutation"></a><b><font color="#FF0000">Writing a mutation
operator:</font></b>
<br>There are only two things to modify in the <a href="../Templates/mutation.tmpl">template
class definitions</a> provided (apart from the name of the class you are
creating!)
<ul>
<li>
The <font color="#FF6600">constructor</font>, where you pass to the object
any useful parameter</li>
<li>
The <font color="#FF6600">operator()</font> method, which performs the
actual crossover.</li>
<li>
<b><font color="#FF6600">Warning</font></b>: don't forget to <b><font color="#FF6600">invalidate</font></b>
the fitness of the individual - if it has actually been modified. Otherwise,
the <a href="eoEval.html#lazy">lazy fitness evaluation procedure</a> in
EO will not know it should compute the fitness again and will keep the
old value.</li>
</ul>
<hr WIDTH="100%">
<br><a NAME="proportional_simple"></a><b><font size=+1><font color="#000099">Combining
simple operators: </font><font color="#FF0000">proportional combinations</font></font></b>
<p>The best thing to do is to go to the <a href="eoLesson2.html#combined_operators">Lesson2</a>
of the tutorial, where everything is explained.
<p>
<hr WIDTH="100%"><a NAME="general"></a><b><font color="#000099"><font size=+2>General
Operators</font></font></b>
<br><b><font color="#000099"><font size=+2></font></font></b>&nbsp;
<br><b><font color="#000099"><font size=+2></font></font></b>&nbsp;
<br>&nbsp;
<p>
<hr WIDTH="100%"><a NAME="general_combination"></a><b><font color="#000099"><font size=+2>General
Combinations:</font></font></b>
<p>There are two main ways to use and combine general operators in EO:
the proportional combination, similar to what has been described for simple
operators above, and the sequential combination, which amounts to apply
all operators in turn to a bunch of individuals, each operator being applied
with a specific probability.
<p><b><font color="#FF0000">Proportional combinations</font></b> behave
like a unique operator: when it is called upon a population of candidates,
an <b><font color="#CC33CC">eoProportionalOpContainer</font></b> enters
the following loop:
<p>while there are individuals left in the candidate population
<ul>
<li>
choose one of the included operators according to their relative rates
by some roulette wheel random choice</li>
<li>
find out the number of parents that it requires (haha, the tricky part
if e.g. sequentialOp are imbedded :-)</li>
<li>
gets the required number of individual from the candidates,</li>
<li>
applies the chosen operator to those parents, generating a list of offspring</li>
<li>
removes the parents from the candidate population</li>
<li>
append the offspring to the result population</li>
</ul>
<b><font color="#FF0000">Sequential combinations</font></b> behave like
a unique operator: when it is called upon a population of candidates, an
<b><font color="#CC33CC">eoSequentialOpContainer</font></b>
enters the following loop:
<p>for all operators it contains, apply the operator to the candidate population,
that is
<ul>
<li>
start with an empty offspring population</li>
<li>
get the number of parents the operator at hand requires (haha, the tricky
part if the operator is an eoProportionalOpContainer!!!)</li>
<li>
flip a coin according to the operator rate. It heads, apply the operator
to the parents to generate some offspring, and append the generated offspring
to the offspring population. If tails, directly append the parents to the
offspring population</li>
<li>
until no more parents (or an insufficient number of parents) are left in
the population. The remaining parents, if any, are copied in the offspring
population</li>
<li>
make the offspring population the parentpopulation for next operator.</li>
</ul>
<font color="#FF6600">Remark:</font>The eoSGATransform presented in <a href="eoLesson2.html#transform">Lesson2</a>
can be viewed as a particular type of <b><font color="#CC33CC">eoSequentialOpContainer</font></b>.
It was not coded that way in order to provide a gradual introduction to
all concepts.
<br><font color="#FF6600">Exercise</font>: write the code to perform an
eoSGA using the eoOpContainer constructs.
<p><font color="#FF6600">Remark</font>: there is actually a single list
of individuals that is maintained through a clever mecahnism of mark, rewind
and unmark, but that's a purely technical matter. If you are interested,
go and check the eoOpContainer and the eoSequentialOpContainer code.
<br>&nbsp;
<p><b><font color="#FF0000">Adding operators to a container:</font></b>
<br>The basic function to add an operator to an eoOpContainer is the method
<b><tt><font color="#993300">add</font></tt></b>
from class eoOpContainer.
<br>It is similar to all other <b><tt><font color="#993300">add</font></tt></b>
methods in other Combined things in eo (as the simple eoProportionalCombinedXXXop
described above, but also the eoCombinedContinue class or the eoCheckPoint
class).
<br>The syntax is straightforward, and it works with any of the operator
classes defined above:
<p><b><tt><font color="#993300">someOperatorType&lt;Indi> myOperator;</font></tt></b>
<br><b><tt><font color="#993300">eoXXXOpContainer&lt;Indi> myOpContainer;</font></tt></b>
<br><tt><font color="#993300"><b>myOpContainer.add(myOperator, rate); </b>//
rate: double whose <b>meaning depends on XXX</b></font></tt>
<p>where XXX can be one of Proportional and Sequential.
<br>However, the way <b><tt><font color="#993300">rate</font></tt></b>
will be used is highly dependent on the type of OpContainer your are creating
there:
<ul>
<li>
The rates for <b><font color="#CC33CC">eoProportionalOpContainer</font></b>
will be used in a roulette wheel choice among all operators. They can take
any value, the only important thing is their <b><font color="#FF6600">relative
values</font></b>.</li>
<li>
The "rates" for <b><font color="#CC33CC">eoSequentialOpContainer </font></b>actually
are probabilities, i.e. they will be used in a coin-flipping to determine
whether that particuler operator will be applied to the next candidates
at hand. They should be <b><font color="#FF6600">in [0,1]</font></b> (no
error will happen if they are not, but the operator will be applied systematically
- this is equivalent of a rate equal to 1).</li>
</ul>
<p><br>
<hr WIDTH="100%"><b><font color="#FF0000">TOC</font></b> : <a href="#introduction">Introduction</a>
- <a href="#crossover">Crossover</a> - <a href="#mutation">Mutation</a>
- <a href="#proportional_simple">Simple combinations</a> - <a href="#general">General
Operators</a> - <a href="#general_combination">General combinations</a>
<br>
<hr WIDTH="100%"><a href="eoTopDown.html">Top-Down page</a> - <a href="eoBottomUp.html">Bottom-up
page</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>
<a href="mailto:marc@cmapx.polytechnique.fr">Marc Schoenauer</a></address>
<a href="mailto:Marc.Schoenauer@polytechnique.fr">Marc Schoenauer</a></address>
<br><!-- Created: Mon Oct 30 18:16:54 CET 2000 --><!-- hhmts start -->Last
modified: Mon Oct 30 18:24:39 CET 2000<!-- hhmts end -->
<br><!-- Created: Mon Oct 30 07:27:13 CET 2000 --><!-- hhmts start -->Last
modified: Fri Dec. 8 2000&nbsp;<!-- hhmts end -->
</body>
</html>

View file

@ -2,7 +2,6 @@
<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">