genetic programming
play

Genetic Programming What is it? Genetic Programming Genetic - PDF document

Genetic Programming What is it? Genetic Programming Genetic programming (GP) is an automated method for creating a working computer program from a high-level problem statement of a problem. Genetic programming starts from a high-


  1. Genetic Programming  What is it? Genetic Programming  Genetic programming (GP) is an automated method for creating a working computer program from a high-level problem statement of a problem.  Genetic programming starts from a high- level statement of “what needs to be done” and automatically creates a computer program to solve the problem. 1 2 Genetic Programming Genetic Programming  John Koza, 1992  “Genetic Programming: On the Programming of Computers by Means of Natural Selection“  www.genetic-programming.com 3 4 Genetic Programming Genetic Programming  In genetic programming:  In Koza’s original work  Problem -- involves not finding a solution,  LISP was used as the programming but instead creating a program that can language find the best solution.  Parse trees were used as the genotype.  Phenotype (solution) is a computer program  Straight-forward genetic mapping  Search space is the set of all possible  Functional program --> parse tree. computer programs. 5 6 1

  2. LISP and parse trees Genetic Programming  GPs fit well within the EA framework (defun o() sqrt (setf A 1.52) (sqtr (* A (* A A ))))  Important distinction: *  Genotype = tree *  Phenotype = LISP program A A A Mitchell 7 8 GPs as EAs Defining your problem  For programs to be be evolved, must define:  To use evolutionary algorithms you must:  Define your problem -- must provide hints to functional  Terminal Set building blocks  Leaves of the parse tree  Define your genotype  Correspond to program inputs  Identify your phenotype  Function Set  Define the genotype -> phenotype translation  Interior nodes of parse tree  Define crossover and mutation operators  Set of functions allowable in program  Define fitness  Should be chosen with relation to problem to be solved.  Determine selection criteria  Can have side effects.  Set population parameters 9 10 Defining your problem GPs as EAs  Sufficiency and Closure  To use evolutionary algorithms you must:  Sufficiency  Define your problem -- must provide hints to functional building blocks  terminals + functions must be able to solve the  Define your genotype -- parse trees problem at hand  Identify your phenotype -- LISP program  Choose your terminal and function set wisely  Define the genotype -> phenotype translation  Closure  Define crossover and mutation operators  Functions should be able to accept as  Define fitness argument any value returned by other  Determine selection criteria functions  Set population parameters  Universal return type. 11 12 2

  3. GPs: Crossover and Mutation GPs: Crossover and Mutation  Crossover crossover mutation  Choose random sub-tree from each parent  Swap them in resultant children  Mutation Before crossover Before mutation  Replace randomly chosen sub-tree with randomly After crossover After mutation generated tree.  Can result in increasing / decreasing the size of the genome.  Note that operation maintain valid individuals. 13 14 GPs and crossover GPs as EAs  To use evolutionary algorithms you must:  Define your problem -- must provide hints to functional building blocks  Define your genotype -- parse trees  Identify your phenotype -- LISP program  Define the genotype -> phenotype translation  Define crossover and mutation operators  Define fitness  Determine selection criteria  Set population parameters 15 16 Fitness GPs as EAs  Evaluate the effectiveness of the  To use evolutionary algorithms you must: program to solve the problem  Define your problem -- must provide hints to functional building blocks  Define your genotype -- parse trees  Identify your phenotype -- LISP program  Two stage fitness:  Define the genotype -> phenotype translation  Run resultant program  Define crossover and mutation operators  Define fitness  Compare to correct / desired results  Determine selection criteria  Set population parameters 17 18 3

  4. GPs as EAs GPs as EAs  In Koza’s original work:  To use evolutionary algorithms you must:  Define your problem -- must provide hints to functional  10% of individuals will move to next building blocks generation  Define your genotype -- parse trees  Probability based on Fitness  Identify your phenotype -- LISP program  Define the genotype -> phenotype translation  90% formed by crossover  Define crossover and mutation operators  Parent chosen probabilistically based on fitness  Define fitness  Koza does not use mutation.  Determine selection criteria  Set population parameters 19 20 Initializing population Trivial example  Randomly creating programs.  From Mitchell  Must assure that trees match valid  Program to compute P, the orbital period programs. of a planet.  Number of function arguments must match.  Parameters A = average distance from the sun.  Usually a limit is set on tree depth of generated program.  Known solution:  P 2 = cA 3  c = constant.  Questions so far 21 22 Trivial example Trivial example  Terminal set:  A = average distance from the sun  Function set:  Typical arithmetic operations:  +, -, *, /, sqrt  Closure -- Note that all take float and return float 23 24 4

  5. Trivial example Trivial example  Sample solutions  Fitness: 25 26 More interesting Example Other GP variants  Block stacking problem  Strongly typed GP  Koza 1992 as described by Mitchell  Gets around the closure idea  Given:  Function arguments are typed  Set of blocks that can either be  Individual generation and genetic  On a stack  On a table. operators must respect the types.  Goal:  Find a program that will place the blocks on the stack in the “correct” order. 27 28 Building Block Example Factoids about Genetic Programming  More elaborate scheme to solve this:  From Koza’s Web site  There are now 36 instances where genetic  Using Strongly Typed GPs programming has produced a human-competitive  Found in [Kochenderfer] result.  15 instances where GP has created an entity that either infringes or duplicates the functionality of a previous patent  6 instances where genetic programming has done the same with respect to a 21st-centry invention  Questions?  2 instances where genetic programming has created a patentable new invention. 29 30 5

  6. Genetic Programming Factoids about Genetic Programming  GPs themselves were patented by Koza:  In Koza’s original work  LISP was used as the programming language  Koza, John R. Non-Linear Genetic Algorithms for Solving Problems.  Parse trees were used as the genotype.  US Patent 4,935,877. Issued June 19, 1990.  Australian Patent 611,350. Issued September 21, 1991.  Straight-forward genetic mapping  Canadian Patent 1,311,561. Issued December 15, 1992.  Functional program --> parse tree.  German patent 3916328.8-53. Issued June 18, 1997.  Not the only way to do genetic programming. 31 32 Genetic Programming GPs as GAs  In genetic programming:  GADS  Problem -- involves not finding a solution,  [Paterson, Livesey] but instead creating a program that can find the best solution.  Phenotype = program  Phenotype (solution) is a computer program  Genotype = n-tuple (array).  Search space is the set of all possible computer programs.  Genotype need not be a parse tree! 33 34 Languages as grammars Phenotype Representation  Grammars for programming languages  Phenotype is a program in a given language  Language is defined by a grammar in BNF.  <stmt> → … | <for-stmt> | <if-stmt> | …  Each production in the grammar is uniquely  <stmt> → { <stmt> <stmt> } | ε numbered.  <if-stmt> → if ( <expr> ) then <stmt>  <for-stmt> → for ( <expr> ; <expr> ; lhs → rhs <expr> ) <stmt> <sexpr> → (GT <sexpr> <sexpr>) 35 36 6

  7. Phenotype Representation Genotype representation  A valid program can be described by a sequence of applications of grammar rules.  Genotype = tuple or array representing this sequence.  Let’s try:  (GT (* -1 X) (* V (ABS V) ) )  Can use “standard” GA operators for tuples for crossover and mutation. 37 38 Genetic Mapping Genetic Mapping  Genetic Repairs Required:  Genetic Repairs Required:  Inapplicable productions.  Inapplicable productions.  Assume after a number of production  Genetic repair: skip the problematic gene and applications (as defined by a genome) the progress to the first gene that has an generated program is: appropriate lhs. (GT <sexpr> <numeral>) What if the the production of the next gene does NOT have a lhs of <sexpr> or <numeral>? 39 40 Genetic Mapping Genetic Mapping  Genetic Repairs Required:  Genetic Repairs Required:  Residual non-terminals  Residual non-terminals  What if…after all productions associated to all  Reject this individual or genes have been applied and there are still  Have each non-terminal have a default terminal non-terminals in the program? value and use this default. 41 42 7

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend