1 / 29

Experiments With Explicit For-Loops in Genetic Programming

Experiments With Explicit For-Loops in Genetic Programming. Vic Ciesielski, Xiang Li {vc, xiali}@cs.rmit.edu.au School of Computer Science and Information Technology RMIT University, Australia. Overview. Introduction Why do we experiment loops? Related works

devlin
Télécharger la présentation

Experiments With Explicit For-Loops in Genetic Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Experiments With Explicit For-Loops in Genetic Programming Vic Ciesielski, Xiang Li {vc, xiali}@cs.rmit.edu.au School of Computer Science and Information Technology RMIT University, Australia Experiments with Explicit For-Loops in GP

  2. 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 Experiments with Explicit For-Loops in GP

  3. 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. Experiments with Explicit For-Loops in GP

  4. 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 Experiments with Explicit For-Loops in GP

  5. 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, 1999. • 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, 17-21 1993.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, 1996. • 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, 1-4 1998. IEEE Press. • Santa Fe Ant problem, Partial fitness calculation based on time spend Experiments with Explicit For-Loops in GP

  6. 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. Experiments with Explicit For-Loops in GP

  7. 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). Experiments with Explicit For-Loops in GP

  8. Exp.1 – Santa Fe Ant Problem (2) • Original functions and terminals Experiments with Explicit For-Loops in GP

  9. 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. Experiments with Explicit For-Loops in GP

  10. Exp.1 – Santa Fe Ant Problem (4) • Added Nodes • Genetic variable values Experiments with Explicit For-Loops in GP

  11. 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. Experiments with Explicit For-Loops in GP

  12. 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 Experiments with Explicit For-Loops in GP

  13. 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. Experiments with Explicit For-Loops in GP

  14. 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. Experiments with Explicit For-Loops in GP

  15. 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. Experiments with Explicit For-Loops in GP

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

  17. 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))))) Experiments with Explicit For-Loops in GP

  18. 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 Experiments with Explicit For-Loops in GP

  19. 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 NeuralNetworks, volume 2, pages 881–888, San Francisco, USA, 28 -1 1993.IEEE Press. [2] Kenneth E. Kinnear, Jr. Generality and difficulty in genetic programming:Evolving a sort. In Stephanie Forrest, editor, Proceedings ofthe 5th International Conference on Genetic Algorithms, ICGA-93,pages 287–294, University of Illinois at Urbana-Champaign, 17-21 1993.Morgan Kaufmann. [3] John R. Koza. Genetic Programming II: Automatic Discovery ofReusable Programs. MIT Press, 1994. • Our focus: • Is on evolution of loops of different complexities and on the comparison of loop and non-loop solutions. Experiments with Explicit For-Loops in GP

  20. Exp. 2 – Sorting Problem (2) • Functions and terminals Experiments with Explicit For-Loops in GP

  21. Exp. 2 – Sorting Problem (3) • Genetic variable values • Algorithm for fitness calculation Experiments with Explicit For-Loops in GP

  22. 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. Experiments with Explicit For-Loops in GP

  23. Exp. 2 – Sorting Problem (5) Cumulative probability of success. Loops perform better than no-loops. Unrestricted ones perform best. Experiments with Explicit For-Loops in GP

  24. 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 Experiments with Explicit For-Loops in GP

  25. Exp. 2 – Sorting Problem (7) • Table of comparisons and swaps • 7 element arrays, 5040 test cases Experiments with Explicit For-Loops in GP

  26. Exp. 2 – Sorting Problem (8) • An example of solution in simple loops approach Experiments with Explicit For-Loops in GP

  27. 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. Experiments with Explicit For-Loops in GP

  28. Questions Experiments with Explicit For-Loops in GP

  29. 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))))) Experiments with Explicit For-Loops in GP

More Related