diff --git a/eo/tutorial/html/FirstBitEA.html b/eo/tutorial/html/FirstBitEA.html index db1f28cf..9474a5fa 100644 --- a/eo/tutorial/html/FirstBitEA.html +++ b/eo/tutorial/html/FirstBitEA.html @@ -8,7 +8,7 @@ Back to Lesson 2 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
@@ -355,7 +355,7 @@ The actual code is in boldface and the comment in normal face.
Back to Lesson 2 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
diff --git a/eo/tutorial/html/FirstBitGA.html b/eo/tutorial/html/FirstBitGA.html index 07df1924..ef40176a 100644 --- a/eo/tutorial/html/FirstBitGA.html +++ b/eo/tutorial/html/FirstBitGA.html @@ -8,7 +8,7 @@ Back to Lesson 1 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
@@ -337,7 +337,7 @@ The actual code is in boldface and the comment in normal face.
Back to Lesson 1 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
diff --git a/eo/tutorial/html/FirstRealEA.html b/eo/tutorial/html/FirstRealEA.html index 03505b29..fb524dea 100644 --- a/eo/tutorial/html/FirstRealEA.html +++ b/eo/tutorial/html/FirstRealEA.html @@ -7,7 +7,7 @@ Back to Lesson 2 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
@@ -353,7 +353,7 @@ The actual code is in boldface and the comment in normal face.
Back to Lesson 2 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
diff --git a/eo/tutorial/html/FirstRealGA.html b/eo/tutorial/html/FirstRealGA.html index 7bd1b168..40224cf9 100644 --- a/eo/tutorial/html/FirstRealGA.html +++ b/eo/tutorial/html/FirstRealGA.html @@ -8,7 +8,7 @@ Back to Lesson 1 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
@@ -336,7 +336,7 @@ The actual code is in boldface and the comment in normal face.
Back to Lesson 1 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
diff --git a/eo/tutorial/html/FirstRealGA_old.html b/eo/tutorial/html/FirstRealGA_old.html index 3eacbd00..a634f529 100644 --- a/eo/tutorial/html/FirstRealGA_old.html +++ b/eo/tutorial/html/FirstRealGA_old.html @@ -7,7 +7,7 @@ Back to Lesson 1 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
@@ -265,7 +265,7 @@ e)
}


Back to Lesson 1 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
diff --git a/eo/tutorial/html/Firstmerge.html b/eo/tutorial/html/Firstmerge.html index f7709b7a..6345d865 100644 --- a/eo/tutorial/html/Firstmerge.html +++ b/eo/tutorial/html/Firstmerge.html @@ -9,7 +9,7 @@ Back to Lesson 1 - Tutorial main page - -Top-Down page - Bottom-up +Algorithm-Based - Component-Based page - Programming hints - EO documentation
@@ -273,7 +273,7 @@ code removed ]
Back to Lesson 1 - Tutorial main page - -Top-Down page - Bottom-up +Algorithm-Based - Component-Based page - Programming hints - EO documentation
diff --git a/eo/tutorial/html/NoWay.html b/eo/tutorial/html/NoWay.html index b5ff4ab3..de53a993 100644 --- a/eo/tutorial/html/NoWay.html +++ b/eo/tutorial/html/NoWay.html @@ -7,8 +7,8 @@ Tutorial main page - -Top-Down -page - Bottom-up page - Programming +Algorithm-Based +page - Component-Based - Programming hints -EO documentation
@@ -59,8 +59,8 @@ you'll probably end up with an executable file named Tutorial main page - -Top-Down -page - Bottom-up page - Programming +Algorithm-Based +page - Component-Based - Programming hints - EO documentation
diff --git a/eo/tutorial/html/SecondBitEA.html b/eo/tutorial/html/SecondBitEA.html index 222cc988..198cc917 100644 --- a/eo/tutorial/html/SecondBitEA.html +++ b/eo/tutorial/html/SecondBitEA.html @@ -8,7 +8,7 @@ Back to Lesson 3 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
@@ -597,7 +597,7 @@ cout << "Exception: " << e.what() << '\n';

Back to Lesson 3 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
diff --git a/eo/tutorial/html/binary_value.html b/eo/tutorial/html/binary_value.html index 89d4d965..00fcfb51 100644 --- a/eo/tutorial/html/binary_value.html +++ b/eo/tutorial/html/binary_value.html @@ -7,7 +7,7 @@ Back to Lesson 2 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
@@ -44,7 +44,7 @@ i++)
Back to Lesson 2 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
diff --git a/eo/tutorial/html/debut.html b/eo/tutorial/html/debut.html index 60f02d48..2c6c8d30 100644 --- a/eo/tutorial/html/debut.html +++ b/eo/tutorial/html/debut.html @@ -6,8 +6,8 @@ Tutorial main page - -Top-Down -page - Bottom-up page - Programming +Algorithm-Based +page - Component-Based - Programming hints - EO documentation

diff --git a/eo/tutorial/html/eoBottomUp.html b/eo/tutorial/html/eoBottomUp.html index ef490c9b..ba1919ee 100644 --- a/eo/tutorial/html/eoBottomUp.html +++ b/eo/tutorial/html/eoBottomUp.html @@ -3,20 +3,20 @@ - EO - The Bottom-Up approach + EO - The Component-Based approach Tutorial main page - -Top-Down -page - Bottom-up page - Programming +Algorithm-Based + - Component-Based - Programming hints - EO documentation

-EO - Bottom-Up approach

+EO - Component-Based approach -


Congratualtions - You have chosen the bottom-up approach!  +


Congratualtions - You have chosen the component-based approach!  From here you will be allowed to browse into the different components of an Evolutionary Algorithm, and to see how to program your favorite using the EO library. @@ -60,8 +60,8 @@ to go directly to the corresponding section of the tutorial.


-
Tutorial main page - Top-Down -page - Bottom-up page - Programming +
Tutorial main page - Algorithm-Based + - Component-Based - Programming hints - EO documentation

diff --git a/eo/tutorial/html/eoEngine.html b/eo/tutorial/html/eoEngine.html index 019c2104..6012fc81 100644 --- a/eo/tutorial/html/eoEngine.html +++ b/eo/tutorial/html/eoEngine.html @@ -2,11 +2,12 @@ + Genetic Engine -Top-Down page - Bottom-up -page - Programming hints - EO +Algorithm-Based - Component-Based +- Programming hints - EO documentation
@@ -16,21 +17,42 @@ documentation


Contents

-


Introduction -
The term evolution engine denotes the different parts that simulate -the Darwinism in Evolutionary Algorithms. +


+
Introduction +

The term evolution engine denotes +the different parts of an Evolutionary Algorithm that simulate the Darwinism:

The fittest individuals are more likely to reproduce and survive.

@@ -43,10 +65,17 @@ that will be allowed to reproduceReplacement takes place after reproduction, and is the Darwinistic choice of those individuals that will survive, i.e. become the parents of the next generation. -

Selection +

Both selection and replacement will be discussed in turn, before some +helper classes that are used within selection and replacement procedures +are presented. +

+


Selection
  -

Replacement -
The replacement phase takes place after the birth +
  +

+


+
Replacement +

The replacement phase takes place after the birth of all offspring 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 @@ -57,64 +86,46 @@ one generation to the next one - though nothing stops you from writing an algorithm with varying population size.

Replacement: The interface -
The abstract class for replacement procedures is the functor class +

The abstract class for replacement procedures is the functor class eoReplacement, and the interface for its operator() is

-

void operator()(const eoPop<EOT>& -_parents, eoPop<EOT>& _offspring)

+

void operator()(eoPop<EOT>& _parents, +eoPop<EOT>& _offspring)

which you could have guessed from the inheritance tree for class eoReplacement., as you see there that eoReplacement derives -from class eoBF<const eoPop<EOT>&, -eoPop<EOT>&, void>. +from class eoBF<eoPop<EOT>&, eoPop<EOT>&, +void>.
This means that it takes 2 populations (called, for obvious anthropomorphic reasons, _parents and _offspring :-) -and puts the result into population offspring (as _parents is passed as -constant -population). -

Note: 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. +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.

Replacement: Instances

+Replacement: Adding (weak) elitism -
You can add what is called weak elitism +

You can add what is called weak elitism to any replacement by encapsulating it into an eoWeakElitismReplacement object. Weak elitism ensures that the overall best fitness in the population will never decrease: @@ -152,25 +193,228 @@ population, replacing the worse.

Within EO, this is very easy to add:

First, declare your replacement functor (here, generational, but it can be any replacement object): -
eoNoReplacement<Indi> genReplace; +
eoGenerationalReplacement<Indi> genReplace;
Then wrap the weak elitism around it:
eoWeakElitismReplacement<Indi> replace(genReplace);
and use now replace as your replacement procedure within your algorithm.

Note: of course, adding weak elitism to an elitist replacement makes no sense - but will not harm either :-) -

Popular +

Replacement: Test +file +

The file t-eoReplacement +in the test directory implements all +above replacmenet procedures withni a very simple and easy-to-monitor Dummy +EO class. +

+


+
Popular evolution engines -
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! +

This section will be completed soon - in the meantime just trust us +that all of these are already implemented in EO (except maybe some of the +last category :-) !!!!!! +

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!

  • -Generational Genetic Algorihtm
  • +Generational Genetic Algorihtm + +
  • +Steady-State Genetic Algorithm
  • + +
  • +(MU+Lambda)-Evolution Strategy
  • + +
  • +(MU,LAMBDA)-Evolution Strategy
  • + +
  • +Evolutionary Programming
  • + +
  • +You name it :-)
  • +
+ +
+
Tournaments +

Tournaments are an easy and quick way to select +individuals within a population based on simple comparisons. Though usually +based on fitness comparisons, they can use any comparison operator. +
In EO, there are two variants of tournaments used to select one single +individual, namely Deterministic Tournament +and Stochastic Tournament, +that are used in selection and in replacement procedures, and a global +tournament-based selection of a whole bunch of individuals, the EP +Tournament. Though the single-selection tournaments can +be repeated to select more than one individual, and the batch tournament +selection can be used to select a single individual, both uses are probably +a waste of CPU time. +

    +
  • +Deterministic Tournament of +size T selects returns the best of T uniformly chosen individuals in the +population. It is implemented in the eoDetTournamentSelect +class, a sub-class of eoSelectOne, as well as in the eoDetTournamentTruncate +class that repeatidly removes from the population the "winner" of the inverse +tournament.  These objects use the C++ function determinitic_tournament +in  selectors.h.
  • + +
  • +Stochastic Tournament of rate +R first choses two individuals from the population, and selects the best +one with probability R and the worse one with probability (1-R). It is +implemented in the eoStochTournamentSelect +class, a sub-class of eoSelectOne, as well as in the eoStochTournamentTruncate +class that repeatidly removes from the population the "winner" of the inverse +tournament.  These objects use the C++ function determinitic_tournament +in  selectors.h.
  • + +
  • +EP Tournament of size T is +a global tournament: it works by assigning a score to all individuals in +the population the following way: starting with a score of 0, each individual +I is "opposed" T times to a uniformly chosen individual. 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 EP Tournament is implemented +in the  eoEPReduce truncation +method used in some replacement procedures.


-


Top-Down page - Bottom-up -page - Programming hints -EO +
+
Merging +populations +

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. +

eoMerge: interface +
The abstract class for merging procedures is the functor class +eoMerge, +and the interface for its operator() +is +

+

void operator()(const eoPop<EOT>& +_parents, eoPop<EOT>& _offspring)

+ +

which you could have guessed from the inheritance tree for class eoMerge, +as you see there that eoMerge derives from +
class eoBF<const eoPop<EOT>&, eoPop<EOT>&, +void>. +
This means that it takes 2 populations +and modifies the seond one by adding some individuals from the first one +(which is supposed to remain constant). +

eoMerge: instances +
Available instances of eoMerge objects +are eoPlus, that simply adds +the parents to the offspring, or eoElitism, +that adds only some of the (best) parents to the offspring. A special case +of eoElistism is eoNoElitism, +an eoMerge that does nothing. +

+


+
Reducing +populations +

The other useful component of replacement procedures, eoReduce, +kills +some individuals from a given population. +

eoReduce: interface +
The abstract class for reducing procedures is the functor class +eoReduce, +and the interface for its operator() +is +

+

void operator()(eoPop<EOT>& _parents, +unsigned int new_size)

+ +

which you could have guessed from the inheritance tree for class eoReduce, +as you see there that eoReduce derives from +
class eoBF<eoPop<EOT>&, unsigned +int, void>. +
An eoReduce shoud take a +population and shrink it to the required size. +

eoReduce: instances +
Available instances of eoReduce are +

    +
  • +eoTruncate, deterministically +kills the worse individuals, keeping only the required number. It starts +by sorting teh populations, and hence does modify +its order.
  • + +
  • +eoLinearTruncate, deterministically +kills the worse individuals, keeping only the required number. It does +so by repeatedly removing the worsr individual. Hence does not +modify its order, but takes longer time than eoTruncate +in case of many offspring.
  • + +
  • +eoEPReduce, uses the EP +stochastic tournament to reduce the population. It requires an additinal +argument, the tournament size.
  • + +
  • +eoDetTournamentTruncate uses +inverse deterministic tournament to repeatidly kill one individual until +the propoer size is reached. As eoLinearTruncate, +it might take some time in the case of many offspring. It requires the +size of the tournament (unsigned int) +as parameter in the constructor (default is 2).
  • + +
  • +eoStochTournamentruncate  +uses inverse stochastic tournament to repeatidly kill individuals from +the population. It requires the rate of the tournament (double) +as parameter in the constructor (default is 0.75).
  • +
+ +


+


+
Relative +or absolute number of individuals +

Many classes in selection/replacement procedures will handle a number +of individuals that may either be fixed or be a fraction of some argument-population +size. +
Of course, it is possible to write two different classes that will +only differ by the way they compute the number of individuals they have +to treat, as it is done for selectors with the two classes eoSelectPerc +and eoSelectNumber (it could also have been +possible to have some pure abstrat class and implement the computation +of the number of individuals to treat in some derived classes). +
However, rather than multiply the number of class, EO has defined a +class that will handle the problem once and for all, the class eoHowMany. +It receives a double, and +a boolean indicating whether +that double is to be treated as a rate +or as an absolute (unisgned) interger. +

eoHowMany: interface +
The class interface for its operator() +is +

+

unsigned int operator()(unsigned int _pop_size)

+ +

which you could have guessed from the inheritance tree for class eoHowMany, +as you see there that eoHowMany +derives from +
class eoUF<unsigned int, unsigned int>. +

Its constructor takes 2 argumenrts: +

+

eoHowMany(double _rate, bool _interpret_as_rate += true)

+so by default the double is indeed interpreted as a rate. +

It is used in eoSelectMany (which supersedes +eoSelectPerc +and eoSelectNumber, but they are left there +for tutorial reasons!) as well as in many truncation +methods. +

+


+
Survive and +Die +

+


Algorithm-Based - Component-Based +- Programming hints -EO documentation

diff --git a/eo/tutorial/html/eoEval.html b/eo/tutorial/html/eoEval.html index cf95bb89..896eaffc 100644 --- a/eo/tutorial/html/eoEval.html +++ b/eo/tutorial/html/eoEval.html @@ -6,8 +6,8 @@ Tutorial main page - -Top-Down -page - Bottom-up page - Programming +Algorithm-Based +page - Component-Based - Programming hints - EO documentation

@@ -21,8 +21,8 @@ hints - EO documentation

Tutorial main page - -Top-Down -page - Bottom-up page - Programming +Algorithm-Based +page - Component-Based - Programming hints - EO documentation
Marc Schoenauer
diff --git a/eo/tutorial/html/eoInit.html b/eo/tutorial/html/eoInit.html index 27cb1a40..2a2d2d78 100644 --- a/eo/tutorial/html/eoInit.html +++ b/eo/tutorial/html/eoInit.html @@ -5,8 +5,8 @@ Tutorial main page - -Top-Down -page - Bottom-up page - Programming +Algorithm-Based +page - Component-Based - Programming hints - EO documentation

@@ -22,8 +22,8 @@ hints - EO documentation

-Tutorial main page - Top-Down -page - Bottom-up page - Programming +Tutorial main page - Algorithm-Based +page - Component-Based - Programming hints - EO documentation
diff --git a/eo/tutorial/html/eoLesson1.html b/eo/tutorial/html/eoLesson1.html index eb46324c..f9116bdf 100644 --- a/eo/tutorial/html/eoLesson1.html +++ b/eo/tutorial/html/eoLesson1.html @@ -2,15 +2,15 @@ - + Tutorial: Lesson 1 Lesson 2 - Tutorial main page - -Top-Down page - Bottom-up -page - Programming hints -EO +Algorithm-Based - Component-Based +- Programming hints -EO documentation

@@ -220,10 +220,10 @@ objects of class
parameters, and will be passed to the eoSGA algorithm.  -For more details on these classes, go to the top-down -corresponding pages, or to their respective documentation pages.
-
+For more details on these classes, go to the algorithm-based +corresponding pages, or to their respective documentation pages.
+
  @@ -67,9 +67,7 @@ argument is a vector<bool> or a Note:
Also, +


Note: Also, a non-templatized fitness can be compiled separately (not done here) into an object file once and for all (
remember @@ -86,8 +84,6 @@ requires.
 

  -
  -
 

Note: In the previous files (Bit - Real) , the last 2 types were deduced from the first (2nd argument = fitness @@ -111,9 +107,7 @@ You can also use different initializers and call them in turn through the call to pop.append() function (see Exercise 2). -
  -

  -

Note: Don't +


Note: Don't forget to evaluate the population: the eoPop has no idea of the eval function, so it has to be done from outside!!!
  @@ -134,7 +128,7 @@ or Quad (for crossovers, of class is derived from the corresponding eoxxxOp class. When applying the eoPropCombinedxxxOp, one of the eoxxxOp it contains is chosen by a roulette wheel, according to their respective rates, and is applied to the arguments. -For more details on these classes, go to the top-down +For more details on these classes, go to the algorithm-based corresponding pages, or to their respective documentation pages.

    @@ -340,8 +334,8 @@ and stopping criteria here). Lesson 3 - Main page - -Top-Down -- Bottom-up - Hints +Algorithm-Based +- Component-Based - Hints - EO documentation
    diff --git a/eo/tutorial/html/eoLesson3.html b/eo/tutorial/html/eoLesson3.html index 17c539b4..f1a5aac5 100644 --- a/eo/tutorial/html/eoLesson3.html +++ b/eo/tutorial/html/eoLesson3.html @@ -10,8 +10,8 @@ Lesson 4 - Main page - -Top-Down -- Bottom-up - Hints +Algorithm-Based +- Component-Based - Hints - EO documentation

    @@ -135,7 +135,7 @@ we will not go into details: e.g. we will not tell you that the eoValueParam is actually a templatized sub-class of abstract class eoParam (oops, I said it!), nor will we deal with parameters outside their use from an eoParser. -See the parameter section of the Bottom-up tutorial, or wait until lesson +See the parameter section of the Component-Based tutorial, or wait until lesson 4).
  • @@ -519,8 +519,8 @@ construct. Lesson 4 - Main page - -Top-Down -- Bottom-up - Hints +Algorithm-Based +- Component-Based - Hints - EO documentation

    diff --git a/eo/tutorial/html/eoOperators.html b/eo/tutorial/html/eoOperators.html index 5ec0e8ef..3626af51 100644 --- a/eo/tutorial/html/eoOperators.html +++ b/eo/tutorial/html/eoOperators.html @@ -2,64 +2,111 @@ - + Variation Operators -Top-Down page - Bottom-up -page - Programming hints - EO +General: Algorithm-Based +page - Component-Based - Programming +hints - EO documentation

    -
    TOC : Introduction +
    Local: Introduction - Crossover - Mutation -- Simple combinations - General -Operators - General combinations +- Combinations - General +Operators - Populators - General +combinations- Advanced operators

    Variation Operators

    - -


    Variation +Variation Operators
    Variation operators modify individuals, or, equivalently, move them -in the search space. They are almost always stochastic, -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. -

    Variation operators involving two individuals are called crossover -operators. 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. -
    Variation operators involving one single individual are called mutation -operators. -
    In EO you can also define and use variation operators that generate -any number of offspring from any number of parents (sometimes termed orgy -operators). They are called general operators. -

    Though most the historical evolutionary algorithms used at most one -crossover and one mutation (see e.g. the Simple Genetic Algorithm in lesson1), -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 proportional -combination of simple operators (see e.g. how to define and use such -combined operators in the SGA of lesson2). -

    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 general -combination of general operators. -

    EO implementation: all variation -operators in EO derive from the base (abstract) class eoOp -(as usual, click to see the inheritance diagram). blabla -
    +in the search space. In Evolutionary Algorithms, varitaion operators are +almost always stochastic, 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. +

      +
    • +Variation operators involving two individuals +are called crossover operators. 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.
    • + +
    • +Variation operators involving one single individual +are called mutation operators.
    • + +
    • +Straightforward extensions of these simple operators allow to combine them: +in +proportional combinations, one operator +is chosen among a given set of operators of same arity according to some +weights.
    • + +
    • +In EO you can also define and use variation operators that generate any +number of offspring from any number of parents (sometimes termed orgy +operators). They are called general operators.
    • + +
    • +However, the interface of such operators was designed for their use inside +general +combinations: you can use proportional combination, +in which one operator is chosen among a given set of operators of same +arity according to some weights, as for simple operators except that operators +of different arities can be mixed, but you can also use sequential +combinations, where different operators  are applied in +turn with given probability. But you can also embed any of such combinations +at any depth.
    • + +
    • +The price to pay for that is that you must use an instermediate class to +access the individuals, the eoPopulator class.
    • + +
    • +Thanks to that class, it also become easy to design advanced +operators, such as crossover operators where the mate is chosen according +to sexual preference rather than fitness-based +preferences.
    • +
    +EO classes for variation operators: + +
    -
    Simple +Simple operators: Crossover

    The characteristic of crossover operators is that they involve two parents. However, there are crossover operators that generate two parents, and some @@ -112,7 +159,6 @@ you are using for instance an SGA, this (de usage). See also the different ways that are described below, encapsulating the operators into combined operators objects. -
     

    Writing a crossover operator:
    There are only two things to modify in the template @@ -121,7 +167,7 @@ creating!)

    -



    Simple operators: Mutation
    Mutation operators modify one single individual. The corresponding @@ -177,7 +222,7 @@ creating!)
    • The constructor, where you pass to the object -any useful parameter
    • +any useful parameter (see the private data at end of class definition).
    • The operator() method, which performs the @@ -187,80 +232,287 @@ actual crossover.
    • Warning: don't forget to invalidate the fitness of the individual - if it has actually been modified. Otherwise, the lazy fitness evaluation procedure in -EO will not know it should compute the fitness again and will keep the +EO might not know it should compute the fitness again and will keep the old value.

    -
    Combining +Combining simple operators: proportional combinations

    The best thing to do is to go to the Lesson2 -of the tutorial, where everything is explained. +of the tutorial, where everything is explained. You will find out how you +can use +
    several mutations (respectiveley crossovers) as a single operator: +every time the operator is called, one of the available operators is chosen +by some roulette wheel selection using realtive weights.


    General Operators +

    General operators in EO are variation operators that are neither simple +mutations nor simple crossovers. They can involve any number of parents, +and create any number of offspring. Moreover, they can make use of different +ways to get the parents they will involve, e.g. they can use a different +selector for each of the parents they need to select. +

    The corresponding EO class is called eoGenOp. +and it is as usual templatized by the type of individual it can handle +(see documentation for eoGenOp +:-) +

    Interface: +
    The interface for eoGenOp +is based on that of another class, called eoPopulator. +An +eoPopulator +is a population, but also behaves like +an iterator over a population (hence +the name, Population-Iterator). +

    The basic +interface of an eoPopulator +(see also the documentation, +of course) is the following: Individuals are accessed through the operator*; +Basic iterator operations are available, like (pre)incrementation through +operator++, +position management through seekp +(returns the current position) and tellp +(go to a given position); Individuals can also be inserted +and erased at current position using +the corresponding methods; last but not least, as the individuals are returned +by reference, it is mandatory to ensure that they will not be moved around +later: the memory management  routine reserve is called whenever there +is a chance to add some individuals in the population. +

    This results in the following general interface for an eoGenOp: +It receives as argument an eoPopulator, +gets the individuals it needs using the operator*, +and must handle the positinning of the  using the operator++ +method. +

    void operator()(eoPopulator& +_pop) +
    { +
      EOT & eo1 = *_pop; // get +(select if necessary) the guy +
      ++_pop;        + +// advance +
      EOT & eo2 = *_pop; // get +(select if necessary) the guy +
      ++_pop;        + +// advance +
    ... +
      EOT & eoN = *_pop; // get +(select if necessary) the guy +
      ++_pop;        + +// advance +

    // do whatever the operator is supposed to +do +
    } +

    What happens next? Well, it all +depends on how many parents and how many offspring your general op needs: +

      +
    • +If the number of generated offspring is equal +to the number of parents, the operator simply needs to modify them (they +are passed by reference, no useless copy takes place).
    • + +
    • +If the operator produces more offspring than there +were parents, it needs to insert them into the list using the insert +method of the class eoPopulator as +in the following:
    • +
        -

      +

        +

      void operator()(eoPopulator& +_pop) +
      { +
        EOT & eo1 = *_pop; // get +(select if necessary) the guy +
        ++_pop;        + +// advance +
        // Now create second offspring - eo1 +is modified too! +
        EOT eo2 = create_individual(eo1); +
        // inserts eo2 in _pop after eo1 +
        _pop.insert(eo2); +
      ... +
      Of course the size of the resulting population will grow - and you +should have a replacement procedure that takes care of that. +

    • +The case where more parents are needed than offspring +will be created is a little more delicate: think about eoBinOp, +and try to imagine the reasons why no crossover of that class asre used +in the first lessons of the tutorial, within the SGA framework. There are +two possibilities:
    • + +
        +
      • +If you think "generational", the first idea is to get the parents from +outside the curent list, so the total number of (intermediate) offspring +is always equal to the initial population size. By chance, the eoPopulatorhas +a handle on the initial population that was used to start the process, +and you can access it from inside the GenOp method. For instance +

        void operator()(eoPopulator& +_pop) +
        { +
          EOT & eo1 = *_pop; // get +(select if necessary) the guy +
          ++_pop;       // advance +
          const EOT & eo2 = select(_pop.source()); +

        where select is any selector you like. Note the const: you are not allowed +to modify an element of the original population (but you could of course +have copied it!). Now to find out where that selector comes from, you'll +have to wait until next section. If you can't wait, go directly there.

      • + +
      • +If you don't care about the size of the offspring population, you can use +the delete method of the class eoPopulator. +For instance +
        void operator()(eoPopulator& +_pop) +
        { +
          EOT & eo1 = *_pop; // get +(select if necessary) the guy +
          ++_pop;       // advance +
          EOT & eo2 = *_pop; // get +(select if necessary) the guy +
          ++_pop;       // advance +
          // do whatever needs to be done, modifying +eo1 but not eo2 +
          _pop.delete();   // +removes (untouched) eo2 from the list
      +
    +Warning: if you use operators that +have different number of parents than offspring, you are deviating from +the simple generational approach. Be careful to have the proper replacement +procedure to take care of the population size: in most instances of algorithms +that come within EO, this is enforced (an exception is thrown if population +size varies from one genertaion to the other) but this might not be true +for all forthcoming EO algorithms. +

    Using general operators: +
    Directly applying general operators to given individuals is impossible +in EO, due to its interface. You need the help +of an individual dispenser of class eoPopulator. +But anyway general operators were thought to be used mainly in combination +of one another, as described below. +

    Writing a general +operator: +
    There are many things to modify in the template +class definitions provided. +

      +
    • +The constructor, where you pass to the object +any useful parameter (see private data at end of class definition).
    • + +
    • +The operator() method, which performs the +actual crossover. Remember you must use the argument eoPopulatorto +access the members of the [p[ulation in turn (method +operator*), +you may use the initial population (method source()), +as well as the insert or delete +methods.
    • + +
      Warning: as usual, don't forget +to invalidate the fitness of the individual +- if it has actually been modified. Otherwise, the lazy +fitness evaluation procedure in EO will not know it should compute +the fitness again and will keep the old value.
    + +
    The +populators: +
    The public interface class eoPopulator +has been described above. However, a protected method, termed select,  +is used inside the object to get new parents for the following operator, +and its implementation distinguishes two types of eoPopulator: +
      +
    • +The eoSeqPopulator gets new parents +from its source (the initial population). When the source is exhausted, +an exception if thrown. The idea of such pooulator is to start from a population +of already selected individuals.
    • + +
      The programmer should hence be very careful that the number of available +parents matches the requirements of the operators when using an eoSeqPopulator +object. +
    • +The eoSelectivePopulator , on the opposite, +always gets new parents using its private eoSelectOne +object (passed at construct time). Hence it can handle any number of parents +at will. The idea of such populator is to handle the whole breeding +process, i.e. selection and variation operators.
    • +
    +An immediate consequence is that if you are not sure of the numebr of  +parents you will need in some operators (e.g. because of some stochastic +proportional selection ebtween operators that don't need the same number +of parents, then you must use an eoSelectivePopulator +to apply the variation operators to the population. +

    General Combinations: -

    There are two main ways to use and combine general operators in EO: +
    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. -

    Proportional combinations behave -like a unique operator: when it is called upon a population of candidates, -an eoProportionalOpContainer enters -the following loop: -

    while there are individuals left in the candidate population +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. +

    Proportional combinations +
    When called upon a population (through an eoPopulator +object), an eoProportionalOpContainer +enters the following loop: +

    while there are individuals left in the list

    • choose one of the included operators according to their relative rates -by some roulette wheel random choice
    • +(by some roulette wheel random choice)
    • -find out the number of parents that it requires (haha, the tricky part -if e.g. sequentialOp are imbedded :-)
    • +applies the chosen operator. The parents are dispensed to the operator +from the list on demand.
    • -gets the required number of individual from the candidates,
    • +What happens next exactly depends on the type of operator, but basically, +some of the parents get modified, some might get removed from the list +and some new individual might get inserted on the list.
    • -applies the chosen operator to those parents, generating a list of offspring
    • - -
    • -removes the parents from the candidate population
    • - -
    • -append the offspring to the result population
    • +updates the list pointer (if needed) to the individual following the ones +that just have been modified/inserted/deleted.
    -Sequential combinations behave like -a unique operator: when it is called upon a population of candidates, an +Sequential combinations +
    When it is called upon a list of pending candidates, an eoSequentialOpContainer enters the following loop: -

    for all operators it contains, apply the operator to the candidate population, -that is +

    mark the current position +
    for all operators it contains,

    • -start with an empty offspring population
    • +go to marked position
    • -get the number of parents the operator at hand requires (haha, the tricky -part if the operator is an eoProportionalOpContainer!!!)
    • +until current end of population +is reached do + +
        +
      • +flip a coin according to the operator rate.
      • + +
          +
        • +If true, apply the operator to the parents. The current parents can be +modified, or some can be deleted from the list, or some offspring can be +inserted in the list.
        • -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
        • +If false, move the pointer over the required number of parents (i.e. don't +modify thoses parents) +
      • -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
      • +Next pending parent +
    • -make the offspring population the parentpopulation for next operator.
    • +Next operator
    Remark:The eoSGATransform presented in Lesson2 can be viewed as a particular type of eoSequentialOpContainer. @@ -268,29 +520,27 @@ It was not coded that way in order to provide a gradual introduction to all concepts.
    Exercise: write the code to perform an eoSGA using the eoOpContainer constructs. -

    Remark: 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. -
     

    Adding operators to a container: -
    The basic function to add an operator to an eoOpContainer is the method -add -from class eoOpContainer. -
    It is similar to all other add -methods in other Combined things in eo (as the simple eoProportionalCombinedXXXop +
    The way to add an operator to an eoOpContainer +is the method +add. It is similar +to all other add methods in +other Combined things in eo (as the simple eoProportionalCombinedXXXop described above, but also the eoCombinedContinue class or the eoCheckPoint class).
    The syntax is straightforward, and it works with any of the operator -classes defined above: +classes eoXXXOp, where XXX stands for +Mon, +Bin, Quad or +Gen:

    someOperatorType<Indi> myOperator; -
    eoXXXOpContainer<Indi> myOpContainer; +
    eoYYYOpContainer<Indi> myOpContainer;
    myOpContainer.add(myOperator, rate); // rate: double whose meaning depends on XXX -

    where XXX can be one of Proportional and Sequential. -
    However, the way rate -will be used is highly dependent on the type of OpContainer your are creating -there: +

    where YYY can be one of Proportional and Sequential. +
    Warning: the way rate +will be used is highly dependent on the type of eoOpContainer +your are creating there:

    • The rates for eoProportionalOpContainer @@ -300,21 +550,115 @@ values.
    • The "rates" for eoSequentialOpContainer 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 in [0,1] (no -error will happen if they are not, but the operator will be applied systematically -- this is equivalent of a rate equal to 1).
    • +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 in +[0,1] (no error will happen if they are not, but the operator +will be applied systematically - this is equivalent of a rate equal to +1). +
    +Containers, +Selectors and Populators +
    The way the eoOpContainer are applied +on a population using an eoPopulator +object. But, whereas the behavior of eoProportionalOpContainer +does not depend on the type of eoPopulator,(one +operator is chosen by roulette_wheel, and applied once before control is +given back to the caller), the main loop in method operator() +of +class eoSequentialOpContainer +iterates while (!_pop.exhausted()) +which is interpreted differently depending on the type +of eoPopulator: +
      +
    • +if the argument is an eoSelectivePopulator, +the default position of the eoPopulator, considered as a population iterator, +is at end of population. Individuals are added upon demand of an operator, +and in most cases all operators are applied once. This also depends, however, +on the arities of all operators:
    • + +
        +
      • +Consider an eoSequentialOpContainer +containing an eoQuadOp and an eoMonOp. The eoQuadOp first asks for two +parents and modifies them. The eoMonOp is then called starting from the +forst of thoses two modified individuals, and is hence applied twice, once +on each parent.
      • + +
      • +But consider now an eoSequentialOpContainer +containing an eoGenOp that takes one +parent and generates three offspring, followed by an eoQuadOp. +The eoGenOp will call the selector +to get the parent its need and will modify it and put 2 additional offspring +at end of the population. The eoQuadOp +will then be called on the first of the three outputs of the eoGenOp, +and hence will act upon the frist two of them. But at that point, the populator +iterator will point to the third of the individuals resulting from the +eoGenOp, +and the test _pop.exhausted() +will return false, so the eoQuadOp +will again be called. The second parent it needs will be given by a new +call to the embedded eoSelectOne of +the  and everything will go on smoothly, except that a total of 4 +offspring will have been generated by application of this particular eoSequentialOpContainer.
      -


      -


      TOC : Introduction +
    • +if the argument is an eoSeqPopulator, +the position of the iterator starts from the beginning of an existing population +(the source populations), and hence when an  an eoSequentialOpContainer +is called, it goes through the whole remaining of the population (the test +_pop.exhausted() +only returns true at end of the source population).
    • + +
    • +From the above it is easy to see that passing an eoSeqPopulator +to an eoProportionalOpContainer that +contains an eoSequentialOpContainer, +though not technically forbiddden, will most produce something  totally +unpredictable, and hence should probably not be used without great care.
    • +
    + +
    Advanced +general operators: +

    It is sometimes useful to be able to use a selector from inside an operator +(a typical example is when you want to implement sexual +preferences, i.e. choose a mate for a first parent according +to some characteritics of that first parent). +
    This is made possible in EO because the general operators have a handle +on the initial population through the method source() of the argument eoPopulator +they work on. Their operator() +method shoudl look like +

    void operator()(eoPopulator& +_pop) +
    { +
      EOT & eo1 = *_pop; // get +(select if necessary) the first guy +
      ++_pop;           + +// advance +
      EOT & eo2 = findBlonde(_pop.source());  + +// select mate +
    // do whatever the operator is supposed to +do +
    } +

    Where does that findBlonde +selector comes from? As usual, you have to attach it to the operator,  +in its constructor for instance, which should give something like: +

    sexualSelectorType<Indi>  findBlonde; +
    sexualOperatorType<Indi> yourBrainAndMyBeauty(findBlonde); +

    +


    Local: Introduction - Crossover - Mutation -- Simple combinations - General -Operators - General combinations -
    -
    Top-Down page - Bottom-up -page - Programming hints -EO +- Combinations - General +Operators - Populators - General +combinations- Advanced operators +
    General: Algorithm-Based +page - Component-Based - Programming +hints -EO documentation

    @@ -323,5 +667,6 @@ documentation

    Last modified: Fri Dec. 8 2000  +
      diff --git a/eo/tutorial/html/eoProgramming.html b/eo/tutorial/html/eoProgramming.html index 9993f329..97627762 100644 --- a/eo/tutorial/html/eoProgramming.html +++ b/eo/tutorial/html/eoProgramming.html @@ -7,8 +7,8 @@ Tutorial main page - -Top-Down -page - Bottom-up page - Programming +Algorithm-Based +page - Component-Based - Programming hints - EO documentation
    @@ -241,8 +241,8 @@ Blabla

-
Tutorial main page - Top-Down -page - Bottom-up page - Programming +
Tutorial main page - Algorithm-Based +page - Component-Based - Programming hints - EO documentation
diff --git a/eo/tutorial/html/eoSGA.html b/eo/tutorial/html/eoSGA.html index c7057031..7d454714 100644 --- a/eo/tutorial/html/eoSGA.html +++ b/eo/tutorial/html/eoSGA.html @@ -7,7 +7,7 @@ Back to Lesson 1 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
@@ -144,7 +144,7 @@ apply<EOT>(eval, _pop);

Back to Lesson 1 - Tutorial -main page - Top-Down page - Bottom-up +main page - Algorithm-Based - Component-Based page - Programming hints - EO documentation
diff --git a/eo/tutorial/html/eoTopDown.html b/eo/tutorial/html/eoTopDown.html index 478e6bbe..a4448d19 100644 --- a/eo/tutorial/html/eoTopDown.html +++ b/eo/tutorial/html/eoTopDown.html @@ -3,25 +3,25 @@ - EO - The Top-Down approach + EO - The Algorithm-Based approach -Tutorial main page +Tutorial main +page - -Top-Down -page - Bottom-up page - Programming -hints - EO +Algorithm-Based - Component-Based +- Programming hints - EO documentation

-EO - The Top-Down approach

+EO - The Algorithm-Based approach -


Congratulations - You have chosen the top-down approach!  This -means that you want to start from something that already works, and gradually -learn about the more complex constructs. We have prepared a series of "lessons" -for you. +


Congratulations - You have chosen the algorithm-based approach!  +This means that you want to start from something that already works, and +gradually learn about the more complex constructs. We have prepared a series +of "lessons" for you.

  • Lesson 1 - a gentle introduction to the EO @@ -47,8 +47,10 @@ populations, restart stopped runs, ...).
  • -


    Current version (Nov. 29, 2000) stops here, but here are the plans -(subjected to many changes, of course!) +
      +

      +

    Current version (Nov. 29, 2000) stops here, but here are the plans (subjected +to many changes, of course!)
     

  • Lesson 4 - More about checkpointing: write your first adaptive @@ -67,14 +69,14 @@ more sophisticated island model (no totally distributed population yet).
  • Lesson 7 - ...
-Of course, in each lesson, you have links to the Bottom-Up page of the +Of course, in each lesson, you have links to the Component-Based of the corresponding component of an EA you are modifying.
( ... Well, to tell you the truth, as of today, November 28, this is not true :-)

-
Tutorial main page - Top-Down -page - Bottom-up page - Programming +
Tutorial main page - Algorithm-Based +- Component-Based - Programming hints - EO documentation
@@ -82,7 +84,7 @@ documentation
Marc Schoenauer
-
Last modified: Fri Nov 28 +
Last modified: Tue Dec 19 2000  diff --git a/eo/tutorial/html/eoTutorial.html b/eo/tutorial/html/eoTutorial.html index fb39e775..a53ed75d 100644 --- a/eo/tutorial/html/eoTutorial.html +++ b/eo/tutorial/html/eoTutorial.html @@ -2,44 +2,46 @@ + Tutorial EO -Top-Down page - Bottom-up -page - Programming hints - EO +Algorithm-Based - Component-Based +- Programming hints - EO documentation

EO Tutorial

-Welcome to EO - the Evolving Objects library. What is this tutorial good -for? -
Well,  the short term idea here is to help you build +Welcome to EO - the Evolving Objects library. +

The short term idea of this tutorial is to help you build your own Evolutionary Algorithms using EO - while the long term idea is that you will be able to contribute to EO, and ultimately write our EAs :-)

About this tutorial

-This tutorial can be used in 2 different ways: top-down and bottom-up. +This tutorial can be used in 2 different ways: algorithm-based and component-based.
  • -Top-down means you start from a very +Algorithm-Based means you start from a very simple, ready-to-run algorithm, and gradually modify it, making it both more powerful and more complex.
  • -Bottom-up means you start by examining the -components -of an EA one by one, 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.
  • +Component-Based means you start by examining +the +components of an EA one by one, 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.
However, it is strongly recommended -that you take some time on the first lesson of the Top-down approach to -get familiar with the basic concepts that are used throughout EO. Anyway, -as of today, November 29, the Bottom-up page is not written yet :-) +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 +:-)

Related documents