Home
Project Description
Our project Natural Evolution is a simulation which achieves natural selection using genetic algorithms and neural networks. It shows the evolution of a population as it gets better at seeking food through mutation and selection. The simulation is run in Pygame, and the organisms make decisions using neural networks. As the generations progress further, the organisms begin to exhibit interesting behavior.
User Instructions
The simulation has the following dependencies:
To install our simulation game, run the following command in terminal:
$ git clone https://github.com/DuncanDHall/NaturalEvolution.git
$ python main.py
At this point, a PyGame window should appear displaying 15 white "blobs" and several orange "foods", which begin interacting.
Use the following keyboard controls:
- space = quit program
- D = print NN weights to console
- K = kill all (new generation created)
- S = toggle simulation drawing
- . = speed up simulation
- , = slow down simulation
- H = toggle help
Users can adjust parameters located in the constants.py file as well, provided the format is unchanged
Results
In this first video, the blobs are shown at a late stage of evolution. They are already fairly efficient at spotting and reaching food. Until a blob spots a food within its line of sight, it tends to spin with a small radius. This is logically the most efficient way to “cover ground.” When a blob spots food, it moves directly to it at an even rate.
The second video is similar to the first one, except we display blobs’ lines of sight. This should make their food seeking behavior more apparent. Also note that as blobs start to run out of energy, they decrease their speed in order to save energy.
It’s extraordinary that merely three inputs are able to produce such complex behavior using neural networks. This is explained in our implementation page.
Project Evolution
We began this project by trying to implement a genetic algorithm that selects for the best blobs artificially. We came up with different scoring and mutation mechanisms to achieve the behavior of a genetic algorithm. We took the two most fit blobs of each generation and averaged their features while randomizing it to a certain percentage. The final milestone in our project was implementing natural selection over artificial selection. We began to implement behaviors that allowed the blobs to determine when to reproduce, without waiting for a new generation to begin. We are still working on creating a structure that could facilitate a fully independent population.