Experimentation Using Genetic Algorithms Made Easy with Pygame, Celery, and Numpy
Benjamin Bengfort
- Audience level:
- Intermediate
- Category:
- Science
Description
Genetic algorithms are efficient optimizers inspired by biological evolution and widely used in academic research. However, GAs can be computationally intensive, particularly for simulation. In this poster we detail how Python tools, particularly Pygame, Celery, and Numpy were used in scientific experimentation that took days to compute the evolution of movement behaviors of a particle swarm.
Abstract
Evolutionary computation is inspired by biological evolution and utilizes metaphors of reproduction, crossover, recombination, mutation, and selection by fitness to perform optimization. Evolutionary techniques are primarily used in academia, but also in industrial design where they are used to optimize the parameters or specifications of physical objects. Of note is a quarter-sized antenna that was designed by evolutionary algorithms (EAs) and whose design was far better than similar human designs (that antenna is now used in a variety of satellites).
The idea that genetic and evolutionary algorithms can be used for computational creativity and design is an interesting one. More specifically, we considered whether or not we could use EAs to design a particle swarm system that outperformed a human designed one. The result was a research project that lasted several months and resulted in a publication -- yes, EAs can in fact outperform human design for these types of applications!
However, actually conducting the experimentation required a lot of computation - the result was achieved after evolution of 80 generations that took over 70 hours to complete! The use of Python tools to aid in our scientific investigation was critical, or we would have never had a result. We used Celery to multiprocess the evolution so that 16 simulations were running simultaneously on an m1.2xlarge Amazon EC2 instance. We utilized Numpy and Scikit-Learn to perform vector and matrix computations as efficiently as possible, and finally we used Pygame to visualize the simulation and study the results in real time.
In this poster, we hope to show how Python tools were critical to our research. The clever application of Python to research extends beyond SciPy - it requires multiprocessing, simulation, visualization and more!