John R. Koza [Edited by J. Wiebe] 1. GENETIC PROGRAMMING 2.

Slides:



Advertisements
Similar presentations
Biologically Inspired AI (mostly GAs). Some Examples of Biologically Inspired Computation Neural networks Evolutionary computation (e.g., genetic algorithms)
Advertisements

Genetic Programming 김용덕 Page 2 Contents What is Genetic Programming? Difference between GP and GA Flowchart for GP Structures in GP.
TEMPLATE DESIGN © Genetic Algorithm and Poker Rule Induction Wendy Wenjie Xu Supervised by Professor David Aldous, UC.
1 Lecture 8: Genetic Algorithms Contents : Miming nature The steps of the algorithm –Coosing parents –Reproduction –Mutation Deeper in GA –Stochastic Universal.
A new crossover technique in Genetic Programming Janet Clegg Intelligent Systems Group Electronics Department.
Doug Downey, adapted from Bryan Pardo, Machine Learning EECS 349 Machine Learning Genetic Programming.
Early work in intelligent systems Alan Turing (1912 – 1954) Arthur Samuel ( )
Intro to AI Genetic Algorithm Ruth Bergman Fall 2002.
1 Genetic Programming Primer ami hauptman. 2 Outline  Intro  GP definition  Human Competitive Results  Representation  Advantages  GP operators.
Intro to AI Genetic Algorithm Ruth Bergman Fall 2004.
Genetic Programming. Agenda What is Genetic Programming? Background/History. Why Genetic Programming? How Genetic Principles are Applied. Examples of.
Genetic Programming Dinesh Dharme Prateek Srivastav Pankhil Chheda
Genetic Programming.
Slides are based on Negnevitsky, Pearson Education, Lecture 10 Evolutionary Computation: Evolution strategies and genetic programming n Evolution.
Genetic Programming Chapter 6. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Programming GP quick overview Developed: USA.
Initial Value Problem: Find y=f(x) if y’ = f(x,y) at y(a)=b (1) Closed-form solution: explicit formula -y’ = y at y(0)=1 (Separable) Ans: y = e^x (2)
Medical Diagnosis via Genetic Programming Project #2 Artificial Intelligence: Biointelligence Computational Neuroscience Connectionist Modeling of Cognitive.
Neural and Evolutionary Computing - Lecture 7 1 Evolutionary Programming The origins: L. Fogel (1960) – development of methods which generate automatically.
Problems Premature Convergence Lack of genetic diversity Selection noise or variance Destructive effects of genetic operators Cloning Introns and Bloat.
GENETIC ALGORITHMS AND GENETIC PROGRAMMING Ehsan Khoddam Mohammadi.
Slides are based on Negnevitsky, Pearson Education, Lecture 12 Hybrid intelligent systems: Evolutionary neural networks and fuzzy evolutionary systems.
SOFT COMPUTING (Optimization Techniques using GA) Dr. N.Uma Maheswari Professor/CSE PSNA CET.
© Negnevitsky, Pearson Education, Lecture 10 Evolutionary Computation: Evolution strategies and genetic programming Evolution strategies Evolution.
1 Genetic Programming: An Introduction. 2 The Lunacy of Evolving Computer Programs Before we start, consider the general evolutionary algorithm : Randomly.
Automatically Defined Functions Used to evolve modular programs Architecture implemented by Koza Architecture implemented by Bruce Function calls A critical.
What is Genetic Programming? Genetic programming is a model of programming which uses the ideas (and some of the terminology) of biological evolution to.
Genetic algorithms Charles Darwin "A man who dares to waste an hour of life has not discovered the value of life"
Design of an Evolutionary Algorithm M&F, ch. 7 why I like this textbook and what I don’t like about it!
Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.
Biological data mining by Genetic Programming AI Project #2 Biointelligence lab Cho, Dong-Yeon
GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems.
G ENETIC P ROGRAMMING Ranga Rodrigo March 17,
Artificial Intelligence Chapter 4. Machine Evolution.
Initial Population Generation Methods for population generation: Grow Full Ramped Half-and-Half Variety – Genetic Diversity.
Chapter 9 Genetic Algorithms.  Based upon biological evolution  Generate successor hypothesis based upon repeated mutations  Acts as a randomized parallel.
Genetic Programming. GP quick overview Developed: USA in the 1990’s Early names: J. Koza Typically applied to: machine learning tasks (prediction, classification…)
Introduction to Genetic Algorithms. Genetic Algorithms We’ve covered enough material that we can write programs that use genetic algorithms! –More advanced.
Project 2: Classification Using Genetic Programming Kim, MinHyeok Biointelligence laboratory Artificial.
Genetic Programming A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Chapter 6.
GENETIC PROGRAMMING. THE CHALLENGE "How can computers learn to solve problems without being explicitly programmed? In other words, how can computers be.
Automated discovery in math Machine learning techniques (GP, ILP, etc.) have been successfully applied in science Machine learning techniques (GP, ILP,
Introduction Genetic programming falls into the category of evolutionary algorithms. Genetic algorithms vs. genetic programming. Concept developed by John.
Genetic Programming COSC Ch. F. Eick, Introduction to Genetic Programming GP quick overview Developed: USA in the 1990’s Early names: J. Koza Typically.
Genetic Algorithm Dr. Md. Al-amin Bhuiyan Professor, Dept. of CSE Jahangirnagar University.
Blocks World Problem. The CS Terminal Specifies the block at the top of the stack. Example CS evaluates to E Note: Evaluates to nil if the stack is empty.
John R. Koza [Edited by J. Wiebe] 1. GENETIC PROGRAMMING 2.
Symbolic Regression via Genetic Programming AI Project #2 Biointelligence lab Cho, Dong-Yeon
Genetic Programming Using Simulated Natural Selection to Automatically Write Programs.
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal Evolutionary Computation.
Evolutionary Algorithms
Genetic Programming. What is Genetic Programming? GP for Symbolic Regression Other Representations for GP Example of GP for Knowledge Discovery Outline.
Evolving Recursive Algorithms The SRF function Automatically defined recursions (ADRs) The recur operator Dealing with infinite and time-consuming recursions.
March 1, 2016Introduction to Artificial Intelligence Lecture 11: Machine Evolution 1 Let’s look at… Machine Evolution.
 Negnevitsky, Pearson Education, Lecture 12 Hybrid intelligent systems: Evolutionary neural networks and fuzzy evolutionary systems n Introduction.
Genetic Programming.
Evolution strategies and genetic programming
Medical Diagnosis via Genetic Programming
Machine Learning Evolutionary Algorithm (2)
Genetic Programming: An Introduction
GENETIC PROGRAMMING BBB4003.
GENETIC ALGORITHMS AND GENETIC PROGRAMMING
Optimization and Learning via Genetic Programming
Artificial Intelligence Chapter 4. Machine Evolution
Artificial Intelligence Chapter 4. Machine Evolution
Genetic Programming Chapter 6.
Genetic Programming.
Genetic Programming Chapter 6.
Genetic Programming Chapter 6.
GENETIC PROGRAMMING BBB4003.
Coevolutionary Automated Software Correction
Presentation transcript:

John R. Koza [Edited by J. Wiebe] 1

GENETIC PROGRAMMING 2

Notes [added by J. Wiebe] A Field Guide to Genetic Programming, 2008, Poli, Langdon, McPhee, Koza (easy to find via Google) Author of these slides, John Koza, is a pioneer in the field 3

THE CHALLENGE "How can computers learn to solve problems without being explicitly programmed? In other words, how can computers be made to do what is needed to be done, without being told exactly how to do it?"  Attributed to Arthur Samuel (1959) 4

CRITERION FOR SUCCESS "The aim [is]... to get machines to exhibit behavior, which if done by humans, would be assumed to involve the use of intelligence.“  Arthur Samuel (1983) 5

REPRESENTATIONS Decision trees If-then production rules Horn clauses Neural nets Bayesian networks Frames Propositional logic Binary decision diagrams Formal grammars Coefficients for polynomials Reinforcement learning tables Conceptual clusters Classifier systems 6

GENETIC PROGRAMMING (GP) GP applies the approach of the genetic algorithm to the space of possible computer programs Computer programs are the lingua franca for expressing the solutions to a wide variety of problems A wide variety of seemingly different problems from many different fields can be reformulated as a search for a computer program to solve the problem. 7

GP FLOWCHART 8

A COMPUTER PROGRAM IN C int foo (int time) { int temp1, temp2; if (time > 10) temp1 = 3; else temp1 = 4; temp2 = temp ; return (temp2); } 9

PROGRAM TREE (+ 1 2 (IF (> TIME 10) 3 4)) 10

CREATING RANDOM PROGRAMS 11

CREATING RANDOM PROGRAMS Available functions F = { +, -, *, %, IFLTE } Available terminals T = { X, Y, Random-Constants } The random programs are: –Of different sizes and shapes –Syntactically valid –Executable 12

GP GENETIC OPERATIONS Reproduction Mutation Crossover Architecture-altering operations 13

MUTATION OPERATION Select 1 parent probabilistically based on fitness Pick point from 1 to NUMBER-OF-POINTS Delete subtree at the picked point Grow new subtree at the mutation point in same way as generated trees for initial random population (generation 0) The result is a syntactically valid executable program Put the offspring into the next generation of the population [Example: in class] 14

CROSSOVER OPERATION Select 2 parents probabilistically based on fitness Randomly pick a number from 1 to NUMBER-OF- POINTS for 1 st parent Independently randomly pick a number for 2 nd parent The result is a syntactically valid executable program Put the offspring into the next generation of the population Identify the subtrees rooted at the two picked points [Example in class] 15

REPRODUCTION OPERATION Select parent probabilistically based on fitness Copy it (unchanged) into the next generation of the population 16

[Initialization] Maximum initial depth of tree D max is set Full method (each branch has depth = D max ): –nodes at depth d < D max randomly chosen from function set F –nodes at depth d = D max randomly chosen from terminal set T Grow method (each branch has depth  D max ): –nodes at depth d < D max randomly chosen from F  T –nodes at depth d = D max randomly chosen from T Common GP initialisation: ramped half-and-half, where grow & full method each deliver half of initial population –Ramped: use a range of depth limits

[Pseudocode for program generation method is either ‘full’ or ‘grow’] Gen(max_d, method) 1.If max_d = 0 or (method = grow and rand[0,1] < |term_set| / (|term_set|+|func_set|)) then 1.Expr = random(term_set) 2.Else 1.Func = random(func_set) 2.For i = 1 to arity(func): 1.Arg_i = Gen(max_d – 1, method) 3.Expr = (Func, arg_1, arg_2, …) 3.Return Expr 18

Bloat Bloat = “survival of the fattest”, i.e., the tree sizes in the population are increasing over time Ongoing research and debate about the reasons Needs countermeasures, e.g. –Prohibiting variation operators that would deliver “too big” children –Parsimony pressure: penalty for being oversized [This will come up again later]

FIVE MAJOR PREPARATORY STEPS FOR GP Determining the set of terminals Determining the set of functions Determining the fitness measure Determining the parameters for the run Determining the method for designating a result and the criterion for terminating a run 20

[Issues with function sets] Typically, Closure is required 1.Type consistency – any subtree may be used in any argument position for every function Why? Initial tree generation, subtree generation in mutation, and crossover may generate any combination. Require that all functions argument and return types are the same Seems limiting, but can often be gotten around –Subcase: allowed type conversions, such as boolean to int –Subcase: make function general; some uses will ignore things Alternative: crossover and mutation constrained to produce only type compatible programs (Section 6.2 in the Field Guide) 21

[Issues with function sets] Typically, Closure is required –2. Evaluation safety E.g. protected values of numeric functions. Instead of throwing an exception, return a default value. E.g., 4/0 returns 1. E.g. no-ops in planning, such as move-forward when the robot is face forward against the wall 22

[Issues with Function Sets] Type consistency and evaluation safety may go hand in hand Suppose type T covers all the types we want to use. Suppose a function’s arguments should only range over a subset of values covered by T A protected version of the function returns a default value for arguments of types the function is not actually defined over. 23

[Issues with Function Sets] Alternative to protected functions: trap run- time exceptions and strongly reduce the fitness of programs that generate such errors But, this may introduce many “nonsense” individuals in the population, all with similar fitness. The GP system may not be able to “find” the valid individuals 24

Structures other than Programs In design problems, the solution may be an artifact. Bridge, circuit, etc. Functions may build structures, rather than be computer code. (We may return to this later. Before that, we’ll assume solutions are computer code.) 25

[Fitness function] E.g., error between output and the desired output; payoff, in a game-playing setting; compliance of a structure with design criteria The fact that individuals are computer programs brings up a couple issues for evaluating fitness … 26

[Fitness function evaluation] Not simply a function application, F(X) X is a program –X needs to be executed On multiple inputs –So, part of specifying the fitness evaluation is specifying which inputs Computationally expensive: multiple executions of each member of the population –Compilation? Depending on the primitive set (the terminal and function sets), the overhead of building/testing a compiler might not be worth it. So, often, evaluation is via interpreter, even though more expensive 27

[Interpreter for a expr in prefix notation, represented as a list] 1.If expr is a list then 1.Proc = expr(1) 2.Val = proc(eval(expr(2)), eval(expr(3)), …) 2.Else 1.If expr is a variable or constant then 1.Val = expr 2.Else 1.Val = expr() {terminal 0-arity function: execute) 3.Return Val Example in class 28

ILLUSTRATIVE GP RUN

SYMBOLIC REGRESSION Independent variable X Dependent variable Y

PREPARATORY STEPS Objective:Find a computer program with one input (independent variable X ) whose output equals the given data 1Terminal set: T = {X, Random-Constants} 2Function set: F = {+, -, *, %} 3Fitness:The sum of the absolute value of the differences between the candidate program’s output and the given data (computed over numerous values of the independent variable x from –1.0 to +1.0) 4Parameters:Population size M = 4 5Termination:An individual emerges whose sum of absolute errors is less than 0.1

SYMBOLIC REGRESSION POPULATION OF 4 RANDOMLY CREATED INDIVIDUALS FOR GENERATION 0

SYMBOLIC REGRESSION x 2 + x + 1 FITNESS OF THE 4 INDIVIDUALS IN GEN 0 x + 1x x [Note: I recalculated these values – these are the sums of the absolute vals of the differences between predicted values and Y values at the sample points; That’s the calculation you need to know.]

SYMBOLIC REGRESSION x 2 + x + 1 GENERATION 1 Copy of (a) Mutant of (c) picking “2” as mutation point First offspring of crossover of (a) and (b) picking “+” of parent (a) and left-most “x” of parent (b) as crossover points Second offspring of crossover of (a) and (b) picking “+” of parent (a) and left-most “x” of parent (b) as crossover points

CLASSIFICATION

GP TABLEAU – INTERTWINED SPIRALS Objective:Create a program to classify a given point in the x-y plane to the red or blue spiral 1Terminal set: T = {X,Y,Random-Constants} 2Function set: F = {+,-,*,%,IFLTE,SIN,COS} 3Fitness:The number of correctly classified points (0 – 194) 4Parameters:M = 10,000. G = 51 5Termination:An individual program scores 194

WALL-FOLLOWER

FITNESS

BEST OF GENERATION 57

BOX MOVER – BEST OF GEN 0

BOX MOVER GEN 45 – FITNESS CASE 1

TRUCK BACKER UPPER

4-Dimensional control problem –horizontal position, x –vertical position, y –angle between trailer and horizontal,  t –angle between trailer and cab,  d One control variable (steering wheel turn angle) State transition equations map the 4 state variables into 1 output (the control variable) Simulation run over many initial conditions and over hundreds of time steps

COMPUTER PROGRAMS Subroutines provide one way to REUSE code  possibly with different instantiations of the dummy variables (formal parameters) Loops (and iterations) provide a 2 nd way to REUSE code Recursion provide a 3 rd way to REUSE code Memory provides a 4 th way to REUSE the results of executing code

DIFFERENCE IN VOLUMES D = L 0 W 0 H 0 – L 1 W 1 H 1

AUTOMATICALLY DEFINED FUNCTION volume

(progn (defun volume (arg0 arg1 arg2) (values (* arg0 (* arg1 arg2)))) (values (- (volume L0 W0 H0) (volume L1 W1 H1))))

AUTOMATICALLY DEFINED FUNCTIONS ADFs provide a way to REUSE code Code is typically reused with different instantiations of the dummy variables (formal parameters)

ADF IMPLEMENTATION Each overall program in population includes –a main result-producing branch ( RPB ) and –function-defining branch (i.e., automatically defined function, ADF ) In generation 0, create random programs with different ingredients for the RPB and the ADF –Terminal set for ADF typically contains dummy arguments (formal parameters), such as ARG0, ARG1, … –Function set of the RPB contains ADF0 –ADF s are private and associated with a particular individual program in the population

ADF MUTATION Select parent probabilistically on the basis of fitness Pick a mutation point from either RPB or an ADF Delete sub-tree rooted at the picked point Grow a new sub-tree at the picked point composed of the allowable ingredients appropriate for the picked point The offspring is a syntactically valid executable program

ADF CROSSOVER Select parent probabilistically on the basis of fitness Pick a crossover point from either RPB or an ADF of the FIRST patent The choice of crossover point in the SECOND parent is RESTRICTED to the picked RPB or to the picked ADF The sub-trees are swapped The offspring are syntactically valid executable programs