Evolving a fractal forest
This applet simulates the evolution of fractal-like "plants" under a specific selection criterion. Each plant has at its core a genome containing a set of instructions for the plant's growth. These instructions correspond to a set of "branches", each of which has a certain length, and links to other branches at given angles. A population of 50 plants are grown together, one branch at a time, with the steric restriction that no branch may be placed so that it overlaps another branch.
Once the growth phase has taken place, the plants are assigned a fitness value. This is quantitatively the amount of insolation each plant receives (how many of its branches are exposed in the upper-y direction) divided by the total mass of the plant. Hence, tall, thin plants are fit, whereas short, fat plants are likely to be overshadowed and waste fitness on outward growth.
The inputs to the GA are (left to right) a random number seed, the number of generations to simulate, the mutation rate, the elitism, whether to start from identical (1) or random (0) genomes, the initial size penalty for growth (low values favour tiny, flat plants), whether to employ crossover recombination (1) or none (0), and the (petty at best) "Rob" field, determining whether the plants are green or not.
To simply seed a forest, with no evolutionary simulation, enter a seed value and 1 for the number of generations run (and probably 0 for the identical/random flag). If the number of generations chosen is longer (up to 100), fitness values of each plant in the final generation, and a plot of maximum and mean height of plants through the generations will be produced, in addition to a hash representation of the population.
100 generations takes about 20 seconds on a 1.6GHz processor running Fedora.
The fields in order are:
Seed | Generations (1 for simple growth) | Mutation Rate | Elitism | Identical Start? (0/1) | Initial Penalty | Recombination? (0/1) | Rob? (0/1)