RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP1 Experiments With Explicit For-Loops in Genetic Programming Vic Ciesielski, Xiang Li {vc,

Slides:



Advertisements
Similar presentations
Models of Computation Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms Week 1, Lecture 2.
Advertisements

MATH 224 – Discrete Mathematics
Garfield AP Computer Science
Biologically Inspired AI (mostly GAs). Some Examples of Biologically Inspired Computation Neural networks Evolutionary computation (e.g., genetic algorithms)
Genetic Programming 김용덕 Page 2 Contents What is Genetic Programming? Difference between GP and GA Flowchart for GP Structures in GP.
ECML Group. RMIT2003 CECPyramid Search Method Genetic Programming Genetic programming (GP) is an automated method for creating a working computer program.
Computer Science 1620 Loops.
A new crossover technique in Genetic Programming Janet Clegg Intelligent Systems Group Electronics Department.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
Loops – While, Do, For Repetition Statements Introduction to Arrays
Evolving Pre-Sort Algorithms Joe Barker. Why Sorting? Sorting is used everywhere Classical methods for developing new algorithms has been pretty much.
Design of Autonomous Navigation Controllers for Unmanned Aerial Vehicles using Multi-objective Genetic Programming Gregory J. Barlow March 19, 2004.
Fuzzy Evolutionary Algorithm for VLSI Placement Sadiq M. SaitHabib YoussefJunaid A. Khan Department of Computer Engineering King Fahd University of Petroleum.
Evolving "elementary sight" strategies in predators via Genetic programming ICBV Project Lior Becker.
Even More Random Number Generators Using Genetic Programming Joe Barker.
Khaled Rasheed Computer Science Dept. University of Georgia
Genetic Algorithms Overview Genetic Algorithms: a gentle introduction –What are GAs –How do they work/ Why? –Critical issues Use in Data Mining –GAs.
Genetic Programming.
LOUKAS GEORGIOU and WILLIAM J. TEAHAN Artificial Intelligence and Intelligent Agents Research Group School of Computer Science, Bangor University, U.K.
Genetic Algorithm.
Karel J Robot An introduction to BlueJ and Object- Oriented Programming.
Scott Marino MSMIS Kean University MSAS5104 Programming with Data Structures and Algorithms Week 10 Scott Marino.
CGP Visits the Santa Fe Trail – Effects of Heuristics on GP Cezary Z. Janikow Christopher J Mann UMSL.
Cristian Urs and Ben Riveira. Introduction The article we chose focuses on improving the performance of Genetic Algorithms by: Use of predictive models.
Improved Gene Expression Programming to Solve the Inverse Problem for Ordinary Differential Equations Kangshun Li Professor, Ph.D Professor, Ph.D College.
© 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.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. C How To Program - 4th edition Deitels Class 05 University.
Study on Genetic Network Programming (GNP) with Learning and Evolution Hirasawa laboratory, Artificial Intelligence section Information architecture field.
Automatically Defined Functions Used to evolve modular programs Architecture implemented by Koza Architecture implemented by Bruce Function calls A critical.
 2005 Pearson Education, Inc. All rights reserved Searching and Sorting.
 Pearson Education, Inc. All rights reserved Searching and Sorting.
What is Genetic Programming? Genetic programming is a model of programming which uses the ideas (and some of the terminology) of biological evolution to.
(Particle Swarm Optimisation)
Genetic Algorithms Siddhartha K. Shakya School of Computing. The Robert Gordon University Aberdeen, UK
Evolutionary Computation Dean F. Hougen w/ contributions from Pedro Diaz-Gomez & Brent Eskridge Robotics, Evolution, Adaptation, and Learning Laboratory.
G ENETIC P ROGRAMMING Ranga Rodrigo March 17,
D OSHISHA U NIVERSITY 13 November XML-based Genetic Programming Framework: Design Philosophy, Implementation and Applications.
Strongly Formed Genetic Programming 06/19/2013. Agenda Strongly formed genetic programming (SFGP) Where it fits Current progress Next steps.
Evolving the goal priorities of autonomous agents Adam Campbell* Advisor: Dr. Annie S. Wu* Collaborator: Dr. Randall Shumaker** School of Electrical Engineering.
Genetic Algorithms Przemyslaw Pawluk CSE 6111 Advanced Algorithm Design and Analysis
Books on Genetic Programming Koza, J. R (1992). Genetic Programming: On the Programming of Computers by Means of Natural Selection. MIT Press. Cambridge,
Chapter 9 Genetic Algorithms.  Based upon biological evolution  Generate successor hypothesis based upon repeated mutations  Acts as a randomized parallel.
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.
Algorithms Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006 by Maria Litvin, Gary Litvin,
Automated discovery in math Machine learning techniques (GP, ILP, etc.) have been successfully applied in science Machine learning techniques (GP, ILP,
 2008 Pearson Education, Inc. All rights reserved. 1 Arrays and Vectors.
RMIT UNIVERSITY ASPGPAnalysis of Genetic Programming Runs1 Vic Ciesielski and Xiang Li {vc, School of Computer Science and Information.
Data Structures and Algorithms Searching Algorithms M. B. Fayek CUFE 2006.
Introduction Genetic programming falls into the category of evolutionary algorithms. Genetic algorithms vs. genetic programming. Concept developed by John.
GECKIES GROUP SEMINAR SERIES State of Iteration and Recursion in Genetic Programming Edwin Rodriguez Genetic and Evolutionary Computation.
Path Planning Based on Ant Colony Algorithm and Distributed Local Navigation for Multi-Robot Systems International Conference on Mechatronics and Automation.
Data Structures Evolution of algorithms for an array-based stack, queue, and linked-list. Evolved data structures used to evolve solutions to problems.
Symbolic Regression via Genetic Programming AI Project #2 Biointelligence lab Cho, Dong-Yeon
Genetic Programming Using Simulated Natural Selection to Automatically Write Programs.
Evolving Recursive Algorithms The SRF function Automatically defined recursions (ADRs) The recur operator Dealing with infinite and time-consuming recursions.
LINKED LISTS.
Presented By: Farid, Alidoust Vahid, Akbari 18 th May IAUT University – Faculty.
Genetic (Evolutionary) Algorithms CEE 6410 David Rosenberg “Natural Selection or the Survival of the Fittest.” -- Charles Darwin.
16 Searching and Sorting.
Creativity of Algorithms & Simple JavaScript Commands
Selected Topics in CI I Genetic Programming Dr. Widodo Budiharto 2014.
Introduction Genetic programming falls into the category of evolutionary algorithms. Genetic algorithms vs. genetic programming. Concept developed by John.
Evolution strategies and genetic programming
Creativity in Algorithms
Genetic Programming: An Introduction
25 Searching and Sorting Many slides modified by Prof. L. Lilien (even many without an explicit message indicating an update). Slides added or modified.
Methods and Materials (cont.)
Genetic Programming.
Presentation transcript:

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP1 Experiments With Explicit For-Loops in Genetic Programming Vic Ciesielski, Xiang Li {vc, School of Computer Science and Information Technology RMIT University, Australia

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP2 Overview Introduction –Why do we experiment loops? Related works –Who have used loops in GP before? Syntax and Semantic of the For-Loops Experiments and Results –Santa Fe Ant Problem –Sorting Problem Conclusion –Use loops to achieve your goals quicker and better

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP3 Introduction Why do we experiment loops? –Powerful – provide a mechanism for repetition. Why loops are seldom used in GP? –Hard to evolve {start, end, body, update branch} –Avoid infinity –Large class of problems can be solved without loops –Implicit loops are used. {Robsoccer, Santa Fe Ant} Type of loops –For-loops and while-loops –The research is focusing on for-loops.

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP4 Loop Syntax & Expectations Two for-loop constructs are used –(FOR-LOOP1 NUM-INTERATIONS BODY) –(FOR-LOOP2 START END BODY) Two strategies for setting values for NUM- ITERATIONS, START and END –Set the value to a random integer (simple loops). –Set the value to a result of any computation (unrestricted loops). Investigation and Expectation –Convergence behavior, size and solutions –Simple loops are easier to evolve than unrestricted loops

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP5 Related Works [1] John R. Koza, Forrest H Bennet III, David Andre, and Martin A. Keane. Genetic Programming III; Darwinian invention and problem solving. Morgan Kaufmann, –ADL – automatically defined loops – pre-established maximum number of execution [2] Kenneth E. Kinnear, Jr. Generality and difficulty in genetic programming: Evolving a sort. In Stephanie Forrest, editor, Proceedings of the 5th International Conference on Genetic Algorithms, ICGA-93,pages 287–294, University of Illinois at Urbana- Champaign, Morgan Kaufmann. –A sorting algorithm – restricted total and individual loops times. – Inverse sized fitness measure [3] William B. Langdon. Data structures and genetic programming. In Peter J. Angeline and K. E. Kinnear, Jr., editors, Advances in Genetic Programming 2, pages 395–414. MIT Press, Cambridge, MA, USA, –A list data structure- for-while – no nested loops and maximum iteration 32 [4] Sidney R. Maxwell III. Experiments with a co-routine model for genetic programming. In Proceedings of the 1998 United Kingdom Automatic Control Council International Conference on Control (UKACC International Conference on Control ’98), University of Wales, volume 455, Swansea, UK, IEEE Press. –Santa Fe Ant problem, Partial fitness calculation based on time spend

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP6 Syntax and Semantics Strong Type GP –We use STGP. It simultaneously allows multiple data types and enforces closure by only generating parse trees which satisfy the type constraints. (FOR-LOOP1 NUM-ITERATIONS BODY) –Simple loops : NUM-ITERATIONS ::INTERGER (Between 1 and MAX-ITERATIONS) –Unrestricted loops: NUM-ITERATIONS could involve arithmetic functions {+, -} and allows nesting (FOR-LOOP2 START END BODY) –If start > end, body is not executed. –Others, same as above.

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP7 Exp.1 – Santa Fe Ant Problem (1) ORIGINAL Direct a robot ant to navigate through a twisting “Santa Fe Trail”, on a 32 x 32 grid. There are 89 pieces of food on the trail. The robot eats the food when it enters into a square. The goal is for the robot to eat all of the food in as few moves as possible. (Maximum number of steps is 600).

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP8 Exp.1 – Santa Fe Ant Problem (2) Original functions and terminals Move::Terminal The robot moves one square forward and it costs one step. TurnLeft::Terminal Turn the robot to the left direction of its current facing and cost one step. TurnRight::Terminal Turn the robot to the right direction of its current facing and cost one step. IfFoodAhead::Function Takes 2 arguments and executes the first argument if there is a food in front, else executes the second. Prog2::Function Takes 2 arguments and executes them sequentially. Prog3::Function Takes 3 arguments and executes them sequentially.

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP9 Exp.1 – Santa Fe Ant Problem (3) MODIFIED Grid size is changed to 20x20 and 108 pieces of food are placed on the grid in 3 blocks of 6x6. The regular placement of food is intended to encourage the evolution of loops. External loops are not allowed. Termination Criteria 2000 generations or all food (108 pieces) is found or 600 steps are reached.

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP10 Exp.1 – Santa Fe Ant Problem (4) Added Nodes RandTimes::Terminal Generates a random integer between 0-6 or 0-20 or For-Loop1::Function Takes 2 arguments. The first argument indicates number of times the second argument is executed. It returns number pieces of food left after the execution of the loop body. Genetic variable values Population Size: 100Mutation Rate:0.28 Max. Tree Depth: 8 Crossover Rate:0.70 Min. Tree Depth:1Elitism Rate:0.02

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP11 Exp.1 – Santa Fe Ant Problem (5) Mean best program fitness of the modified ant problem using different approaches. Max iteration for loops is 100. Results are the average of 100 runs. Loops performs better than no-loops. Unrestricted is better than simple-loops.

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP12 Exp.1 – Santa Fe Ant Problem (6) Cumulative probability of success for the modified ant problem using different approaches. Max iteration for loops is 100. Results are the average of 100 runs. Loops performs better than no-loops. Unrestricted is better than simple-loops. Remember no external loops are allowed

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP13 Exp.1 – Santa Fe Ant Problem (7) Different max-iteration settings and favouring fewer loops. Mean best program fitness using different approaches. Results are the average of 100 runs. Favouring programs with fewer loops has a dramatic effect on fitness for simple loops, but has no effect on the unrestricted loops.

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP14 Exp.1 – Santa Fe Ant Problem (8) Different max-iteration settings and favouring fewer loops. Mean average program size. Results are the average of 100 runs. Quit a difference in program size if fewer loops are favoured. Notice the curves show an initial dramatic drop in program size.

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP15 Exp.1 – Santa Fe Ant Problem (9) All kinds of interesting solutions for runs using loops. A solution with loops with MAX-ITERATIONS = 20. It is a dummy solution, but works.

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP16 Exp.1 – Santa Fe Ant Problem (10) A solution evolved by favouring programs with fewer loops. (ForLoop1 times5 (IfFoodAhead ((Prog2 move turnRight) turnRight) (Prog2 turnLeft (IfFoodAhead (Prog2 move move) move))))))

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP17 Exp.1 – Santa Fe Ant Problem (11) A solution evolved without favouring programs with fewer loops. (ForLoop1 times5 (ForLoop1 times4 (Prog3 (ForLoop1 times4 move) (Prog3 (IfFoodAhead (Prog3 move move move) move) (Prog3 (Prog2 turnRight move) turnRight (IfFoodAhead (ForLoop1 times4 move) (Prog2 turnRight turnLeft))) (IfFoodAhead (Prog3 move move move) move)) (Prog3 (IfFoodAhead (IfFoodAhead (Prog3 turnLeft turnRight move) move) turnLeft) turnLeft (Prog2 move move)))))

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP18 Exp.1 – Santa Fe Ant Problem (12) A solution evolved without using loops. Out of 300 runs, only one solution is found. It contains more than 5000 nodes and takes 4 full A4 pages to print out. Remember no external loops are allowed

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP19 Exp. 2 – Sorting Problem (1) Sorting an array of numbers has natural looping characteristics. Sorting has been studied by [1] Kenneth E. Kinnear, Jr. Evolving a sort: Lessons in genetic programming. In Proceedings of the 1993 International Conference on Neural Networks, volume 2, pages 881–888, San Francisco, USA, IEEE Press. [2] Kenneth E. Kinnear, Jr. Generality and difficulty in genetic programming: Evolving a sort. In Stephanie Forrest, editor, Proceedings of the 5th International Conference on Genetic Algorithms, ICGA-93, pages 287–294, University of Illinois at Urbana-Champaign, Morgan Kaufmann. [3] John R. Koza. Genetic Programming II: Automatic Discovery of Reusable Programs. MIT Press, Our focus: –Is on evolution of loops of different complexities and on the comparison of loop and non-loop solutions.

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP20 Exp. 2 – Sorting Problem (2) Functions and terminals POS::Terminal Random number in range 0..6 IfLessThanSwap::Function Takes two arguments. If arg1 is less than arg2 the positions are swapped and the position of the larger value is returned Prog2::Function Takes 2 arguments and executes them sequentially. ForLoop2::Function Takes 3 arguments, start position, end position and body. +, -, *, / with usual meanings

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP21 Exp. 2 – Sorting Problem (3) Genetic variable values Population Size: 100Mutation Rate:0.28 Max. Tree Depth: 8 Crossover Rate:0.70 Min. Tree Depth:1Elitism Rate:0.02 Algorithm for fitness calculation int calculateFitness(int length, int * array) { int i, result = 0; for( i=1; i <= length; i++) result += abs( array[i-1] - i ); return result; }

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP22 Exp. 2 – Sorting Problem (4) Mean best program fitness, averaged by 50 runs. Loops perform better than no-loops. Be careful to notice the scale in graph. Simple- fewer-loops does not get zero fitness in the beginning.

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP23 Exp. 2 – Sorting Problem (5) Cumulative probability of success. Loops perform better than no-loops. Unrestricted ones perform best.

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP24 Exp. 2 – Sorting Problem (6) Number of comparison made by the best individual, averages of 50 runs. no-loops has the smallest size, while unrestricted loops is in the middle. Reasons:. Quicker getting a solution in loops approach. Loop constructs overheads

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP25 Exp. 2 – Sorting Problem (7) Table of comparisons and swaps –7 element arrays, 5040 test cases MethodsComparisonsSwaps Bubble Sort Shell Sort Insertion Sort Selection Sort Quick Sort No loops Simple loops Unrestricted loops

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP26 Exp. 2 – Sorting Problem (8) An example of solution in simple loops approach (Prog2 (Prog2 (Prog2 (ForLoop2 POS3 POS4 (ILETs i (i+1))) (ForLoop2 POS2 POS6 (ILETs i (i+1)))) (Prog2 (ForLoop2 POS3 POS4 (ILETs i (i+1))) (ForLoop2 POS4 POS5 (ILETs i (i+1))))) (Prog2 (ForLoop2 POS1 POS6 (ILETs i (i+1))) (Prog2 (ForLoop2 POS3 POS2 (ILETs i (i+1))) (ForLoop2 POS1 POS3 (ILETs i (i+1)))) (Prog2 (ForLoop2 POS1 POS3 (ILETs i (i+1))) (ForLoop2 POS0 POS6 (ILETs i (i+1)))))))

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP27 Conclusion By restricting the semantic complexity of for-loops, we have succeeded in evolving small, efficient and reasonable understandable solutions. Using fitness function to favour programs with fewer loops was very beneficial in our experiments. Unrestricted loops performs better, as unrestricted ones in a way are more restricted. Looping constructs are worth considering when the problem domain has some repetitive characteristics. Acknowledgement: This work was partially supported by grant EPPNRM054 from the Victorian Partnership for Advanced Computing.

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP28 Questions

RMIT UNIVERSITY CEC2004Experiments with Explicit For-Loops in GP29 Evolved Program with Loops which Solve the Original Santa Fe Ant Problem Program 1 (Max Depth 6, Favor Fewer Loops) (ForLoop (i+ (i+ times5 (i+ times48 (i+ times48 times14))) (i- times48 times14)) (IfFoodAhead move (Prog3 turnLeft (IfFoodAhead move turnRight) (Prog3 turnRight (IfFoodAhead move turnLeft) move)))) Program 2 (Max Depth 8) (ForLoop (ForLoop times13 (IfFoodAhead move (IfFoodAhead (IfFoodAhead turnRight turnLeft) turnRight))) (IfFoodAhead (Prog2 (Prog3 (Prog3 (IfFoodAhead (IfFoodAhead move turnRight) turnLeft) (Prog3 move move move) (Prog2 turnRight (IfFoodAhead turnLeft turnRight))) (IfFoodAhead move turnRight) (Prog2 (IfFoodAhead move turnRight) move)) (IfFoodAhead turnRight turnRight)) (Prog2 (IfFoodAhead (Prog2 (IfFoodAhead turnLeft turnLeft) (IfFoodAhead (Prog3 turnRight turnLeft turnLeft) turnRight)) (Prog2 (IfFoodAhead move (IfFoodAhead turnRight turnRight)) turnRight)) (Prog2 (Prog2 (IfFoodAhead move (IfFoodAhead turnRight turnRight)) move) (IfFoodAhead (Prog3 turnRight turnLeft (Prog2 turnRight turnRight)) turnRight))))) Program 3 (Max Depth 6) (i+ (ForLoop times50 (Prog3 move (IfFoodAhead (Prog2 move turnLeft) turnLeft) (Prog3 (IfFoodAhead turnLeft turnRight) turnRight (IfFoodAhead move turnLeft)))) (ForLoop times39 (Prog3 move (IfFoodAhead (Prog3 move move turnLeft) turnLeft) (Prog3 (IfFoodAhead move turnRight) turnRight (IfFoodAhead move turnLeft)))))