E N D
Lecture10 • EvolutionaryComputation: • Evolutionstrategiesandgeneticprogramming • Evolutionstrategies • Geneticprogramming • Summary Negnevitsky,PearsonEducation,2011
EvolutionStrategies • Another approachto simulating natural evolution was proposedinGermanyintheearly 1960s. Unlikegeneticalgorithms, this approach • calledanevolutionstrategy wasdesigned to solvetechnicaloptimisation problems. Negnevitsky,PearsonEducation,2011
In 1963twostudents ofthe Technical University of Berlin,Ingo Rechenbergand Hans-Paul Schwefel, were working on the search forthe optimalshapes ofbodies in a flow.They decidedtotry random changes in the parameters definingtheshapefollowingthe exampleofnaturalmutation. As a result, the evolution strategy was born. • Evolutionstrategieswere developedas an alternative totheengineer’sintuition. • Unlike GAs, evolutionstrategies useonly a mutation operator. Negnevitsky,PearsonEducation,2011
Step2: Randomly select an initial value for each parameterfromthe respectivefeasible range. The setof these parameterswill constitutethe initial population of parent parameters: x1,x2,..., xN Step3: Calculate the solution associated with the parentparameters: X =f(x1,x2,...,xN) Negnevitsky,PearsonEducation,2011
Step6: Comparethe solution associatedwiththe offspring parameters withtheoneassociated with theparentparameters. If the solution for the offspring is betterthan thatfor theparents,replace the parentpopulationwiththeoffspring population. Otherwise,keepthe parent parameters. Step7: Go to Step 4, and repeat the process until a satisfactorysolutionisreached,oraspecified number of generations is considered. Negnevitsky,PearsonEducation,2011
An evolution strategy reflects thenatureof a chromosome. • A singlegene maysimultaneously affectseveral characteristicsof the livingorganism. • On the otherhand,a single characteristic of an individualmay bedeterminedby thesimultaneous interactionsofseveral genes. • The natural selection acts on a collection of genes, noton a single gene inisolation. Negnevitsky,PearsonEducation,2011
Geneticprogramming • One ofthe centralproblemsincomputer scienceis howtomake computers solve problems without being explicitly programmed to do so. • Genetic programmingoffers asolutionthroughthe evolutionofcomputerprograms bymethodsof naturalselection. • In fact,genetic programmingis an extensionof the conventional geneticalgorithm,but thegoalof geneticprogramming is not just toevolve a bit- string representation ofsomeproblem but the computercodethatsolves theproblem. Negnevitsky,PearsonEducation,2011
Genetic programming is a recent development in theareaofevolutionarycomputation. It was greatlystimulatedin the 1990sbyJohnKoza. • AccordingtoKoza,genetic programmingsearches the space of possiblecomputer programs fora programthatis highly fit forsolvingthe problemat hand. • Any computer program is a sequenceof operations (functions) appliedto values (arguments), but differentprogramming languages mayinclude differenttypes ofstatementsandoperations,and have different syntactic restrictions. Negnevitsky,PearsonEducation,2011
Since genetic programming manipulates programs byapplying genetic operators,a programming languageshould permit a computer program to be manipulated as dataandthenewly created datato beexecutedasaprogram. For these reasons, LISPwaschosenasthemainlanguagefor geneticprogramming. Negnevitsky,PearsonEducation,2011
LISPstructure LISPhasahighlysymbol-orientedstructure. Its basicdatastructuresareatomsandlists. Anatom is the smallest indivisible element ofthe LISP syntax. The number 21,thesymbol Xandthestring “Thisisa string”areexamplesofLISPatoms. A listis anobjectcomposedofatomsand/orother lists. LISPlistsarewritten asan ordered collection of items inside a pair of parentheses. Negnevitsky,PearsonEducation,2011
LISPstructure For example, the list ((*AB)C) callsfortheapplicationofthesubtractionfunction () to two arguments, namely the list (*A B) and the atom C. First, LISP applies the multiplication function (*) to the atomsA and B. Once the list (*A B) is evaluated, LISP applies the subtraction function () to the two arguments, and thusevaluates the entirelist ((*AB)C). Negnevitsky,PearsonEducation,2011
Graphicalrepresentationof LISPS-expressions • Bothatoms andlistsare called symbolic expressionsor S-expressions. In LISP, all data andallprogramsareS-expressions. This gives LISP the ability tooperateon programs as if they weredata. In otherwords,LISPprogramscan modifythemselves orevenwriteotherLISP programs. This remarkablepropertyof LISP makesitvery attractive forgeneticprogramming. • Any LISPS-expressioncanbe depictedas a rooted point-labelledtree with orderedbranches. Negnevitsky,PearsonEducation,2011
Howdoweapplygeneticprogramming toaproblem? Beforeapplying genetic programmingto a problem, we must accomplishfivepreparatorysteps: Determinethesetofterminals. Selectthesetof primitive functions. Definethe fitnessfunction. Decide ontheparameters forcontrollingtherun. Choosethemethodfordesignatingaresultof the run. Negnevitsky,PearsonEducation,2011
Step1: Determinethe setofterminals. The terminals correspond to the inputs of the computerprogramtobediscovered. Our programtakes twoinputs,a andb. Step2: Select the set of primitive functions. The functions can be presented by standard arithmeticoperations,standardprogramming operations,standard mathematical functions, logicalfunctionsordomain-specificfunctions. Our program willuse fourstandard arithmetic operations +,, * and,andone mathematical function sqrt. Negnevitsky,PearsonEducation,2011
Step3: Definethefitnessfunction. A fitness function evaluates howwell aparticularcomputer program can solve the problem. For our problem, thefitnessofthecomputer programcan be measured by the error between the actual result producedby the program andthe correctresult givenbythefitnesscase. Typically,theerror is not measuredover just onefitness case,but instead calculated asasum oftheabsolute errors overanumberoffitnesscases. The closer this sum is tozero,thebetterthe computerprogram. Negnevitsky,PearsonEducation,2011
Step4: Decideontheparametersforcontrolling therun. Forcontrolling a run,genetic programming uses the same primary parameters asthoseusedforGAs.Theyincludethe population sizeandthe maximum number of generationsto be run. Step5: Choose the method for designating a resultoftherun. It is common practice in genetic programming todesignatethebest-so-far generatedprogramas the resultof a run. Negnevitsky,PearsonEducation,2011
Once thesefivesteps are complete,a runcan be made. The run of genetic programming starts with a random generation of an initial population of computerprograms. Each program is composed of functions+,,*, andsqrt,andterminals aandb. In the initialpopulation,all computer programs usually havepoorfitness,butsomeindividuals are more fitthanothers. Just as a fitter chromosome is more likely tobe selectedforreproduction,so a fitter computer program is more likely to survive by copyingitselfinto the next generation. Negnevitsky,PearsonEducation,2011
Mutationingeneticprogramming Amutationoperatorcanrandomly changeany function or any terminal in the LISP S-expression. Undermutation,a functioncanonly bereplacedby a functionand a terminalcanonly be replacedby a terminal. Negnevitsky,PearsonEducation,2011
In summary, genetic programming creates computer programs by executing thefollowingsteps: Step1: Assignthemaximum numberofgenerations to berunandprobabilities forcloning,crossover and mutation. Notethatthe sumof theprobability of cloning,the probability ofcrossoverandthe probability ofmutation mustbe equalto one. Step2: Generate an initial population of computer programs ofsizeN bycombiningrandomly selectedfunctions and terminals. Negnevitsky,PearsonEducation,2011
Step3: Execute each computer program in the population and calculateitsfitness withan appropriatefitnessfunction. Designate the best- so-farindividual astheresultoftherun. Step4: With the assignedprobabilities,selecta genetic operatortoperformcloning,crossoveror mutation. Negnevitsky,PearsonEducation,2011
Step 5: If the cloning operator is chosen, select one computer program from the current population of programs andcopyit intoa newpopulation. • If the crossover operator is chosen,selecta pair ofcomputer programs from the current population,create apairof offspring programs and placethem intothenewpopulation. • Ifthemutationoperatorischosen,selectone computer program from the current population, perform mutation and placethemutant into the newpopulation. Negnevitsky,PearsonEducation,2011
Step6: RepeatStep 4until thesize of thenew population of computer programs becomes equal to the sizeofthe initial population,N. Step7: Replacethe current(parent)population with the new(offspring) population. Step8: Go to Step 3 and repeattheprocess until thetermination criterion is satisfied. Negnevitsky,PearsonEducation,2011
What are the main advantages of genetic programmingcomparedtogeneticalgorithms? • Genetic programming appliesthesame evolutionaryapproach. However,genetic programming is no longer breeding bit strings that representcodedsolutionsbutcompletecomputer programsthat solvea particularproblem. • The fundamental difficulty of GAs lies in the problem representation,thatis,inthefixed-length coding. Apoorrepresentationlimitsthepowerof a GA, andevenworse,may lead to a false solution. Negnevitsky,PearsonEducation,2011
Afixed-lengthcodingisratherartificial. As it cannot provide a dynamic variabilityinlength, such a coding oftencausesconsiderable redundancy and reducestheefficiencyof genetic search. In contrast,genetic programming uses high-levelbuildingblocks ofvariablelength. Their sizeandcomplexitycan changeduring breeding. • Genetic programming workswellin a large numberofdifferentcasesandhasmanypotential applications. Negnevitsky,PearsonEducation,2011