From 44e715f24194292ffff38b29cb0cba5ad7a6587d Mon Sep 17 00:00:00 2001 From: evomarc Date: Fri, 15 Dec 2000 17:01:11 +0000 Subject: [PATCH] deleted trash file lesson1.ps CVS ---------------------------------------------------------------------- --- eo/tutorial/html/lesson1.ps | 1952 ----------------------------------- 1 file changed, 1952 deletions(-) delete mode 100644 eo/tutorial/html/lesson1.ps diff --git a/eo/tutorial/html/lesson1.ps b/eo/tutorial/html/lesson1.ps deleted file mode 100644 index d71bcc53..00000000 --- a/eo/tutorial/html/lesson1.ps +++ /dev/null @@ -1,1952 +0,0 @@ -%!PS-Adobe-3.0 -%%BoundingBox: 54 72 535 761 -%%Creator: Mozilla (NetScape) HTML->PS -%%DocumentData: Clean7Bit -%%Orientation: Portrait -%%Pages: 5 -%%PageOrder: Ascend -%%Title: Tutorial: Lesson 1 -%%EndComments -%%BeginProlog -[ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef - /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef - /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef - /.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright - /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one - /two /three /four /five /six /seven /eight /nine /colon /semicolon - /less /equal /greater /question /at /A /B /C /D /E - /F /G /H /I /J /K /L /M /N /O - /P /Q /R /S /T /U /V /W /X /Y - /Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c - /d /e /f /g /h /i /j /k /l /m - /n /o /p /q /r /s /t /u /v /w - /x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef - /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef - /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef - /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef - /space /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright - /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree /plusminus /twosuperior /threesuperior - /acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf - /threequarters /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla - /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde - /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex - /Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring - /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis - /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave - /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] /isolatin1encoding exch def -/c { matrix currentmatrix currentpoint translate - 3 1 roll scale newpath 0 0 1 0 360 arc setmatrix } bind def -/F0 - /Times-Roman findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f0 { /F0 findfont exch scalefont setfont } bind def -/F1 - /Times-Bold findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f1 { /F1 findfont exch scalefont setfont } bind def -/F2 - /Times-Italic findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f2 { /F2 findfont exch scalefont setfont } bind def -/F3 - /Times-BoldItalic findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f3 { /F3 findfont exch scalefont setfont } bind def -/F4 - /Courier findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f4 { /F4 findfont exch scalefont setfont } bind def -/F5 - /Courier-Bold findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f5 { /F5 findfont exch scalefont setfont } bind def -/F6 - /Courier-Oblique findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f6 { /F6 findfont exch scalefont setfont } bind def -/F7 - /Courier-BoldOblique findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f7 { /F7 findfont exch scalefont setfont } bind def -/rhc { - { - currentfile read { - dup 97 ge - { 87 sub true exit } - { dup 48 ge { 48 sub true exit } { pop } ifelse } - ifelse - } { - false - exit - } ifelse - } loop -} bind def - -/cvgray { % xtra_char npix cvgray - (string npix long) - dup string - 0 - { - rhc { cvr 4.784 mul } { exit } ifelse - rhc { cvr 9.392 mul } { exit } ifelse - rhc { cvr 1.824 mul } { exit } ifelse - add add cvi 3 copy put pop - 1 add - dup 3 index ge { exit } if - } loop - pop - 3 -1 roll 0 ne { rhc { pop } if } if - exch pop -} bind def - -/smartimage12rgb { % w h b [matrix] smartimage12rgb - - /colorimage where { - pop - { currentfile rowdata readhexstring pop } - false 3 - colorimage - } { - exch pop 8 exch - 3 index 12 mul 8 mod 0 ne { 1 } { 0 } ifelse - 4 index - 6 2 roll - { 2 copy cvgray } - image - pop pop - } ifelse -} def -/cshow { dup stringwidth pop 2 div neg 0 rmoveto show } bind def -/rshow { dup stringwidth pop neg 0 rmoveto show } bind def -/BeginEPSF { - /b4_Inc_state save def - /dict_count countdictstack def - /op_count count 1 sub def - userdict begin - /showpage {} def - 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin - 10 setmiterlimit [] 0 setdash newpath - /languagelevel where - { pop languagelevel 1 ne - { false setstrokeadjust false setoverprint } if - } if -} bind def -/EndEPSF { - count op_count sub {pop} repeat - countdictstack dict_count sub {end} repeat - b4_Inc_state restore -} bind def -%%EndProlog -%%Page: 1 1 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 481 0 rlineto 0 689 rlineto -481 0 rlineto closepath clip newpath -0 748.4 moveto -12 f0 -(Lesson 2) show -42.9 748.4 moveto -12 f0 -( - ) show -52.8 748.4 moveto -12 f0 -(Tutorial main page) show -144.1 748.4 moveto -12 f0 -( - ) show -154 748.4 moveto -12 f0 -(Top-Down page) show -232.3 748.4 moveto -12 f0 -( - ) show -242.2 748.4 moveto -12 f0 -(Bottom-up page) show -319.8 748.4 moveto -12 f0 -( - ) show -329.7 748.4 moveto -12 f0 -(Programming hints) show -422 748.4 moveto -12 f0 -( -) show -428.9 748.4 moveto -14 f0 -(EO) show -0 732.9 moveto -14 f0 -(documentation) show -83.2 732.9 moveto -12 f0 -( ) show -0 723.4 moveto -481 0 rlineto 0 -1.4 rlineto -481 0 rlineto closepath fill -146.5 680.9 moveto -24 f1 -(Tutorial: Lesson 1) show -0 651.7 moveto -12 f0 -(This lesson will let you ) show -18.1 629.2 moveto -3.3 3.3 c fill -28 625.1 moveto -12 f0 -(run) show -43.9 625.1 moveto -12 f0 -( your first Evolutionary Algorithm written within EO Library, choosing between evolving) show -28 611.8 moveto -12 f0 -(bitstrings) show -72.6 611.8 moveto -12 f0 -(, or evolving ) show -136.5 611.8 moveto -12 f0 -(vectors of real numbers) show -249.4 611.8 moveto -12 f0 -(,) show -252.3 611.8 moveto -12 f0 -( ) show -18.1 602.6 moveto -3.3 3.3 c fill -28 598.5 moveto -12 f0 -(browse) show -62.6 598.5 moveto -12 f0 -( through the code of these algorithms, or) show -257.2 598.5 moveto -12 f0 -( ) show -18.1 589.3 moveto -3.3 3.3 c fill -28 585.2 moveto -12 f0 -(follow the ) show -79.9 585.2 moveto -12 f0 -(guided tour) show -134.9 585.2 moveto -12 f0 -(.) show -137.8 585.2 moveto -12 f0 -( ) show -0 558.6 moveto -12 f0 -(Later you will be asked to ) show -18.1 536.1 moveto -3.3 3.3 c fill -28 532 moveto -12 f0 -(write your own ) show -104.3 532 moveto -12 f0 -(fitness function) show -178.6 532 moveto -12 f0 -(,) show -181.5 532 moveto -12 f0 -( ) show -18.1 522.8 moveto -3.3 3.3 c fill -28 518.7 moveto -12 f0 -(use different kinds of ) show -133.3 518.7 moveto -12 f0 -(selection procedures) show -231.6 518.7 moveto -12 f0 -( in the framework of a generational GA ) show -424.2 518.7 moveto -12 f0 -(evolution) show -28 505.4 moveto -12 f0 -(engine) show -59.9 505.4 moveto -12 f0 -(,) show -62.8 505.4 moveto -12 f0 -( ) show -18.1 496.2 moveto -3.3 3.3 c fill -28 492.1 moveto -12 f0 -(check that EO let you separate the ) show -194.9 492.1 moveto -12 f0 -(representation) show -262.8 492.1 moveto -12 f0 -( from the ) show -309.7 492.1 moveto -12 f0 -(evolution engine) show -390 492.1 moveto -12 f0 -(.) show -392.9 492.1 moveto -12 f0 -( ) show -0 463.2 moveto -14 f1 -(I want to run an Evolutionary Algorithm ) show -248.5 463.2 moveto -14 f1 -(now) show -0 436.2 moveto -12 f0 -(You can choose to run a standard ) show -162.9 436.2 moveto -12 f0 -(bitstring Genetic Algorithm) show -296.2 436.2 moveto -12 f0 -( \(as defined in Goldberg's book\) or a) show -0 422.9 moveto -12 f0 -(standard ) show -43.6 422.9 moveto -12 f0 -(real-valued genetic algorithm) show -184.8 422.9 moveto -12 f0 -(, as proposed in Micahlewicz's book. ) show -0 395.8 moveto -12 f0 -(If you have not already done what was recommended in the ) show -289.5 395.8 moveto -12 f0 -(Tutorial main page) show -380.8 395.8 moveto -12 f0 -( , do it ) show -414.4 395.8 moveto -12 f1 -(NOW) show -444.3 395.8 moveto -12 f0 -(. Then) show -0 382.5 moveto -12 f0 -(go to the Lesson1 sub-dir of the tutorial dir, and simply type at the system prompt ) show -0 355.9 moveto -10 f4 -(\(myname@myhost\) EOdir/Tutorial/Lesson1 % ) show -246 355.9 moveto -10 f4 -(FirstRealGA) show -312 355.9 moveto -12 f0 -( ) show -0 342.6 moveto -12 f0 -(or ) show -0 329.3 moveto -10 f4 -(\(myname@myhost\) EOdir/Tutorial/Lesson1 % ) show -246 329.3 moveto -10 f4 -(FirstBitGA) show -306 329.3 moveto -12 f0 -( ) show -0 302.7 moveto -12 f0 -(and something should happen. ) show -0 273.8 moveto -14 f1 -(What is happening?) show -0 246.8 moveto -12 f0 -(At the moment, the ) show -95.6 246.8 moveto -12 f0 -(FirstBitGA) show -149.6 246.8 moveto -12 f0 -( maximizes the number of ones in the bitstring \(also calls the) show -0 233.5 moveto -12 f0 -(OneMaxfunction) show -81.9 233.5 moveto -12 f0 -(, whose solution is, as you can guess, ) show -263.5 233.5 moveto -12 f0 -(11111111) show -311.4 233.5 moveto -12 f0 -(\), and the ) show -359.3 233.5 moveto -12 f0 -(FirstRealGA) show -420.6 233.5 moveto -12 f0 -( is) show -0 220.2 moveto -12 f0 -(maximizing \(the default action for EO is to maximize\) the inverse of the sum \(i.e. minimizing the) show -0 206.9 moveto -12 f0 -(sum\) of the square of its variables \(also called the ) show -241.2 206.9 moveto -12 f0 -(sphere function) show -315.5 206.9 moveto -12 f0 -(, whose solution is ... ) show -419.8 206.9 moveto -12 f0 -(all zeroes) show -465.4 206.9 moveto -12 f0 -(\). ) show -0 180.3 moveto -12 f0 -(And what you see on the screen when running one of these two programs is, in each case, the initial) show -0 167 moveto -12 f0 -(and final population of an Evolutionary run, one individual per line, its fitness first, then the number) show -0 153.7 moveto -12 f0 -(of items \(bits or real numbers\) of the genotype, and the genotype itself. The final population) show -0 140.4 moveto -12 f0 -(hopefully contains the solution in the discrete case, and is close to it in the continuous case. ) show -0 113.8 moveto -12 f0 -(You need now to take a look at either programs by browsing alone through the sources for) show -0 100.5 moveto -12 f0 -(FirstBitGA) show -54 100.5 moveto -12 f0 -( and ) show -77.3 100.5 moveto -12 f0 -(FirstRealGA) show -138.6 100.5 moveto -12 f0 -(, or follow the guided tour below, or go directly to the ) show -400.5 100.5 moveto -12 f0 -(exercises) show -444.4 100.5 moveto -12 f0 -(. ) show -pagelevel restore -showpage -%%Page: 2 2 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 481 0 rlineto 0 689 rlineto -481 0 rlineto closepath clip newpath -0 747.9 moveto -14 f1 -(Browsing the code:) show -18.1 724.5 moveto -3.3 3.3 c fill -28 720.4 moveto -12 f1 -(General includes:) show -118.3 720.4 moveto -12 f0 -(Like all C-like code, the file starts with include directives \() show -401.2 720.4 moveto -12 f0 -(Bit) show -415.8 720.4 moveto -12 f0 -( - ) show -425.7 720.4 moveto -12 f0 -(Real) show -447.6 720.4 moveto -12 f0 -(\).) show -28 706.6 moveto -12 f0 -(Apart from standard includes, the spedific file to include is ) show -313.6 706.6 moveto -12 f1 -(eo) show -324.9 706.6 moveto -12 f0 -(: this is a file that contains the) show -28 693.3 moveto -12 f0 -(list of the most important EO files.) show -195 693.3 moveto -12 f0 -( ) show -28 680 moveto -12 f0 -( ) show -18.1 670.3 moveto -3.3 3.3 c fill -28 666.2 moveto -12 f1 -(Representation) show -105.9 666.2 moveto -12 f0 -(: you then have to delclare the type of individuals you will be handling. All) show -28 652.9 moveto -12 f0 -(evolution-related objects you will need are templatized w.r.t. the type of individuals.) show -433.6 652.9 moveto -12 f0 -( ) show -46.1 643.2 moveto -3.3 3.3 c stroke -56 639.1 moveto -12 f0 -(Bit) show -70.6 639.1 moveto -12 f0 -( You say here that you will be handling ) show -262.9 639.1 moveto -12 f1 -(Bitstring genotypes) show -361.8 639.1 moveto -12 f0 -(, whose fitness is a) show -56 625.8 moveto -12 f0 -(double. This makes Indi derive from the ) show -251.9 625.8 moveto -12 f0 -(STL class) show -299.5 625.8 moveto -12 f0 -( ) show -302.4 625.8 moveto -12 f0 -(vector) show -367.2 625.8 moveto -12 f0 -( ) show -46.1 616.1 moveto -3.3 3.3 c stroke -56 612 moveto -12 f0 -(Real) show -77.9 612 moveto -12 f0 -( You say here that you will be handling ) show -270.2 612 moveto -12 f1 -(Real-valued genotypes) show -385.1 612 moveto -12 f0 -(, whose fitness is a) show -56 598.7 moveto -12 f0 -(double. This makes Indi derive from the ) show -251.9 598.7 moveto -12 f0 -(STL class) show -299.5 598.7 moveto -12 f0 -( ) show -302.4 598.7 moveto -12 f0 -(vector) show -378.5 598.7 moveto -12 f0 -( ) show -56 585.4 moveto -12 f0 -( ) show -18.1 575.7 moveto -3.3 3.3 c fill -28 571.6 moveto -12 f1 -(Fitness function:) show -113.6 571.6 moveto -12 f0 -( the code for the fitness function is included in the file. It must take as) show -28 558.3 moveto -12 f0 -(argument a reference to an individual \(at the moment\).) show -290.2 558.3 moveto -12 f0 -( ) show -46.1 549.1 moveto -3.3 3.3 c stroke -56 545 moveto -12 f0 -(Bit) show -70.6 545 moveto -12 f0 -( This function simply computes the number of ones of the bitstring \(it's called the) show -56 531.7 moveto -12 f0 -(OneMax function\). The optimum is of course the all-ones bitstring.) show -378.9 531.7 moveto -12 f0 -( ) show -46.1 522.5 moveto -3.3 3.3 c stroke -56 518.4 moveto -12 f0 -(Real) show -77.9 518.4 moveto -12 f0 -( This function simply computes the inverse of the sum of the squares of all) show -56 505.1 moveto -12 f0 -(variables \(also called the sphere function\). The optimum is of course the all-zeroes) show -56 491.8 moveto -12 f0 -(vector.) show -88.9 491.8 moveto -12 f0 -( ) show -56 478.5 moveto -12 f0 -( ) show -18.1 468.8 moveto -3.3 3.3 c fill -28 464.7 moveto -12 f1 -(Parameters) show -87.3 464.7 moveto -12 f0 -(: all parameters of the algorithm are declared here \() show -333.5 464.7 moveto -12 f0 -(Bit) show -348.1 464.7 moveto -12 f0 -( - ) show -358 464.7 moveto -12 f0 -(Real) show -379.9 464.7 moveto -12 f0 -(\), and their values) show -28 451.4 moveto -12 f0 -(and assigned. Of course, this means that you will need to recompile to change these values -) show -28 438.1 moveto -12 f0 -(see Lesson 3 to get rid of that heavy requirement.) show -265.2 438.1 moveto -12 f0 -( ) show -28 424.8 moveto -12 f0 -( ) show -18.1 415.1 moveto -3.3 3.3 c fill -28 411 moveto -12 f1 -(Random seeding:) show -117 411 moveto -12 f0 -( Random numbers play an important role in Evolutionary Algorithms. See) show -28 397.7 moveto -12 f0 -(in ) show -40.3 397.7 moveto -12 f0 -(EO programming hints) show -150.9 397.7 moveto -12 f0 -( more details about how this is simulated in EO - but as far as you) show -28 384.4 moveto -12 f0 -(are concerned now, remember that the ) show -214.9 384.4 moveto -12 f0 -(global Random Number Generator) show -381.8 384.4 moveto -12 f0 -( is called ) show -427.4 384.4 moveto -12 f5 -(rng) show -448.9 384.4 moveto -12 f0 -( and) show -28 370.8 moveto -12 f0 -(should be used everywhere you need a realization of a random variable of known law.) show -28 357.5 moveto -12 f0 -(Moreover, this RNG requires a ) show -179.9 357.5 moveto -12 f5 -(seed) show -208.6 357.5 moveto -12 f0 -(, which is set here \() show -301.9 357.5 moveto -12 f0 -(Bit) show -316.5 357.5 moveto -12 f0 -( - ) show -326.4 357.5 moveto -12 f0 -(Real) show -348.3 357.5 moveto -12 f0 -(\): everytime you run the) show -28 343.9 moveto -12 f0 -(algorithm with the ) show -119.6 343.9 moveto -12 f0 -(same seed) show -168.5 343.9 moveto -12 f0 -(, you will get the ) show -252.4 343.9 moveto -12 f0 -(same result) show -306.7 343.9 moveto -12 f0 -(. Hence, to test the robustness of) show -28 330.6 moveto -12 f0 -(your algorithm, you should run it with different seeds. This is rather time consuming in the) show -28 317.3 moveto -12 f0 -(present programs, so we suggest that you wait until Lesson 3 to do so.) show -364.3 317.3 moveto -12 f0 -( ) show -28 304 moveto -12 f0 -( ) show -18.1 294.3 moveto -3.3 3.3 c fill -28 290.2 moveto -12 f1 -(Fitness function encapsulation: ) show -190.3 290.2 moveto -12 f0 -(EO is based on the notion of ) show -329.9 290.2 moveto -12 f0 -(functors) show -369.2 290.2 moveto -12 f0 -( - hence you now need) show -28 276.9 moveto -12 f0 -(to encapsulate your fitness function into a functor object. This is what is done here \() show -431.2 276.9 moveto -12 f0 -(Bit) show -445.8 276.9 moveto -12 f0 -( -) show -28 263.6 moveto -12 f0 -(Real) show -49.9 263.6 moveto -12 f0 -(\).) show -56.8 263.6 moveto -12 f0 -( ) show -28 250.3 moveto -12 f0 -( ) show -18.1 240.6 moveto -3.3 3.3 c fill -28 236.5 moveto -12 f1 -(Initialization) show -94 236.5 moveto -12 f0 -(: to initialize the population, first declare an empty object of class ) show -411.6 236.5 moveto -10 f5 -(eoPop) show -477.6 236.5 moveto -12 f0 -(,) show -28 223.2 moveto -12 f0 -(which is basically an ) show -131.3 223.2 moveto -12 f0 -(STL) show -152.6 223.2 moveto -12 f0 -( ) show -155.5 223.2 moveto -10 f5 -(vector) show -227.5 223.2 moveto -12 f0 -(, then fill it with Indi's.) show -339.1 223.2 moveto -12 f0 -( And remember that) show -28 209.9 moveto -10 f5 -(v.push_back) show -94 209.9 moveto -12 f0 -( simply appends its argument at the end of ) show -300.3 209.9 moveto -12 f0 -(STL) show -321.6 209.9 moveto -12 f0 -( vector ) show -357.5 209.9 moveto -10 f5 -(v.) show -369.5 209.9 moveto -12 f0 -( ) show -46.1 198.9 moveto -3.3 3.3 c stroke -56 194.8 moveto -12 f0 -(Bit) show -70.6 194.8 moveto -12 f0 -( ) show -73.5 194.8 moveto -10 f5 -(rng.flip\(\)) show -133.5 194.8 moveto -12 f0 -( return a ) show -176.4 194.8 moveto -14 f0 -(random boolean) show -266.9 194.8 moveto -12 f0 -( ) show -46.1 183.4 moveto -3.3 3.3 c stroke -56 179.3 moveto -12 f0 -(Real) show -77.9 179.3 moveto -12 f0 -( ) show -80.8 179.3 moveto -10 f5 -(rng.uniform\(\)) show -158.8 179.3 moveto -12 f0 -( returns a ) show -206.4 179.3 moveto -14 f0 -(real value uniformly drawn in [0,1].) show -407.4 179.3 moveto -12 f0 -( ) show -56 165.6 moveto -12 f0 -( ) show -18.1 155.9 moveto -3.3 3.3 c fill -28 151.8 moveto -12 f1 -(Output) show -65.3 151.8 moveto -12 f0 -(: take a snapshot at the initial population \() show -266.6 151.8 moveto -12 f0 -(Bit) show -281.2 151.8 moveto -12 f0 -( - ) show -291.1 151.8 moveto -12 f0 -(Real) show -313 151.8 moveto -12 f0 -(\). Sort it first, so the best) show -28 138.5 moveto -12 f0 -(individuals are first, and display it. Note that an eoPop has a ) show -319.9 138.5 moveto -10 f5 -(<<) show -331.9 138.5 moveto -12 f0 -( method, which means that a) show -28 125.2 moveto -12 f0 -(simple ) show -63 125.2 moveto -10 f5 -(os << pop ) show -123 125.2 moveto -12 f0 -(streams the ) show -180.3 125.2 moveto -10 f5 -(pop) show -198.3 125.2 moveto -12 f0 -( onto the ostream ) show -284.2 125.2 moveto -10 f5 -(os) show -296.2 125.2 moveto -12 f0 -(. This is true for ) show -376.1 125.2 moveto -12 f0 -(all objects of of class) show -28 109.6 moveto -14 f1 -(eoPrintable) show -97.2 109.6 moveto -12 f0 -( \(most EO objects\) through the method ) show -287.5 109.6 moveto -10 f5 -(printOn) show -329.5 109.6 moveto -12 f0 -( \(which is then called by the ) show -467.8 109.6 moveto -10 f5 -(<<) show -28 95.9 moveto -12 f0 -(operator\).) show -74.9 95.9 moveto -12 f0 -( ) show -28 82.6 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 3 3 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 481 0 rlineto 0 689 rlineto -481 0 rlineto closepath clip newpath -18.1 753.8 moveto -3.3 3.3 c fill -28 749.7 moveto -12 f1 -(Evolution engine:) show -118.3 749.7 moveto -12 f0 -( The selection/replacement mechanism \() show -312.2 749.7 moveto -12 f0 -(Bit) show -326.8 749.7 moveto -12 f0 -( - ) show -336.7 749.7 moveto -12 f0 -(Real) show -358.6 749.7 moveto -12 f0 -(\) is a simple generational) show -28 734.1 moveto -12 f0 -(GA here: a simple selector, and a generational replacement. The ) show -339.2 734.1 moveto -14 f1 -(eoDetTournament) show -448.8 734.1 moveto -12 f0 -( has) show -28 720.4 moveto -12 f0 -(been chosen as a robust selection, and the generational replacement \(all parents are replaced) show -28 707.1 moveto -12 f0 -(by the offspring\) is hard-coded in the eoSGA ) show -247.9 707.1 moveto -12 f0 -(algorithm) show -294.5 707.1 moveto -12 f0 -(.) show -297.4 707.1 moveto -12 f0 -( ) show -28 693.8 moveto -12 f0 -( ) show -18.1 684.1 moveto -3.3 3.3 c fill -28 680 moveto -12 f1 -(Variation operators) show -129.6 680 moveto -12 f0 -(:) show -132.9 680 moveto -12 f0 -( in the simple algorithm considered here, individuals undergo ) show -430.8 680 moveto -12 f0 -(crossover) show -28 664.4 moveto -12 f0 -(and ) show -48.3 664.4 moveto -12 f0 -(mutation) show -90.9 664.4 moveto -12 f0 -(. In EO, these operators are \() show -228.8 664.4 moveto -12 f0 -(functor) show -263.4 664.4 moveto -12 f0 -(\) objects of class) show -343.7 664.4 moveto -12 f0 -( ) show -346.6 664.4 moveto -14 f1 -(eoQuadOp) show -411.9 664.4 moveto -12 f0 -( \(binary) show -28 648.4 moveto -12 f0 -(operator that modifies both its arguments\) and ) show -252.9 648.4 moveto -14 f1 -(eoMonOp) show -312.7 648.4 moveto -12 f0 -( \(unary operator\). These operators) show -28 634.7 moveto -12 f0 -(are applied in turn to all selected parents, according to user-defined probabilities. These) show -28 621.4 moveto -12 f0 -(probabilities are defined with all other ) show -214.6 621.4 moveto -12 f0 -(parameters) show -267.2 621.4 moveto -12 f0 -(, and will be passed to the ) show -394.5 621.4 moveto -12 f5 -(eoSGA) show -430.6 621.4 moveto -12 f0 -(algorithm) show -477.2 621.4 moveto -12 f0 -(.) show -46.1 609.6 moveto -3.3 3.3 c stroke -56 605.5 moveto -12 f0 -(Bit) show -70.6 605.5 moveto -12 f0 -( The crossover ) show -144.2 605.5 moveto -14 f1 -(eoBinCrossover) show -239 605.5 moveto -12 f0 -( is the standard ) show -314.3 605.5 moveto -12 f0 -(1-point crossover) show -397.9 605.5 moveto -12 f0 -(, and) show -56 589.5 moveto -14 f1 -(eoBinMutation) show -146.2 589.5 moveto -12 f0 -( is the standard ) show -221.5 589.5 moveto -12 f0 -(bit-flip mutation) show -300.5 589.5 moveto -12 f0 -( that randomly flips all bits with a) show -56 575.8 moveto -12 f0 -(given probability ) show -141.3 575.8 moveto -10 f5 -(P_MUT_PER_BIT.) show -225.3 575.8 moveto -12 f0 -( ) show -56 562 moveto -12 f1 -(Warning) show -102 562 moveto -12 f0 -(: the ) show -125.9 562 moveto -10 f5 -(P_MUT_PER_BIT) show -203.9 562 moveto -12 f0 -( probability is an ) show -287.8 562 moveto -12 f0 -(internal parameter) show -375.4 562 moveto -12 f0 -( of the) show -56 548.2 moveto -12 f5 -(eoBinMutation) show -149.5 548.2 moveto -12 f0 -(, it is ) show -176.1 548.2 moveto -12 f1 -(NOT) show -202.1 548.2 moveto -12 f0 -( the probability of mutation at the individual level. EO) show -56 534.6 moveto -12 f0 -(corrects what can be viewed as an inconsistency in Holland's original work, further) show -56 521.3 moveto -12 f0 -(used in Goldberg's book by separating the probability of mutation for each individual) show -56 508 moveto -12 f0 -(\(independent of the type of mutation that will be applied\) from the probability of) show -56 494.7 moveto -12 f0 -(flipping each bit, which is specific of the bit-flip mutation. Hence, to run the same) show -56 481.4 moveto -12 f0 -(algorithm as Goldberg's SGA, the mutation probability \(at individual level\) is 1, and the) show -56 468.1 moveto -12 f0 -(probability of flipping each bit is ) show -217.3 468.1 moveto -10 f5 -(P_MUT_PER_BIT.) show -301.3 468.1 moveto -12 f0 -( ) show -46.1 456.6 moveto -3.3 3.3 c stroke -56 452.5 moveto -12 f0 -(Real) show -77.9 452.5 moveto -12 f0 -( The crossover ) show -151.5 452.5 moveto -14 f1 -(eoArithmeticCrossover) show -290.6 452.5 moveto -12 f0 -( is the standard ) show -365.9 452.5 moveto -12 f0 -(arithmetic crossover) show -463.5 452.5 moveto -12 f0 -( for) show -56 438.8 moveto -12 f0 -(real-valued vectors, that chooses a point randomly on the segment between both parents) show -56 423.2 moveto -12 f0 -(\(also termed ) show -118.6 423.2 moveto -12 f0 -(BLX-0) show -152.5 423.2 moveto -12 f0 -(\). ) show -162.4 423.2 moveto -14 f1 -(eoUniformMutation) show -282.9 423.2 moveto -12 f0 -( is the ) show -314.5 423.2 moveto -12 f0 -(uniform mutation) show -398.8 423.2 moveto -12 f0 -( for real-valued) show -56 409.5 moveto -12 f0 -(vectors that choses a new value for each variable uniformly on an interval centered on) show -56 396.2 moveto -12 f0 -(the parent value. The width of the interval is an ) show -286.2 396.2 moveto -12 f0 -(internal parameter) show -373.8 396.2 moveto -12 f0 -( of the object, here) show -56 382.9 moveto -12 f0 -(called ) show -87.6 382.9 moveto -10 f5 -(EPSILON) show -129.7 382.9 moveto -12 f0 -(.) show -132.6 382.9 moveto -12 f0 -( ) show -56 369.6 moveto -12 f0 -( ) show -18.1 359.9 moveto -3.3 3.3 c fill -28 355.8 moveto -12 f1 -(Stopping criterion:) show -125.6 355.8 moveto -12 f0 -( Specify a ) show -176.5 355.8 moveto -12 f0 -(maximum number of generations) show -336.1 355.8 moveto -12 f0 -( to run \() show -374.4 355.8 moveto -12 f0 -(Bit) show -389 355.8 moveto -12 f0 -( - ) show -398.9 355.8 moveto -12 f0 -(Real) show -420.8 355.8 moveto -12 f0 -(\): the) show -28 342.5 moveto -12 f0 -(simplest of all stopping criteria at the moment, using an object of a sub-class of class) show -28 326.9 moveto -14 f1 -(eoContinue) show -96.4 326.9 moveto -12 f0 -(.) show -99.3 326.9 moveto -12 f0 -( ) show -28 313.2 moveto -12 f0 -( ) show -18.1 303.5 moveto -3.3 3.3 c fill -28 299.4 moveto -12 f1 -(The algorithm: ) show -108.6 299.4 moveto -12 f0 -(the simple algorithm that is used here, called ) show -329.2 299.4 moveto -12 f5 -(eoSGA ) show -372.3 299.4 moveto -12 f0 -(requires as parameters) show -28 285.8 moveto -12 f0 -(a ) show -36.3 285.8 moveto -12 f0 -(selector) show -73.6 285.8 moveto -12 f0 -(, a ) show -87.9 285.8 moveto -12 f0 -(crossover) show -133.9 285.8 moveto -12 f0 -( and the associated ) show -227.2 285.8 moveto -12 f0 -(crossover rate) show -294.1 285.8 moveto -12 f0 -(, a ) show -308.4 285.8 moveto -12 f0 -(mutation) show -351 285.8 moveto -12 f0 -( and the associated) show -28 272.5 moveto -12 f0 -(mutation rate,) show -94.6 272.5 moveto -12 f0 -( and a ) show -126.2 272.5 moveto -12 f0 -(stopping criterion) show -211.1 272.5 moveto -12 f0 -(. Take a look at the corresponding ) show -377.7 272.5 moveto -12 f0 -(constructor) show -431.7 272.5 moveto -12 f0 -( of the) show -28 259.2 moveto -12 f0 -(class ) show -54.3 259.2 moveto -12 f5 -(eoSGA) show -90.4 259.2 moveto -12 f0 -(: it only initializes its ) show -194.7 259.2 moveto -12 f0 -(private data) show -251 259.2 moveto -12 f0 -( with the parameters. Now look at the) show -28 245.6 moveto -12 f0 -(operator\(\)) show -75.9 245.6 moveto -12 f0 -( method - the one that is called in the code for ) show -299.1 245.6 moveto -12 f0 -(FirstBitGA) show -353.1 245.6 moveto -12 f0 -( or ) show -369 245.6 moveto -12 f0 -(FirstRealGA) show -430.3 245.6 moveto -12 f0 -( - and) show -28 232.3 moveto -12 f0 -(you'll find out that is is as simple as it sounds.) show -250.3 232.3 moveto -12 f0 -( ) show -28 219 moveto -12 f0 -( ) show -18.1 209.3 moveto -3.3 3.3 c fill -28 205.2 moveto -12 f1 -(Output) show -65.3 205.2 moveto -12 f0 -(: After running the algorithm, output the sorted final population \() show -377.6 205.2 moveto -12 f0 -(Bit) show -392.2 205.2 moveto -12 f0 -( - ) show -402.1 205.2 moveto -12 f0 -(Real) show -424 205.2 moveto -12 f0 -(\) - and look) show -28 191.9 moveto -12 f0 -(at the best individual: this is the result of the algorithm.) show -293.6 191.9 moveto -12 f0 -( ) show -28 178.6 moveto -12 f0 -( ) show -18.1 168.9 moveto -3.3 3.3 c fill -28 164.8 moveto -12 f1 -(Main body:) show -87.6 164.8 moveto -12 f0 -( for technical reasons \(intercepting the exceptions\), we need a main like this one) show -28 151.5 moveto -12 f0 -(\() show -31.9 151.5 moveto -12 f0 -(Bit) show -46.5 151.5 moveto -12 f0 -( - ) show -56.4 151.5 moveto -12 f0 -(Real) show -78.3 151.5 moveto -12 f0 -(\)., and you should not touch it unless you know what you are doing. Simply note) show -28 138.2 moveto -12 f0 -(that this main calls the function main_function, which we have been discussing up to now!) show -463.6 138.2 moveto -12 f0 -( ) show -0 109.3 moveto -14 f1 -(Exercise 1: maximize your own function) show -0 82.3 moveto -12 f0 -(This is very easy - if your search space is that of bitstring or of unbounded real numbers. ) show -pagelevel restore -showpage -%%Page: 4 4 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 481 0 rlineto 0 689 rlineto -481 0 rlineto closepath clip newpath -18.1 748.8 moveto -3.3 3.3 c fill -28 744.7 moveto -12 f0 -(Go to the tutorial directory, and ) show -182.9 744.7 moveto -12 f0 -(copy) show -206.2 744.7 moveto -12 f0 -( the program you want to modify onto ) show -392.3 744.7 moveto -10 f5 -(mytest.cpp.) show -458.3 744.7 moveto -12 f0 -( ) show -18.1 735.5 moveto -3.3 3.3 c fill -28 731.4 moveto -12 f0 -(Edit) show -48 731.4 moveto -12 f0 -( ) show -51.1 731.4 moveto -10 f5 -(mytest.cpp) show -111.1 731.4 moveto -12 f0 -( with any text editor:) show -211 731.4 moveto -12 f0 -( ) show -18.1 722.2 moveto -3.3 3.3 c fill -28 718.1 moveto -12 f0 -(Modify) show -63.9 718.1 moveto -12 f0 -( the fitness function itself \() show -192.8 718.1 moveto -12 f0 -(binary_value) show -255.4 718.1 moveto -12 f0 -( in ) show -270.7 718.1 moveto -10 f5 -(FirstBitGA) show -330.7 718.1 moveto -12 f0 -(,) show -333.6 718.1 moveto -12 f0 -(real_value) show -383.5 718.1 moveto -12 f0 -( in ) show -401.8 718.1 moveto -10 f5 -(FirstRealGA) show -467.8 718.1 moveto -12 f0 -(\)) show -471.7 718.1 moveto -12 f0 -( ) show -18.1 708.9 moveto -3.3 3.3 c fill -28 704.8 moveto -12 f0 -(Compile) show -69.3 704.8 moveto -12 f0 -( the program by typing ) show -182.4 704.8 moveto -10 f5 -(make mytest) show -248.4 704.8 moveto -12 f0 -( at system prompt) show -334 704.8 moveto -12 f0 -( ) show -18.1 695.6 moveto -3.3 3.3 c fill -28 691.5 moveto -12 f0 -(Run) show -48 691.5 moveto -12 f0 -( the new program by entering the command ) show -260.8 691.5 moveto -10 f5 -(mytest) show -296.8 691.5 moveto -12 f0 -( at system prompt.) show -385.4 691.5 moveto -12 f0 -( ) show -0 662.6 moveto -14 f1 -(Exercise 2: check the differences between both programs) show -0 635.6 moveto -12 f0 -(Go and take a look at the code for these programs ) show -241.6 635.6 moveto -12 f0 -(\() show -245.5 635.6 moveto -12 f0 -(Bit) show -260.1 635.6 moveto -12 f0 -( - ) show -270 635.6 moveto -12 f0 -(Real) show -291.9 635.6 moveto -12 f0 -(\)) show -295.8 635.6 moveto -12 f0 -(. Use the symbolic representation of) show -0 622.3 moveto -12 f0 -(an Evolutionary Algorithm \(you should understand that figure now, otherwise go ) show -392.6 622.3 moveto -12 f0 -(there) show -416.5 622.3 moveto -12 f0 -( and come) show -0 609 moveto -12 f0 -(back\) to understand how each part of the EA is coded. Try to spot the differences between both) show -0 595.7 moveto -12 f0 -(codes: there are not so many! ) show -0 582.4 moveto -12 f0 -(After you've tried that alone, take a look at the ) show -227.6 582.4 moveto -12 f0 -(solution) show -266.2 582.4 moveto -12 f0 -( :-\) ) show -0 569.1 moveto -12 f0 -( ) show -0 540.2 moveto -14 f1 -(Exercise 3: change the selection procedure) show -0 513.2 moveto -12 f0 -(This is rather straightforward ... if you know what other types of selection are available! ) show -0 499.9 moveto -12 f0 -(At the moment, let's only consider only the following simple ones: ) show -18.1 477.4 moveto -3.3 3.3 c fill -28 473.3 moveto -12 f0 -(You already know the ) show -137.3 473.3 moveto -12 f0 -(tournament selection) show -237.6 473.3 moveto -12 f0 -( ) show -28 460 moveto -12 f0 -(Syntax: ) show -70.6 460 moveto -10 f5 -(eoDetTournament select\(T_SIZE\); ) show -310.6 460 moveto -10 f4 -(// T_SIZE in [2,POP_SIZE\)) show -460.6 460 moveto -12 f0 -( ) show -18.1 450.8 moveto -3.3 3.3 c fill -28 446.7 moveto -12 f0 -(Try the well-known ) show -126.3 446.7 moveto -12 f0 -(roulette wheel) show -194.6 446.7 moveto -12 f0 -( ) show -28 433.4 moveto -12 f0 -( ) show -30.9 433.4 moveto -12 f0 -(Syntax: ) show -70.5 433.4 moveto -12 f0 -( ) show -79.4 433.4 moveto -10 f5 -(eoProportional select;) show -247.4 433.4 moveto -12 f0 -( ) show -18.1 424.2 moveto -3.3 3.3 c fill -28 420.1 moveto -12 f0 -(Or the ) show -61.3 420.1 moveto -12 f0 -(stochastic binary tournament) show -199.9 420.1 moveto -12 f0 -( ) show -28 406.8 moveto -12 f0 -(Syntax: ) show -70.6 406.8 moveto -10 f5 -(eoStochTournament select\(RATE\); ) show -298.6 406.8 moveto -10 f4 -( // RATE in ]0.5,1]) show -430.6 406.8 moveto -12 f0 -( ) show -18.1 397.6 moveto -3.3 3.3 c fill -28 393.5 moveto -12 f0 -(and of course the ) show -113.3 393.5 moveto -12 f0 -(random) show -149.9 393.5 moveto -12 f0 -( selection should give bad results!) show -312.8 393.5 moveto -12 f0 -( ) show -28 380.2 moveto -12 f0 -(Syntax: ) show -70.6 380.2 moveto -10 f5 -(eoSelectRandom select;) show -0 354.1 moveto -12 f0 -(Note that all these classes of eoObjects are derived from the abstract class ) show -357.5 354.1 moveto -14 f1 -(eoSelectOne.) show -434 354.1 moveto -12 f0 -( ) show -0 321 moveto -18 f1 -(Lessons:) show -66 321 moveto -12 f0 -( ) show -18.1 297.2 moveto -3.3 3.3 c fill -28 293.1 moveto -12 f0 -(in EO, all actions are performed by ) show -199.9 293.1 moveto -12 f0 -(functor objects) show -271.5 293.1 moveto -12 f0 -( \(this section is the last time in this tutorial) show -28 279.8 moveto -12 f0 -(that there is a direct link to the ) show -177.3 279.8 moveto -12 f0 -(EO Programming hints) show -288.6 279.8 moveto -12 f0 -( page - though the link at top and) show -28 266.5 moveto -12 f0 -(bottom of all pages will remain there\).) show -212.3 266.5 moveto -12 f0 -( ) show -18.1 256.8 moveto -3.3 3.3 c fill -28 252.7 moveto -12 f0 -(in EO, all object you will usually need to manipulate are ) show -301.9 252.7 moveto -12 f0 -(templatized) show -357.8 252.7 moveto -12 f1 -( w.r.t. the type of the) show -28 238.9 moveto -12 f1 -(individual) show -80 238.9 moveto -12 f0 -( you are handling.) show -166.6 238.9 moveto -12 f0 -( ) show -18.1 229.2 moveto -3.3 3.3 c fill -28 225.1 moveto -12 f0 -(The type of the individual is itself ) show -193.6 225.1 moveto -12 f0 -(templatized) show -249.5 225.1 moveto -12 f1 -( w.r.t. the type of fitness) show -372.1 225.1 moveto -12 f0 -( \(double by default\).) show -470 225.1 moveto -12 f0 -( ) show -18.1 215.9 moveto -3.3 3.3 c fill -28 211.8 moveto -12 f0 -(In EO \(actually, in EC!\) ) show -146.6 211.8 moveto -12 f0 -(initialization and variation) show -273.2 211.8 moveto -12 f0 -( operators are ) show -341.5 211.8 moveto -12 f0 -(representation) show -409.4 211.8 moveto -12 f0 -(-dependent,) show -28 198.5 moveto -12 f0 -(while the ) show -75.3 198.5 moveto -12 f0 -(evolution engine) show -155.6 198.5 moveto -12 f0 -( is ) show -169.6 198.5 moveto -12 f0 -(representation) show -237.5 198.5 moveto -12 f0 -(-independent \(well, like any rule, this one does) show -28 185.2 moveto -12 f0 -(have some exceptions\).) show -140.3 185.2 moveto -12 f0 -( ) show -18.1 176 moveto -3.3 3.3 c fill -28 171.9 moveto -12 f0 -(Changing the ) show -95.3 171.9 moveto -12 f0 -(fitness function) show -169.6 171.9 moveto -12 f0 -(, or the ) show -206.2 171.9 moveto -12 f0 -(selection procedure) show -299.8 171.9 moveto -12 f0 -( inside the generational GA evolution) show -28 158.6 moveto -12 f0 -(engine is straightforward.) show -150.9 158.6 moveto -12 f0 -( ) show -18.1 149.4 moveto -3.3 3.3 c fill -28 145.3 moveto -12 f0 -(remember, all ) show -97.6 145.3 moveto -12 f0 -(solutions) show -140.9 145.3 moveto -12 f0 -( to exercises are in the same sub-dir of dir Tutorial than the lesson) show -28 132 moveto -12 f0 -(itself \(see ) show -77.3 132 moveto -12 f0 -(here) show -97.9 132 moveto -12 f0 -(\).) show -104.8 132 moveto -12 f0 -( ) show -0 109.6 moveto -481 0 rlineto 0 -1.4 rlineto -481 0 rlineto closepath fill -0 90.3 moveto -12 f0 -(Lesson 2) show -42.9 90.3 moveto -12 f0 -( - ) show -52.8 90.3 moveto -12 f0 -(Tutorial main page) show -144.1 90.3 moveto -12 f0 -( - ) show -154 90.3 moveto -12 f0 -(Top-Down page) show -232.3 90.3 moveto -12 f0 -( - ) show -242.2 90.3 moveto -12 f0 -(Bottom-up page) show -319.8 90.3 moveto -12 f0 -( - ) show -329.7 90.3 moveto -12 f0 -(Programming hints) show -422 90.3 moveto -12 f0 -( - ) show -431.9 90.3 moveto -14 f0 -(EO) show -pagelevel restore -showpage -%%Page: 5 5 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 481 0 rlineto 0 689 rlineto -481 0 rlineto closepath clip newpath -0 748.4 moveto -14 f0 -(documentation) show -83.2 748.4 moveto -12 f0 -( ) show -0 738.9 moveto -481 0 rlineto 0 -1.4 rlineto -481 0 rlineto closepath fill -0.2 721.6 moveto -12 f2 -(Marc Schoenauer) show -0 695 moveto -12 f0 -(Last modified: Fri Nov 3 18:49:12 CET 2000) show -218.3 695 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%EOF