Genetic Algorithm Development

Evolving the robots using natural selection. 

Home 

Genetic Algorithm Development

Application of Gene to Behavior

Robot Simulation

Download Files

Team Members

Links

Contact

 

Subproject Leader: Andrew Bouchard

After a little reasearch, it became clear that there are many different methods of developing an artificial intelligence in robots, so in the pursuit of creating robots that learned to fight, we would need to choose one of these learning algorithms to adapt to our needs. Because of its simplicity in interpretation and use, we chose to use a genetic algorithm to develop a deterministic matrix of robot behaviors.

The key part of the genetic algorithm that we developed was this deterministic matrix, which was very basically a three-dimensional  set of probabilities. The first dimension was chosen based on the current state of the same robot (i.e. the robot whose gene it is), the second was selected by determining the behavior of the other robot, and the third was a list of probabilities for any reaction given the other two inputs.

The genetic algorithm was implemented with three Python files:

  • big_daddy.py 
  • Creation.py
  • matingv2.py

big_daddy.py

This is the program that controls everything else, getting user input for the number of generations to run for, the number of robots to keep in the "gene pool," and implementing natural selection by fighting robots in a double-elimination tournament each generation and keeping only the better half of the robots.

Creation.py

This is the program that creates the original pool of robots by randomly seeding the probability matrix. It is significant to note that, given the amount of data that has to be kept track of, we decided to store the "gene" for each robot in a 'Pickled' file using a robust file system and naming convention to keep track of all robots from each generation.

matingv2.py 

Once the pool of robots is cut in half by the tournament,  these robots are randomly 'mated' by averaging the values in each entry of the deterministic matrix. There is also a function that creates mutations at some constant rate set by a control variable.