NetLogo User Community Models
by Thomas Hills (Submitted: 10/09/2003)
Elementary Genetic Algorithm
This uses the basic features of genetic algorithms to solve a simple binary matching task. The 'target-size' sets the length of the binary sequence (zeros and ones) that must be found. This sequence can be thought of as the optimal genetic information (genome) for a particular environment. The 'population-size' sets the number of individuals that can try out their own genomes in that environment. Each generation the genetic algorithm runs through the following sequence of events, much like the process of evolution takes place in a typical ecosystem.
1. The individuals test their genomes against the environment ('compare-genomes' in the procedures).
In this simulation, the fitness is assigned by counting the number of genes (individual zeros or ones in the genome) that match the target genome. After ranking the fitnesses, the half of the population with higher fitness are then chosen to reproduce. These individual genomes are then randomly chosen in pairs, who then randomly decide which parent gives their gene at each locus (i.e., the location of an individual gene). Mutation occurs by choosing a random number at each locus for each genome. If the random number is lower than the mutation rate, then the gene is switched to its opposite state.
This was created as a preliminary excercise for the ARS-Genetic, by Thomas Hills.
(back to the NetLogo User Community Models)