300 likes | 599 Views
Genetic Programming. 20003106 김용덕. Contents. What is Genetic Programming? Difference between GP and GA Flowchart for GP Structures in GP Creation of Initial Population Main Generational Loop The fitness evaluation Selection The genetic operations. Example.
E N D
Genetic Programming 20003106 김용덕
Contents • What is Genetic Programming? • Difference between GP and GA • Flowchart for GP • Structures in GP • Creation of Initial Population • Main Generational Loop • The fitness evaluation • Selection • The genetic operations. • Example
What is Genetic Programming? • One of the central challenges of CS is to get a computer to do what needs to be done, without telling it how to do it. • Automatic programming (program synthesis or program induction) • Koza suggests that the desired program evolves itself. • GP is a branch of genetic algorithms.
Difference between GP and GA • Representation of the solution • GA : • a string of numbers • GP : • computer program (originally lisp or scheme) • Represent hierarchical computer programs of dynamically varying sizes and shapes.
Gen=0 Create Initial Random Population Designated Result Yes Termination Criterion Satisfied? No Evaluate Fitness of Each Individual in Population End Individuals=0 Yes Gen=Gen+1 Individuals=M ? No Flowchart for GP (1)
reproduction mutation Select Genetic Operation Probabalistically crossover Select One Individual Based on Fitness Select Two Individual Based on Fitness Select One Individual Based on Fitness Perform Reproduction Perform Crossover Perform Mutation Insert Mutant into New Population Copy into New Population Insert Two Offspring into New Population Individuals=individuals + 2 Individuals=individuals + 1 Individuals=individuals + 1 Flowchart for GP (2)
* 2 * r2 ( * 2 ( * r r ) ) 2 * r r Structures in GP • Structures in GP consist of • Functions • sin, cos, add, sub, AND, if-then-else, turn... • Terminals • X, Y, 0.456, true, false, p, sensor0... • The programs in LISP are s-expressions • Any s-expression can be drawn as a tree of functions and terminals.
Creation of Initial Population (1) • It starts with a primordial ooze of thousands of randomly-generated computer programs. • The randomly created programs typically have different sizes and shapes. • The depth of a tree must be defined. • Full method • The tree is equal to a equal length • Grow method • It is created variable length paths. • Rpm-Half and Half method • Mixing full and grow method
Main Generational Loop • The main generational loop of a run consists of • The fitness evaluation • The Darwinian selection • The genetic operations.
The fitness evaluation • Ex) • The number of blocks pushed against a wall • The amount of food eaten • The error between the output and the target output
Selection • We shall consider different forms of selection: • Fitness-Proportionate Selection • Rank Selection • Tournament Selection • Greedy Over-Selection
Fitness Proportionate Selection • Individuals are selected with a probability according to their fitness. • This is like the roulette-wheel fitness from GA’s.
Rank Selection • Individuals are ordered according to their fitness and then selected according to their rank, not their numerical fitness. • The amount of selection pressure towards very high individuals is limited. It also exaggerates the difference between closely clustered fitness values so better ones are sampled more
Tournament Selection • Create a tournament by selecting n individuals randomly (with random uniform distribution) from the population. • Then choose a winner from this tournament. • “when two bulls fight over the right to mate with a given cow, tournament selection is occurring” • n is usually two, but sometimes higher!
Greedy Over-Selection • We perform greedy over-selection by giving fitter individuals and even better chance of being selected. • Greedy over-selection is used when population is large (>= 1000). • The individuals are sorted according to fitness, with the top 32% in group 1, and the rest in group 2. • Then, 80% of the time, we select from group 1, and 20% of the time, we select from group 2 (using either fitness-proportionate, rank or tournament selection) • For higher population sizes: 2000, 4000, 8000, use 16%, 8% and 4% respectively to pick the class 1 elements.
The genetic operations. • Mutation Operation • Crossover (Sexual Recombination) Operation • Reproduction Operation • Architecture-Altering Operations
Reproduction Operation • The reproduction operation copies a single individual, probabilistically selected based on fitness, into the next generation of the population.
Architecture-Altering Operations • subroutine duplication • argument duplication • subroutine creation • subroutine deletion • argument deletion
Example • http://alphard.ethz.ch/gerber/approx/default.html
Reference • Zbigniew Michalewicz, Genetic Algorithms + Data Structures = Evolution Programs • http://www.genetic-programming.com/gpanimatedtutorial.html • http://www.geneticprogramming.com/Tutorial/tutorial.html