Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

258 views

Published on

No Downloads

Total views

258

On SlideShare

0

From Embeds

0

Number of Embeds

4

Shares

0

Downloads

9

Comments

0

Likes

1

No embeds

No notes for slide

- 1. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 1Lecture 10Lecture 10Evolutionary Computation:Evolutionary Computation:Evolution strategies and genetic programmingEvolution strategies and genetic programmingII Evolution strategiesEvolution strategiesII Genetic programmingGenetic programmingII SummarySummary
- 2. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 2AnotherAnother approach to simulating naturalapproach to simulating naturalevolution was proposed in Germany in the earlyevolution was proposed in Germany in the early1960s. Unlike genetic algorithms, this approach1960s. Unlike genetic algorithms, this approach−− called ancalled an evolution strategyevolution strategy −− was designedwas designedto solve technical optimisation problems.to solve technical optimisation problems.Evolution StrategiesEvolution Strategies
- 3. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 3II In 1963 two students of the TechnicalIn 1963 two students of the TechnicalUniversity of Berlin,University of Berlin, Ingo RechenbergIngo Rechenberg andandHansHans--Paul SchwefelPaul Schwefel, were working on the, were working on thesearch for the optimal shapes of bodies in asearch for the optimal shapes of bodies in aflow. They decided to try random changes inflow. They decided to try random changes inthe parameters defining the shape following thethe parameters defining the shape following theexample of natural mutation. As a result, theexample of natural mutation. As a result, theevolution strategyevolution strategy was born.was born.II Evolution strategies were developed as anEvolution strategies were developed as analternative to the engineeralternative to the engineer’’s intuition.s intuition.II UnlikeUnlike GAsGAs, evolution strategies use only a, evolution strategies use only amutation operator.mutation operator.
- 4. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 4In its simplest form, termed as a (1In its simplest form, termed as a (1++1)1)--evolutionevolutionstrategy, one parent generates one offspring perstrategy, one parent generates one offspring pergeneration by applyinggeneration by applying normally distributednormally distributedmutation. The (1mutation. The (1++1)1)--evolution strategy can beevolution strategy can beimplemented as follows:implemented as follows:Step 1Step 1:: Choose the number of parametersChoose the number of parameters NN totorepresent the problem, and then determine a feasiblerepresent the problem, and then determine a feasiblerange for each parameter:range for each parameter:Define a standard deviation for each parameter andDefine a standard deviation for each parameter andthe function to be optimisedthe function to be optimised..Basic evolutionBasic evolution strategiesstrategies{ }axmmin xx 11 , , { }axmmin xx 22 , , . . . , { }axmNminN xx ,
- 5. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 5Step 2Step 2:: Randomly select an initial value for eachRandomly select an initial value for eachparameter from the respective feasible range. Theparameter from the respective feasible range. Theset of these parameters will constitute the initialset of these parameters will constitute the initialpopulation of parent parameters:population of parent parameters:xx11,, xx22, . . . ,, . . . , xxNNStep 3Step 3:: Calculate the solution associated with theCalculate the solution associated with theparent parameters:parent parameters:X = fX = f ((xx11,, xx22, . . . ,, . . . , xxNN))
- 6. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 6Step 4Step 4:: Create a new (offspring) parameter byCreate a new (offspring) parameter byadding a normally distributed random variableadding a normally distributed random variable aawith meanwith mean zero and prezero and pre--selected deviationselected deviation δδ to eachto eachparent parameterparent parameter::ii = 1, 2, . . . ,= 1, 2, . . . , NNNormallyNormally distributed mutations with mean zerodistributed mutations with mean zeroreflect the natural process of evolutionreflect the natural process of evolution (smaller(smallerchanges occur more frequently than largerchanges occur more frequently than larger ones).ones).Step 5Step 5:: CalculateCalculate the solution associated with thethe solution associated with theoffspring parameters:offspring parameters:( )δ,0axx ii +=′( )NxxxfX ′′′=′ ,...,, 21
- 7. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 7Step 6Step 6:: CompareCompare the solution associated with thethe solution associated with theoffspring parameters with the one associated withoffspring parameters with the one associated withthe parent parameters. If the solution for thethe parent parameters. If the solution for theoffspring is better than that for the parents, replaceoffspring is better than that for the parents, replacethe parent population with the offspringthe parent population with the offspringpopulation. Otherwise, keep the parentpopulation. Otherwise, keep the parentparameters.parameters.Step 7Step 7:: GoGo to Step 4, and repeat the process until ato Step 4, and repeat the process until asatisfactory solution is reached, or a specifiedsatisfactory solution is reached, or a specifiednumber of generations is considerednumber of generations is considered..
- 8. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 8II An evolution strategy reflects the nature of aAn evolution strategy reflects the nature of achromosome.chromosome.II A single gene may simultaneously affect severalA single gene may simultaneously affect severalcharacteristics of the living organism.characteristics of the living organism.II On the other hand, a single characteristic of anOn the other hand, a single characteristic of anindividual may be determined by the simultaneousindividual may be determined by the simultaneousinteractions of several genes.interactions of several genes.II The natural selection acts on a collection of genes,The natural selection acts on a collection of genes,not on a single gene in isolation.not on a single gene in isolation.
- 9. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 9II One of the central problems in computer science isOne of the central problems in computer science ishow to make computers solve problems withouthow to make computers solve problems withoutbeing explicitly programmed to do so.being explicitly programmed to do so.II Genetic programming offers a solution through theGenetic programming offers a solution through theevolution of computer programs by methods ofevolution of computer programs by methods ofnatural selection.natural selection.II InIn fact, genetic programming is an extension of thefact, genetic programming is an extension of theconventional genetic algorithm, but the goal ofconventional genetic algorithm, but the goal ofgenetic programming is not just to evolve a bitgenetic programming is not just to evolve a bit--string representation of some problem but thestring representation of some problem but thecomputer code that solves the problem.computer code that solves the problem.GeneticGenetic programmingprogramming
- 10. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 10II Genetic programming is a recent development inGenetic programming is a recent development inthe area of evolutionary computation. It wasthe area of evolutionary computation. It wasgreatly stimulated in the 1990s bygreatly stimulated in the 1990s by John KozaJohn Koza..II According to Koza, genetic programming searchesAccording to Koza, genetic programming searchesthe space of possible computer programs for athe space of possible computer programs for aprogram that is highly fit for solving the problem atprogram that is highly fit for solving the problem athand.hand.II Any computer program is a sequence of operationsAny computer program is a sequence of operations(functions) applied to values (arguments), but(functions) applied to values (arguments), butdifferent programming languages may includedifferent programming languages may includedifferent types of statements and operations, anddifferent types of statements and operations, andhave different syntactic restrictions.have different syntactic restrictions.
- 11. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 11II Since genetic programming manipulates programsSince genetic programming manipulates programsby applying genetic operators, a programmingby applying genetic operators, a programminglanguage should permit a computer program to belanguage should permit a computer program to bemanipulated as data and the newly created data tomanipulated as data and the newly created data tobe executed as a program. For these reasons,be executed as a program. For these reasons,LISPLISP was chosen as the main language forwas chosen as the main language forgenetic programming.genetic programming.
- 12. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 12LISP has a highly symbolLISP has a highly symbol--oriented structure. Itsoriented structure. Itsbasic data structures arebasic data structures are atomsatoms andand listslists. An atom. An atomis the smallest indivisible element of the LISPis the smallest indivisible element of the LISPsyntax. The numbersyntax. The number 2121, the symbol, the symbol XX and the stringand the string““This is a stringThis is a string”” are examples of LISP atoms. Aare examples of LISP atoms. Alist is an object composed of atoms and/or otherlist is an object composed of atoms and/or otherlists. LISP lists are written as an ordered collectionlists. LISP lists are written as an ordered collectionof items inside a pair of parentheses.of items inside a pair of parentheses.LISP structureLISP structure
- 13. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 13For example, the listFor example, the list((−− ((** A B) C)A B) C)calls for the application of the subtraction functioncalls for the application of the subtraction function((−−) to two arguments, namely the list (*A B) and) to two arguments, namely the list (*A B) andthe atom C. First, LISP applies the multiplicationthe atom C. First, LISP applies the multiplicationfunction (*) to the atoms A and B.function (*) to the atoms A and B.Once the list (*A B) is evaluated, LISP applies theOnce the list (*A B) is evaluated, LISP applies thesubtraction function (subtraction function (−−) to the two arguments, and) to the two arguments, andthus evaluates the entire listthus evaluates the entire list((−− ((** A B) C).A B) C).LISP structureLISP structure
- 14. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 14Graphical representation of LISP SGraphical representation of LISP S--expressionsexpressionsII Both atoms and lists are called symbolicBoth atoms and lists are called symbolicexpressions orexpressions or SS--expressionsexpressions. In LISP, all data. In LISP, all dataand all programs are Sand all programs are S--expressions. This givesexpressions. This givesLISP the ability to operate on programs as if theyLISP the ability to operate on programs as if theywere data. In other words, LISP programs canwere data. In other words, LISP programs canmodify themselves or even write other LISPmodify themselves or even write other LISPprograms. This remarkable property of LISPprograms. This remarkable property of LISPmakes it very attractive for genetic programmingmakes it very attractive for genetic programming..II Any LISP SAny LISP S--expression can be depicted as a rootedexpression can be depicted as a rootedpointpoint--labelled tree with ordered branches.labelled tree with ordered branches.
- 15. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 15BA* C−LISP SLISP S--expression (expression (−−−−−−−− (*A B) C)(*A B) C)
- 16. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 16How do we apply genetic programmingHow do we apply genetic programmingto a problem?to a problem?BeforeBefore applying genetic programming to a problem,applying genetic programming to a problem,we must accomplishwe must accomplish five preparatory stepsfive preparatory steps::1.1. Determine the set of terminals.Determine the set of terminals.2.2. Select the set of primitive functions.Select the set of primitive functions.3.3. Define the fitness function.Define the fitness function.4.4. Decide on the parameters for controlling the run.Decide on the parameters for controlling the run.5.5. Choose the method for designating a result ofChoose the method for designating a result ofthe runthe run..
- 17. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 17II The Pythagorean Theorem helps us to illustrateThe Pythagorean Theorem helps us to illustratethese preparatory steps and demonstrate thethese preparatory steps and demonstrate thepotential of genetic programming. The theorempotential of genetic programming. The theoremsays that the hypotenuse,says that the hypotenuse, cc, of a right triangle with, of a right triangle withshort sidesshort sides aa andand bb is given byis given by22bac +=II The aim of genetic programming is to discover aThe aim of genetic programming is to discover aprogram that matches this function.program that matches this function.
- 18. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 18II To measure the performance of the asTo measure the performance of the as--yetyet--undiscovered computer program, we will use aundiscovered computer program, we will use anumber of differentnumber of different fitness casesfitness cases. The fitness. The fitnesscases for the Pythagorean Theorem arecases for the Pythagorean Theorem arerepresented by the samples of right triangles inrepresented by the samples of right triangles inTable. These fitness cases are chosen at randomTable. These fitness cases are chosen at randomover a range of values of variablesover a range of values of variables aa andand bb..Side a Side b Hypotenuse c Side a Side b Hypotenuse c3 5 5.830952 12 10 15.6204998 14 16.124515 21 6 21.84033018 2 18.110770 7 4 8.06225832 11 33.837849 16 24 28.8444104 3 5.000000 2 9 9.219545
- 19. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 19Step 1Step 1:: Determine the set of terminals.Determine the set of terminals.TheThe terminals correspond to the inputs of theterminals correspond to the inputs of thecomputer program to be discovered. Ourcomputer program to be discovered. Ourprogram takes two inputs,program takes two inputs, aa andand bb..Step 2Step 2:: SelectSelect the set of primitive functions.the set of primitive functions.TheThe functions can be presented by standardfunctions can be presented by standardarithmetic operations, standard programmingarithmetic operations, standard programmingoperations, standard mathematical functions,operations, standard mathematical functions,logical functions or domainlogical functions or domain--specific functions.specific functions.Our program will use four standard arithmeticOur program will use four standard arithmeticoperations +,operations +, −−, * and, * and //, and one mathematical, and one mathematicalfunctionfunction sqrtsqrt..
- 20. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 20Step 3Step 3:: Define the fitness function.Define the fitness function. A fitnessA fitnessfunction evaluates how well a particular computerfunction evaluates how well a particular computerprogram can solve the problem. For our problem,program can solve the problem. For our problem,the fitness of the computer program can bethe fitness of the computer program can bemeasured by the error between the actual resultmeasured by the error between the actual resultproduced by the program and the correct resultproduced by the program and the correct resultgiven by the fitness case. Typically, the error isgiven by the fitness case. Typically, the error isnot measured over just one fitness case, butnot measured over just one fitness case, butinstead calculated as a sum of the absolute errorsinstead calculated as a sum of the absolute errorsover a number of fitness cases. The closer thisover a number of fitness cases. The closer thissum is to zero, the better the computer program.sum is to zero, the better the computer program.
- 21. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 21Step 4Step 4:: Decide on the parameters for controllingDecide on the parameters for controllingthe run.the run. For controlling a run, geneticFor controlling a run, geneticprogramming uses the same primary parametersprogramming uses the same primary parametersas those used for GAs. They include theas those used for GAs. They include thepopulation size and the maximum number ofpopulation size and the maximum number ofgenerations to be run.generations to be run.Step 5Step 5:: Choose the method for designating aChoose the method for designating aresult of the run.result of the run. It is common practice inIt is common practice ingenetic programming to designate the bestgenetic programming to designate the best--soso--farfargenerated program as the result of a run.generated program as the result of a run.
- 22. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 22Once these five steps are complete, a run can beOnce these five steps are complete, a run can bemade. The run of genetic programming starts withmade. The run of genetic programming starts witha random generation of an initial population ofa random generation of an initial population ofcomputer programs. Each programcomputer programs. Each program is composed ofis composed offunctions +,functions +, −−,, **,, // andand sqrtsqrt, and terminals, and terminals aa andand bb..In the initial population, all computer programsIn the initial population, all computer programsusually have poor fitness, but some individuals areusually have poor fitness, but some individuals aremore fit than others. Just as a fitter chromosome ismore fit than others. Just as a fitter chromosome ismore likely to be selected for reproduction, so amore likely to be selected for reproduction, so afitter computer program is more likely to survive byfitter computer program is more likely to survive bycopying itself into the next generation.copying itself into the next generation.
- 23. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 23Crossover in genetic programming:Crossover in genetic programming:Two parental STwo parental S--expressionsexpressionsa*a+a b−(/ (− (sqrt (+ (* a a) (− a b))) a) (* a b))/a b*sqrt−a+b/asqrtb−−(+ (− (sqrt (− (* b b) a)) b) (sqrt (/ a b)))ba*bsqrt
- 24. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 24Crossover in genetic programming:Crossover in genetic programming:Two offspring STwo offspring S--expressionsexpressionsa*a+a b−/sqrt−a+b/asqrt−ba b*b−a*bsqrt(/ (− (sqrt (+ (* a a) (− a b))) a) (sqrt (− (* b b) a))) (+ (−(* a b) b) (sqrt (/ a b)))
- 25. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 25Mutation in genetic programmingMutation in genetic programmingAA mutation operator can randomly change anymutation operator can randomly change anyfunction or any terminal in the LISP Sfunction or any terminal in the LISP S--expression.expression.Under mutation, a function can only be replaced byUnder mutation, a function can only be replaced bya function and a terminal can only be replaced by aa function and a terminal can only be replaced by aterminal.terminal.
- 26. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 26a*a+a b−(/ (− (sqrt (+ (* a a) (− a b))) a) (* a b))/a b*sqrt−a+b/asqrtb−(+ (− (sqrt (− (* b b) a)) b) (sqrt (/ a b)))a*bsqrt−bMutation in genetic programming:Mutation in genetic programming:Original SOriginal S--expressionsexpressions
- 27. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 27Mutation in genetic programming:Mutation in genetic programming:Mutated SMutated S--expressionsexpressions(/ (+ (sqrt (+ (* a a) (− a b))) a) (* a b))/a b*a*a+a b−sqrt+a+b/asqrtb−(+ (− (sqrt (− (* b b) a)) a) (sqrt (/ a b)))a*bsqrt−a
- 28. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 28Step 1Step 1:: Assign the maximum number of generationsAssign the maximum number of generationsto be run and probabilities for cloning, crossoverto be run and probabilities for cloning, crossoverand mutation. Note that the sum of the probabilityand mutation. Note that the sum of the probabilityof cloning, the probability of crossover and theof cloning, the probability of crossover and theprobability of mutation must be equal to one.probability of mutation must be equal to one.StepStep 22:: GGenerateenerate an initial population of computeran initial population of computerprograms of sizeprograms of size NN by combining randomlyby combining randomlyselected functions and terminals.selected functions and terminals.In summary, genetic programming creates computerIn summary, genetic programming creates computerprograms by executing the following steps:programs by executing the following steps:
- 29. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 29Step 3Step 3:: Execute each computer program in theExecute each computer program in thepopulation and calculate its fitness with anpopulation and calculate its fitness with anappropriate fitness function. Designate the bestappropriate fitness function. Designate the best--soso--far individual as the result of the run.far individual as the result of the run.Step 4Step 4:: With the assigned probabilities, select aWith the assigned probabilities, select agenetic operator to perform cloning, crossover orgenetic operator to perform cloning, crossover ormutation.mutation.
- 30. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 30Step 5Step 5:: If the cloning operator is chosen, select oneIf the cloning operator is chosen, select onecomputer program from the current population ofcomputer program from the current population ofprograms and copy it into a new population.programs and copy it into a new population.•• If the crossover operator is chosen, select a pairIf the crossover operator is chosen, select a pairof computer programs from the currentof computer programs from the currentpopulation, create a pair of offspring programspopulation, create a pair of offspring programsand place them into the new population.and place them into the new population.•• If the mutation operator is chosen, select oneIf the mutation operator is chosen, select onecomputer program from the current population,computer program from the current population,perform mutation and place the mutant into theperform mutation and place the mutant into thenew population.new population.
- 31. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 31Step 6Step 6:: RepeatRepeat Step 4Step 4 until the size of the newuntil the size of the newpopulation of computer programs becomes equalpopulation of computer programs becomes equalto the size of the initial population,to the size of the initial population, NN..Step 7Step 7:: Replace the current (parent) populationReplace the current (parent) populationwith the new (offspring) population.with the new (offspring) population.Step 8Step 8:: Go toGo to Step 3Step 3 and repeat the process untiland repeat the process untilthe termination criterion is satisfied.the termination criterion is satisfied.
- 32. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 32Fitness history of the best SFitness history of the best S--expressionexpressionFitness,%0 1 2 3 4020406080100a*a b b*sqrt+G e n e r a t i o n s B e s t o f g e n e r a t i o n
- 33. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 33What are the main advantages of geneticWhat are the main advantages of geneticprogramming compared to genetic algorithms?programming compared to genetic algorithms?II Genetic programming applies the sameGenetic programming applies the sameevolutionaryevolutionary approach. However, geneticapproach. However, geneticprogramming is no longer breeding bit strings thatprogramming is no longer breeding bit strings thatrepresent coded solutions but complete computerrepresent coded solutions but complete computerprograms that solve a particular problem.programs that solve a particular problem.II TheThe fundamental difficulty offundamental difficulty of GAsGAs lies in thelies in theproblem representation, that is, in the fixedproblem representation, that is, in the fixed--lengthlengthcoding. A poor representation limits the power ofcoding. A poor representation limits the power ofa GA, and even worse, may lead to a falsea GA, and even worse, may lead to a falsesolution.solution.
- 34. Negnevitsky, Pearson Education, 2011Negnevitsky, Pearson Education, 2011 34II A fixedA fixed--length coding is rather artificial. As itlength coding is rather artificial. As itcannot provide a dynamic variability in length,cannot provide a dynamic variability in length,such a coding often causes considerablesuch a coding often causes considerableredundancy and reduces the efficiency of geneticredundancy and reduces the efficiency of geneticsearch. In contrast, genetic programming usessearch. In contrast, genetic programming useshighhigh--level building blocks of variable length.level building blocks of variable length.Their size and complexity can change duringTheir size and complexity can change duringbreeding.breeding.II Genetic programming works well in a largeGenetic programming works well in a largenumber of different cases and has many potentialnumber of different cases and has many potentialapplicationsapplications..

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment