Genetic Programming

Yen-Nan Lin

Goal of this project is to generate wall following robots by using genetic programming.

In generation 0, there are 5000 robots with random primitive functions (genes). In each robot, there is a function tree (chromosome) to control its behavior. Robots would be randomly assigned positions in wall following test. Robots can choose to walk or to stay based on their function or obstacle. Their chromosome also determines directions of walking. The summation of fitness over steps is robot’s fitness score. There are 3 kinds of mechanisms to create next generation robots.

Gene of Robots

gene of robots
  1. Direct copy: directly copy robots (winners from tournament selection by fitness score) to next generation
  2. Crossover: chromosome of new robot is from parent robots by randomly exchanging their chromosome
  3. Mutation: mutation would randomly replace sub-tree of parent robots’ chromosome with random primitive functions

Direct copy

direct copy

Crossover

cross over

Mutation

mutation

The next generation robots would do the same wall following test, make their kids over and over again. I implement the program by Ruby programming language. In the project, I also change parameters (ratio of direct copy, mutation rate, number of robots in each generation, number of robot in a tournament selection), investigate the fitness score from robots over generations and propose some reason about why this parameter would induce this kind of result.