of 31 /31
Genetic Algorithms Genetic Programming Ata Kaban [email protected] School of Computer Science University of Birmingham 2003

Genetic Algorithms Genetic Programming Ata Kaban [email protected] School of Computer Science University of Birmingham 2003

Embed Size (px)

Text of Genetic Algorithms Genetic Programming Ata Kaban [email protected] School of Computer Science...

  • Slide 1

Genetic Algorithms Genetic Programming Ata Kaban [email protected] School of Computer Science University of Birmingham 2003 Slide 2 Genetic algorithms Genetic programming Evolutionary computation Slide 3 Evolutionary Computation Computation procedures patterned after biological evolution Search procedures that probabilistically applies search operators to a set of points in the search space Slide 4 The Evolutionary Cycle Slide 5 When are useful Hard discrete optimisation problems when the search space is very large E.g. choosing the NN topology Very hard continuous optimisation problems Evolutionary simulations Slide 6 Genetic algorithms (inventors) John Holland Adaptation in Natural and Artificial Systems, University of Michigan Press (1975)- Genetic Algorithms Lawrence Fogel, M. Evans, M. Walsh Artificial Intelligence through Simulated Evolution, Wiley, 1966 - Evolutionary programming Ingo Rechenburg, 1965 - Evolutionary Strategies Slide 7 Machine Learning and Genetic Algorithms Most Machine Learning is concerned with constructing a hypothesis from examples that generalises well fast but very biased GA is a discovery-search over hypotheses slow and unbiased Slide 8 The Genetic Algorithm 1. Create a population of encoded potential solutions (chromosomes) 2. Evaluate the fitness of all the chromosomes 3. Select fitter chromosomes to form new candidate population 4. Form new candidate population by recombining genes from candidate population 5. Mutate 6. Until satisfied go to 2 Slide 9 Representing hypotheses as strings (chromosomes) E.g. Outlook {Sunny, Overcast, Rain}, Wind {Strong, Week} PlayTennis {Yes, No} Represent (Overcast V Rain) (Wind=Strong) by 011 10 Represent IF Wind=Strong THEN PlayTennis=yes by 111 10 10 or 111 10 1 Can you figure out the rationale? Slide 10 In the previous example: Fixed length string representations for single rules The outcome should not be constrained (11 or 00 for PlayTennis would not make sense) Designing a suitable string-based representation of hypothesis is not always as simple Much of the success of the GA will depend on doing this is a sensitive way. Slide 11 GA steps in more detail Operators for GA Crossover Mutation Selection Slide 12 Crossover Take the new candidate solutions after selection and recombine genetic material A b c D e f a B c D e f a B c D e F A b c D e F A b c D e f a B c D e F a B c D e F A b c D e f Slide 13 Mutation After the recombination stage, just randomly alter a few genes a B c D e F a B c D e F Slide 14 Selection Fitness: numerical value returned by our criterion of ranking hypotheses Selection procedures: Fitness proportionate selection Tournament selection (size 2): 1. choose two chromosomes h 1 and h 2 at random 2. promote the fitter of the two to the next candidate population 3. until new candidate population full go to 1. Many other possibilities! Can you figure out the rationale? Slide 15 Selection strategy We want to have some way to ensure that better individuals have a better chance of being parents then less good individuals This will give us selection pressure which will drive the population forward. We have to be careful to give less good individuals at least some chance of being parents they may include some useful genetic material What could go wrong with the Fitness proportionate selection procedure? Slide 16 What could go wrong with Fitness proportionate selection? Danger of premature convergence because outstanding individuals take over the entire population very quickly Low selection pressure when fitness values are near each other Slide 17 An example: find the maximal peak of the function (difficult optimisation) Slide 18 Solution Slide 19 Expected behaviour of GA Fitness proportion Fitness Generation generation Slide 20 Genetic Programming Extension of GA for evolving computer programs (Koza 1992) represent programs as LISP expressions e.g. (IF (GT (x) (0)) (x) (-x)) IF GT x -x x 0 Slide 21 Another example of tree-structured program individual Need to define: Terminals: x,y,const Primitive functions: sin, cos, , +,-, () 2 Slide 22 Crossover on Trees A B D E G H C F I J a bc d f g e h i i e h A B D E G H C F I J a bc d f g Slide 23 Mutation Mutation point A B D E G H C F I a bc d f g e h i Slide 24 An early simple example: The Block problem Slide 25 Slide 26 The GA solution (learned program): Trained on 166 test problems Using a population of 300 programs After 10 generations The solution found by GA which solves all 166 cases: (EQ (DU (MT CS) (NOT CS)) (DU (MS NN) (NOT NN))) What it does? Simple but it makes sense! Slide 27 Example: Evolving programs on a mobile robot Goal: obstacle avoidance inputs from eight sensors on robot {s1-s8} with values between {0,1023} (higher values mean closer obstacle) output to two motors (speeds) m1,m2 with values between {0,15}. Slide 28 Fitness function Penalty Reward (going fast) Reward (going straight) Slide 29 Results Slide 30 Electronic Filter Circuit Design Individuals are programs that transform beginning circuit to final circuit by Adding/subtracting components and connections Fitness: computed by simulating the circuit Population of 640,000 has been run on a parallel processor After 137 generations, the discovered circuits exhibited performance competitive with best human designs Slide 31 Summary Evolutionary programming conducts randomised parallel search through the hypothesis space Approaches learning as an optimisation problem (optimise fitness) Evaluation of fitness can be very indirect Nice metaphor with Darwinian theory of biological evolution Little theoretical justification for many of the heuristics