| ||||||||||||||
| ||||||||||||||
|
||||||||||||||
Modelling Bacterium using the JDK
The coursework continued to fascinate me years later, so I decided that as part of my drive to resurrect my work on Generation5, I'd use the Generation5 JDK to try to simulate this behaviour myself. Important Note: I had to update portions of the JDK to implement this, so you will not be able to develop against the current version of the JDK. To use it, you may download the JAR file currently in use on Generation5.
The ModelThe model I devised was a gross simplification of the one BEAST implements - firstly, because I didn't have access to the BEAST code anymore, secondly, I like simple models and finally, I wanted to implement the bacteria as a cellular automata. The model took into account several things:
The WorldOur world is very simple - there are three main components to it. The nutrient, the attractant and the repellent - food levels varying between 0 and 100, attractant/repellent varying between 0 and 255.
NutrientNutrient is added to the world using a 2-dimensional Gaussian distribution so that the bacterium have a gradient to work up (food plentiful in the centre of the world, more scare as you move further out). A 2D Gaussian plot is show to the below.
BacteriumEach bacterium has an energy level and a heading (direction it is moving in). Each bacterium has the following rules and influences applied to it:
ImplementationThe bacteria was implemented using CellularAutomataLayered, with the nutrient modelled at the world level and the attractant/repellent modelled separately within the derived class. Rendering the world was also overridden to provide the screenshots above. A separate array called trail tracks any time a bacterium moves across a portion of the world, with the render function displaying trail using a gradient. This allows you to see how the trails evolve for all bacteria over time.
The main crux of the code is contained within BacteriaCA::doStep. The method is pretty lengthy and highly iterative and, as always with my code, optimized for educational ease-of-understanding, rather than speed! The only thing I did do to make the code more efficient, was move any local or temporary variables out of loops. Nevertheless, all code has been heavily commented, so hopefully you'll be able to understand it. Future DevelopmentI am hoping to expand the code to be evolvable (literally, implement the JDK's Evolvable interface), allowing for experimentation around different fitness functions to evolve certain behaviour. This would involve:
References[1] Gordon, David. beast. Available online at: http://david.gordon.name/ai_a-life.php. [2] Ben-Jacob, Eshel. Bacterial linguistic communication and social intelligence. Available online at http://star.tau.ac.il/~eshel/bacterial_linguistic.html.
Submitted: 19/03/2007 Article content copyright © James Matthews, 2007.
|
|
|||||||||||||
All content copyright © 1998-2007, Generation5 unless otherwise noted.
- Privacy Policy - Legal - Terms of Use -