The MonkeyRobotics Genetic Algorithm Research Lab
Platform
JDK
Components
Java
Release
Mr GA Lab is an evolving (pun intended) set of Java classes and "test rigging" for my own ongoing work with Genetic Algorithms and Evolutionary Computing. It will probably produce an Android gadget of some sort.
It's limited now, but as it grows I'll update this article to cover new advancements.
You can test it out a Java applet version right here. It's usually a few revs behind:
/site/unhacker/maker/code/mrgalab/mrga-lab-applet
Background
If you're new to Genetic Algorithms ("GA"), get tooled-up first. It won't take long, because GAs (like real-world biological systems) are, individually, incredibly simple: Their apparent complexity arises from the subtle interactions of random mutation and natural selection, aka Evolution.
A few primers, from Wikipedia:
Objectives
Wherein describe the goals of this project. Um, eventually.
Architecture
Internally, the objects are structured as follows:
GA Organism
Nodes (3 to X)
Genome (2 * 8 bits * 3 "blocks")
Any number of these objects may be active in the sim, which maintains their structures and increases (or decreases) their health as a result of their actions.
The other object in the sim is food (green circles), which "spoil" after a time, reappearing elsewhere. As a result, the GAs are forced to roam the area in search of food.
Nodes
Each GA contains between 3 and (configurable) X nodes. In MrGA, nodes are a simplification combining "neurons" with sensor and muscle nerves.
Combined, the influences generated by a GAs nodes define its behavior: All motion and responses to stimuli are determined by the genome of each node.
Genomes
Inside each node are two genomes of 8 bits each. I actually think of them as "programs", which is basically what DNA is, in the real world.
They might look kinda' like this:
Sensor Genome 01101100
Motor Genome 10100110
The value of the bit at each position determines a response or motor behavior, for example:
Sensor Program
Position Triggers...
0 Motor response each cycle
1 Motor response every other cycle
2 Motor response when on empty pixel
3 Motor response when on non-empty pixel
(...)
Motor Program
Position If triggered, affects GA...
0 Move in direction of node
1 Move 'away from' node
2 Increases motion speed
3 Decreases motion speed
(...)
Yes, conflicting instructions exist: Combined with with many possible triggers, that allows GAs to develop complex slowing/speeding responses. Often, they use it to "hit the breaks" when they wander onto food - which works perfectly.
(To do: Explain how GA morphology via node shape defines motion)
Concurrent Simulation
These GAs are not in direct competition: Food is never exhausted, and they're not cannibals. So all children in a generation are simulated together in the same world, so we can watch them all at once.
Current State of Development
The code works well and is stable and tight, but there are some features I want badly, but simply haven't added yet, including:
Reproduction: Natural "grow, then multiply" model, rather than current "generation cycles".
Fitness to consider lifetime score (not 'end of run')
Food decreases as it is eaten, an early feature I disabled.
Living food, so it can co-evolve with the animals that eat it.
And obviously a better (or, a) UI, for adjusting the parameters of the sim and inspecting individual GAs.
A Specific Discussion
Wherein we engage a more detailed discussion of a particular element.
Code Excerpt and Discussion
Likely to be several of these.
Something at the bottom, related resources perhaps.