of 59/59
Genetic Algorithms and Genetic Programming

Genetic Algorithms and Genetic Programming

  • View
    70

  • Download
    1

Embed Size (px)

DESCRIPTION

Genetic Algorithms and Genetic Programming. Evolutionary Computation. Computational procedures patterned after biological evolution Search procedure that probabilistically applies search operators to a set of points in the search space. Biological Evolution. Lamarck and others - PowerPoint PPT Presentation

Text of Genetic Algorithms and Genetic Programming

  • Genetic Algorithms and Genetic Programming

  • Evolutionary ComputationComputational procedures patterned after biological evolutionSearch procedure that probabilistically applies search operators to a set of points in the search space.

  • Biological EvolutionLamarck and othersSpecies transmute over timeDarwin and WallaceConsistent heritable variation among individuals in the populationNatural selection of the fittestMendel and geneticsA mechanism for inheriting traitsgenotype -> phenotype mapping

  • Biological Terminology gene functional entity that codes for a specific feature e.g. eye color set of possible alleles allele value of a gene e.g. blue, green, brown codes for a specific variation of the gene/feature locus position of a gene on the chromosome genome set of all genes that define a species the genome of a specific individual is called genotype the genome of a living organism is composed of several chromosomes population set of competing genomes/individuals

  • Genotype versus Phenotype genotype blue print that contains the information to construct an organism e.g. human DNA genetic operators such as mutation and recombination modify the genotype during reproduction genotype of an individual is immutable (no Lamarckian evolution) phenotype physical make-up of an organism selection operates on phenotypes (Darwins principle : survival of the fittest

  • The Genetic AlgorithmDirected search algorithms based on the mechanics of biological evolutionDeveloped by John Holland, University of Michigan (1970s)To understand the adaptive processes of natural systemsTo design artificial systems software that retains the robustness of natural systems

  • The Genetic Algorithm (cont.)Provide efficient, effective techniques for optimization and machine learning applicationsWidely-used today in business, scientific and engineering circles

  • Components of a GAA problem to solve, and ...Encoding technique (gene, chromosome)Initialization procedure (creation)Evaluation function (environment)Selection of parents (reproduction)Genetic operators (mutation, recombination)Parameter settings (practice and art)

  • Genotype Operators recombination (crossover) combines two parent genotypes into a new offspring generates new variants by mixing existing genetic material stochastic selection among parent genes mutation random alteration of genes maintain genetic diversity in genetic algorithms crossover is the major operator whereas mutation only plays a minor role

  • Representation

  • Simple Genetic Algorithm{initialize population;evaluate population;while TerminationCriteriaNotSatisfied{select parents for reproduction;perform recombination and mutation;evaluate population;}}

  • The GA Cycle of Reproductionreproductionpopulationevaluationmodificationdiscarddeleted membersparentschildrenmodifiedchildrenevaluated children

  • Population

    Chromosomes could be:Bit strings (0101 ... 1100)Real numbers (43.2 -33.1 ... 0.0 89.2) Permutations of element (E11 E3 E7 ... E1 E15)Lists of rules (R1 R2 R3 ... R22 R23)Program elements (genetic programming)... any data structure ...population

  • Reproduction

    reproductionpopulationparentschildrenParents are selected at random with selection chances biased in relation to chromosome evaluations.

  • Chromosome Modificationmodificationchildren

    Modifications are stochastically triggeredOperator types are:MutationCrossover (recombination)modified children

  • The simple GAHas been subject of many (early) studiesstill often used as benchmark for novel GAsShows many shortcomings, e.g.Representation is too restrictiveMutation & crossovers only applicable for bit-string & integer representationsSelection mechanism sensitive for converging populations with close fitness valuesGenerational population model (step 5 in SGA repr. cycle) can be improved with explicit survivor selection

  • Representing HypothesesRepresent:(Outlook = Overcast v Rain) ^ (Wind = Strong)byOutlookWind01110

    Represent:IF Wind = Strong THEN PlayTennis = yesbyOutlookWindPlayTennis0111010

  • SGA operators: 1-point crossoverChoose a random point on the two parentsSplit parents at this crossover pointCreate children by exchanging tailsPc typically in range (0.6, 0.9)

  • SGA operators: mutationAlter each gene independently with a probability pm pm is called the mutation rateTypically between 1/pop_size and 1/ chromosome_length

  • Alternative Crossover OperatorsPerformance with 1 Point Crossover depends on the order that variables occur in the representationmore likely to keep together genes that are near each otherCan never keep together genes from opposite ends of stringThis is known as Positional BiasCan be exploited if we know about the structure of our problem, but this is not usually the case

  • n-point crossoverChoose n random crossover pointsSplit along those pointsGlue parts, alternating between parentsGeneralisation of 1 point (still some positional bias)

  • Uniform crossoverAssign 'heads' to one parent, 'tails' to the otherFlip a coin for each gene of the first childMake an inverse copy of the gene for the second childInheritance is independent of position

  • Order 1 crossoverIdea is to preserve relative order that elements occurInformal procedure:1. Choose an arbitrary part from the first parent2. Copy this part to the first child3. Copy the numbers that are not in the first part, to the first child:starting right from cut point of the copied part, using the order of the second parent and wrapping around at the end4. Analogous for the second child, with parent roles reversed

  • Order 1 crossover exampleCopy randomly selected set from first parent

    Copy rest from second parent in order 1,9,3,8,2

  • Crossover OR mutation?Decade long debate: which one is better / necessary / main-background

    Answer (at least, rather wide agreement):it depends on the problem, butin general, it is good to have bothboth have another rolemutation-only-EA is possible, xover-only-EA would not work

  • Exploration: Discovering promising areas in the search space, i.e. gaining information on the problemExploitation: Optimising within a promising area, i.e. using informationThere is co-operation AND competition between them Crossover is explorative, it makes a big jump to an area somewhere in between two (parent) areas Mutation is exploitative, it creates random small diversions, thereby staying near (in the area of ) the parentCrossover OR mutation? (contd)

  • Only crossover can combine information from two parentsOnly mutation can introduce new information (alleles)Crossover does not change the allele frequencies of the population (thought experiment: 50% 0s on first bit in the population, ?% after performing n crossovers)To hit the optimum you often need a lucky mutationCrossover OR mutation? (contd)

  • Evaluation

    The evaluator decodes a chromosome and assigns it a fitness measureThe evaluator is the only link between a classical GA and the problem it is solvingevaluationevaluatedchildrenmodifiedchildren

  • Selection Schemes stochastic sampling roulette wheel selection spin wheel N times stochastic universal sampling roulette wheel selection single spin, wheel has N equally spaced markers tournament selection choose k candidates at random with uniform probability pick best one for reproduction expected number of offspring best : k , average k k-1 , worst k 1/N k-1

  • Main idea: better individuals get higher chanceChances proportional to fitnessImplementation: roulette wheel techniqueAssign to each individual a part of the roulette wheel Spin the wheel n times to select n individualsSGA operators: Selection

  • Replacement Schemes generational replacement entire population is replaced each generation non-overlapping population100100100111001SelectionCrossoverMutation101110100001011 steady state replacement a single individual (worst, random) is replaced by one offspring overlapping population 100100100111001SelectionCrossoverMutation10010010011100101110

  • Deletion

    Generational GA: entire populations replaced with each iterationSteady-state GA: a few members replaced each generationpopulationdiscarddiscarded members

  • An Abstract ExampleDistribution of Individuals in Generation 0Distribution of Individuals in Generation N

  • A Simple Example

    The Traveling Salesman Problem:

    Find a tour of a given set of cities so that each city is visited only oncethe total distance traveled is minimized

  • RepresentationRepresentation is an ordered list of citynumbers known as an order-based GA.

    1) London 3) Dunedin 5) Beijing 7) Tokyo2) Venice 4) Singapore 6) Phoenix 8) Victoria

    CityList1 (3 5 7 2 1 6 4 8)CityList2 (2 5 7 6 8 1 3 4)

  • Crossover combines inversion andrecombination: * *Parent1 (3 5 7 2 1 6 4 8)Parent2 (2 5 7 6 8 1 3 4)

    Child (5 8 7 2 1 6 3 4)

    This operator is called the Order1 crossover.Crossover

  • Mutation involves reordering of the list:

    * *Before: (5 8 7 2 1 6 3 4)

    After: (5 8 6 2 1 7 3 4)Mutation

  • TSP Example: 30 Cities

    TSP 30 Dataset

    827

    9138

    8346

    7144

    6460

    6858

    8369

    8776

    7478

    7171

    5869

    5462

    5467

    3784

    4194

    299

    764

    2260

    2562

    1854

    450

    1340

    1840

    2442

    2538

    4126

    4521

    4435

    5835

    6232

    &A

    Page &P

  • Solution i (Distance = 941)

    TSP 30 Dataset

    827

    9138

    8346

    7144

    6460

    6858

    8369

    8776

    7478

    7171

    5869

    5462

    5467

    3784

    4194

    299

    764

    2260

    2562

    1854

    450

    1340

    1840

    2442

    2538

    4126

    4521

    4435

    5835

    6232

    &A

    Page &P

  • Solution j(Distance = 800)

    TSP 30 Dataset

    827

    9138

    8346

    7144

    6460

    6858

    8369

    8776

    7478

    7171

    5869

    5462

    5467

    3784

    4194

    299

    764

    2260

    2562

    1854

    450

    1340

    1840

    2442

    2538

    4126

    4521

    4435

    5835

    6232

    &A

    Page &P

  • Solution k(Distance = 652)

    TSP 30 Dataset

    827

    9138

    8346

    7144

    6460

    6858

    8369

    8776

    7478

    7171

    5869

    5462

    5467

    3784

    4194

    299

    764

    2260

    2562

    1854

    450

    1340

    1840

    2442

    2538

    4126

    4521

    4435

    5835

    6232

    &A

    Page &P

  • Best Solution (Distance = 420)

    TSP 30 Dataset

    827

    9138

    8346

    7144

    6460

    6858

    8369

    8776

    7478

    7171

    5869

    5462

    5467

    3784

    4194

    299

    764

    2260

    2562

    1854

    450

    1340

    1840

    2442

    2538

    4126

    4521

    4435

    5835

    6232

    &A

    Page &P

  • Overview of Performance

    TSP 30 Dataset

    827

    9138

    8346

    7144

    6460

    6858

    8369

    8776

    7478

    7171

    5869

    5462

    5467

    3784

    4194

    299

    764

    2260

    2562

    1854

    450

    1340

    1840

    2442

    2538

    4126

    4521

    4435

    5835

    6232

    &A

    Page &P

  • Population ModelsSGA uses a Generational model:each individual survives for exactly one generationthe entire set of parents is replaced by the offspringAt the other end of the scale are Steady-State models: one offspring is generated per generation, one member of population replaced,Generation Gap the proportion of the population replaced1.0 for GGA, 1/pop_size for SSGA

  • GABIL [de Jong et al, 1993]Learn disjunctive set of propositional rules; competitive with C4.5FitnessFitness(h) = (correct(h))2

    RepresentationIF a1=T ^ a2=F THEN c=T; IF a2=T THEN c=Frepresented by:a1 a2 ca1 a2 c10 01 111 10 0

    Genetic operators???want variable length rule setswant only well-formed bit-string hypotheses

  • Crossover with variable-length bit-stringsStart with: a1 a2 ca1 a2 ch110 01 111 10 0h101 11 010 01 0

    choose crossover points for h1, e.g. after bits 1, 8now restrict points in h2 to those that produce bitstrings with well-defined semantics, e.g. 1,3, 1,8, 6,8.if we choose 1,3, the results is: a1 a2 ch3:11 10 0a1 a2 ca1 a2 c a1 a2 ch4:00 01 111 11 010 01 0

  • GABIL extensionsAdd new genetic operators, also applied probabilistically:AddAlternative: generalise constraint on a1 by changing a 0 to 1DropCondition: generalise constraint on ai by changing every 0 to 1.

    And, add new field to bitstring to determine whether to allow these: a1 a2 c a1 a2 cAADC 01 11 010 01 0 1 0so now the learning strategy also evolves.

  • GABIL ResultsPerformance of GABIL comparable to symbolic rule/tree learning methods C4.5, ID5R, AQ14.Average performance on a set of 12 synthetic problems:GABIL without AA and DC operators: 92.1% accuracyGABIL with AA and DC operators 95.2% accuracysymbolic learning methods ranged from 91.2% to 96.6%

  • Extensions to the Simple GA Encoding schemes gray encoding messy genetic algorithms Replacement schemes generational replacement steady state replacement Fitness scaling linear scaling - truncation ranking Selection schemes stochastic sampling tournament selection

  • automatic generation of computer programs by means of natural evolution see Koza 1999 programs are represented by a parse tree (LISP expression) tree nodes correspond to functions : - arithmetic functions {+,-,*,/} - logarithmic functions {sin,exp} leaf nodes correspond to terminals : - input variables {X1, X2, X3} - constants {0.1, 0.2, 0.5 } Genetic Programming+*X3X2X1tree is parsed from left to right: (+ X1 (* X2 X3)) X1+(X2*X3)

  • Genetic Programming : Crossoverparent Aparent B+*X3X2X1-/X1-X2X3X2offspring Aoffspring B

  • Block-Stacking ProblemNUALSIRVE objective: place the blocks in the correct order such that the stack forms the word universal functions: set of actions, logical operators, do-until loop terminals: set of sensors that indicate top block on stack, next suitable block on table etc. each program tree is tested on 166 different initial configurations fitness: #configurations for which the stack was correct after program executionstacktable

  • Block-Stacking ProblemNUALSIRVESensors: CS: current stack, name of the top block of the stack TB: top correct block, name of the topmost block on the stack such that it and all blocks underneath are in correct order NN: next block needed, name of the block needed above TB

  • Block-Stacking ProblemNUALIRVESFunctions: MS(X): move block X to the top of the stack, return value X MT(X): moves the block on top of the stack to the table if X is anywhere in the stack returns X DU(exp1, exp2): execute exp1 until the predicate exp2 becomes true NOT(exp1) : negation of expression exp1 EQ(exp1, exp2) : returns true if exp1 and exp2 are equal

  • Block-Stacking ProblemNUALIRVESNNCSTB (EQ (MS NN) (EQ (MS NN) (MS NN))) move next needed block to the stack three times in a row (succeeds with a stack VERSAL and U N I on the table (DU (MS NN) (NOT NN)) move next needed block to the stack until no more blocks are needed (EQ (DU (MT CS) (NOT CS)) (DU (MS NN) (NOT NN))) empty the stack on the table and then build the stack in the correct order (EQ (DU (MT CS) (EQ (CS TB))) (DU (MS NN) (NOT NN)))

  • Learned ProgramTrained to fit 166 test problemsUsing population of 300 programs, found this after 10 generations:

    (EQ (DU (MT CS)(NOT CS))(DU (MS NN)(NOT NN)))

  • Genetic ProgrammingMore interesting example: design electronic filter circuitsindividual are programs that transform beginning cct to final cct, by adding/subtracting components and connections.Use population of 640,000 run on 64 node parallel processorDiscover circuits competitive with best human desgn

  • GP for classifying imagesTeller & Veloso, 1997Fitness: based on coverage & accuracyRepresentation:Primitives include Add, Sub, Mult, Div, Not, Max, Min, Read, Write, If-Then-Else, Either, Pixel, Least, Most, Ave, Variance, Difference, Mini, LibraryMini refers to a local subroutine that is separately co-evolvedLibrary refers to a global library subroutine (evolved by selecting the most useful minis)Genetic operators:Crossover mutationCreate mating pools and use rank proportionate reproduction.

  • Biological EvolutionLamarck (19th century)believed individual genetic makeup was altered by lifetime experiencebut current evidence contradicts this viewWhat is the impact of individual learning on population evolution?

  • Baldwin EffectAssumeindividual learning has no direct influence on individual DNABut ability to learn reduces need to hard wire traitsin DNAThenAbility of individuals to learn will support more diverse gene poolbecause learning allow individuals with various hard wired traits to be successfulMore diverse gene pool will support faster evolution of gene pool.> individual learning (indirectly) increases rate of evolution.

  • Baldwin EffectPlausible example:New predator appears in the environmentIndividual who can learn (to avoid it) will be selectedIncrease in learning individuals will support more diverse gene poolresulting in faster evolutionpossibly resulting in new non-learned traits such as instinctive fear of predator

  • Computer experiements on Baldwin EffectEvolve simple neural nets [Hinton & Nowlan, 1987]some network weights fixed during lifetime, others trainablegenetic makeup determines which are fixed and their weight valuesResults:With no individual learning, population failed to improve over timewhen individual learning allowedearly generations: population contained many individuals with many trainable weightslater generations: higher fitness, while number of trainable weights decreased.

    *In GAs genome and chromosome are used as synonymsThese terms are used freely in GA terminology although the biological counterpartsare by far more complex and sophisticatedWell, I am sure you dont regard this issue from this perspective while you have sex but that it is to which it pretty much boils down from an evolutionary perspective*