Evolution is a genetic algorithm simulator built in Ruby on Rails. Starting
with a baseline image and a gene pool populated with random creatures, the
creatures will mate, mutate, fight and kill each other off, all the while
evolving to look more and more like the baseline image.
Requirements
- Ruby on Rails 2.0.2
- RMagick
Usage
Evolution does not have a web interface and must be controlled in the
console. Once the environment is set up, load the console and type
s = Simulation.new
s.run_simulation
to run a simulation. The images generated will go into the
public/images/simulationx folder.
If you wish to alter the parameters of the simulation, see the
"Options" section below.
Options
The Simulation object has the
following settings, which can be altered before it is run.
- baseline_image: This is the image which the creatures in the simulation
will try to evolve into. Image must be a GIF, 300x300 pixels wide, and
placed in the baseline_images folder. Do not include the file extension in
the parameter (eg: s.baseline_image = "fish").
- maximum_births: How many births to produce before halting the simulation.
- population_size: The population size to be used in the simulation.
- mutation_rate: The likelihood of a mutation occurring (5 == 5%
probability).
- mutation_strength: The maximum possible strength of a mutation (1 - 100).
- organism_complexity: How many points should be defined for each Creature.
- fitness_threshold: When an organism is born which is below this threshold
(a lower fitness level indicates that the Creature is closer to the baseline
image), the simulation will halt.
- stud_most_fit: If set to true, then the most fit Creature at the time will be
involved in every mating, and the least fit Creature will always be killed. This
will speed up the simulation, but it goes against the principle of natural
selection which the simulation is meant to illustrate.
Credit and Licensing
Evolution was originally written by Joey Schoblaska. It is shared under the
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States
License.