This talk is available at http://www.mcs.drexel.edu/~shartley/geneticAlgorithms.html. It has been brazenly excerpted (without permission) from Section 2.6 of a recent book, Concurrent Programming: The Java Programming Language, © 1998 Oxford University Press.
Genetic algorithms are used in search and optimization, such as finding the maximum of a function over some domain space.
An initial population of random bit strings is generated.
From the initial population of chromosomes, a new population is generated using three genetic operators: reproduction, crossover, and mutation.
The new population generated with these operators replaces the old population.
Genetic algorithms work in many situations because of some hand waving called The Schema Theorem.
To illustrate the manipulation of chromosomes by the genetic operators reproduction, crossover, and mutation, we will look at some sample program output for a very simple problem.
We first see the randomly generated initial population, in which the best fitness is 5.
The GA parameters are: populationSize = 4 numXoverPoints = 1 crossoverRate = 0.7 mutationRate = 0.1 doElitism = false printPerGens = 1 maxGenerations = 3 Debug.flag = true logFileName = bit.out BitCountChromosome: chromosome length is 10 GA: chromosome length = 10 GA: mainLoop Known solution fitness is 10.0 p0: 0000110100 this chromosome has 3 bits set fitness= 3.0 p1: 1100010110 this chromosome has 5 bits set fitness= 5.0 p2: 1111001000 this chromosome has 5 bits set fitness= 5.0 p3: 0101011001 this chromosome has 5 bits set fitness= 5.0 currentBest (generation=0): 1100010110 this chromosome has 5 bits set fitness= 5.0 Initial population: generation=0 best value=5.0 avg=4.5 stddev=1.0
A proportional selection algorithm called the roulette wheel method is used for reproduction.
mem=0, cfitness=0.16666666666666666 mem=1, cfitness=0.4444444444444444 mem=2, cfitness=0.7222222222222222 mem=3, cfitness=1.0 p=0.07431843256287485, selected 0 p=0.25792751503513034, selected 1 p=0.6502614780006086, selected 2 p=0.3749322338318496, selected 1 p0: 0000110100 this chromosome has 3 bits set fitness= 3.0 p1: 1100010110 this chromosome has 5 bits set fitness= 5.0 p2: 1111001000 this chromosome has 5 bits set fitness= 5.0 p3: 1100010110 this chromosome has 5 bits set fitness= 5.0
Now that we have the new population, it is time to apply crossover and then mutation.
| 111 | 1001000 | are replaced by | 110 | 1001000 |
| 110 | 0010110 | 111 | 0010110 |
crossing 2 and 3 OnePointCrossover: just crossed at 3 p0: 0000110100 this chromosome has 3 bits set fitness= 3.0 p1: 1100010110 this chromosome has 5 bits set fitness= 5.0 p2: 1101001000 this chromosome has 4 bits set fitness= 4.0 p3: 1110010110 this chromosome has 6 bits set fitness= 6.0
Each chromosome is now given the chance to mutate by generating a random number between 0 and 1 for each of its genes.
mutation, i=0, gene=3: 0001110100 this chromosome has 4 bits set fitness= 4.0 mutation, i=0, gene=6: 0001111100 this chromosome has 5 bits set fitness= 5.0 mutation, i=1, gene=9: 1100010111 this chromosome has 6 bits set fitness= 6.0 mutation, i=2, gene=5: 1101011000 this chromosome has 5 bits set fitness= 5.0 mutation, i=2, gene=7: 1101011100 this chromosome has 6 bits set fitness= 6.0 mutation, i=3, gene=3: 1111010110 this chromosome has 7 bits set fitness= 7.0 mutation, i=3, gene=6: 1111011110 this chromosome has 8 bits set fitness= 8.0
Report: generation=1 best value=8.0 avg=6.25 stddev=1.258... most fit (previous generation=1): 1111011110 this chromosome has 8 bits set fitness= 8.0 number of crossovers and mutations: 1 and 7 p0: 0001111100 this chromosome has 5 bits set fitness= 5.0 p1: 1100010111 this chromosome has 6 bits set fitness= 6.0 p2: 1101011100 this chromosome has 6 bits set fitness= 6.0 p3: 1111011110 this chromosome has 8 bits set fitness= 8.0
This completes the first generation.
After two more generations, the population is again listed.
Report: generation=3 best value=7.0 avg=6.75 stddev=0.5 most fit (previous generation=1): 1111011110 this chromosome has 8 bits set fitness= 8.0 number of crossovers and mutations: 3 and 12 p0: 1111001100 this chromosome has 6 bits set fitness= 6.0 p1: 1111001110 this chromosome has 7 bits set fitness= 7.0 p2: 1101011110 this chromosome has 7 bits set fitness= 7.0 p3: 1111001110 this chromosome has 7 bits set fitness= 7.0
Click here for the output of one run of the program on a more difficult version of this problem: 100 bits in each chromosome. The fitness is the square of the percentage of bits set to give the GA better guidance.
Genetic algorithms have been very successful at solving many types of problems.
Here are two example problems, one discrete and one continuous, that are more realistic.
Hitchhiking.
11111111........................................................ ........11111111................................................ ................11111111........................................ ........................11111111................................ ................................11111111........................ ........................................11111111................ ................................................11111111........ ........................................................11111111
Deception.
A very nice Java applet: http://www.taygete.demon.co.uk/java/ga/index.html.
An application (stand-alone program) written in Java using genetic algorithms to illustrate various features of object oriented programming: http://www.mcs.drexel.edu/~shartley/ConcProgJava/sequential.html#SIMGA
A two-part overview of genetic algorithms with an academic, theoretical, and research orientation (in Postscript): Part 1, Part 2.
David E. Goldberg, Genetic Algorithms in Search, Optimization, and Machine Learning, Addison-Wesley, 1989.
Melanie Mitchell, An Introduction to Genetic Algorithms, MIT Press, 1996.
Genetic Algorithms FAQ.
Where to try to get the FAQ if the above
does not work.
Other GA sites (this file is a year old so some
links in it may not work).
Another GA Web site.
GA archive Web site.