A First Course in Genetic Algorithms Tim Watson G6.71 tw@dmu.ac.uk
What is a GA? Evolutionary Algorithm Create random population of possible solutions in the form of bitstrings See how good each one is (test fitness) Produce next generation (fitter are more likely to get into next generation) Crossover, mutate and make next generation the current one
What can they do? Schedule Barcelona Olympics Aircraft Design Dynamic Routing in Networks Robot Arm Trajectory Planning Lab Task Scheduling for US Navy Aircraft Missile Evasion Evolving aNN Architecture Parameter Tuning for Sonar Systems Conformational Analysis of DNA
Example: Onemax Initial population: 100 000 110 Calculate fitness: 100 2 000 1 110 3 Reproduce: 110 100 110 Crossover & Mutate: 101 010
Biological Terminology Genes etc. Gene Locus (plural loci) Allele (also called gene value) (Pleiotropic gene) Genotype (Chromosome) Phenotype Fitness Landscape
GA Theory Schema Theorem Building Block Hypothesis GA searches schemata in parallel 10 represents 10, 1#, #0 and ## The theorem is rubbish! Building Block Hypothesis Good, small sequences are found and recombined to form good solutions No Free Lunch Theorem
GA Parameters Population Size Chromosome Size Crossover Rate Static or Dynamic? Chromosome Size Fixed or Variable? Crossover Rate One-point, two-point or uniform? Mutation Rate Fitness Function Termination Criteria
Prediction Test! What happens to the population statistics in a standard GA with random fitness, no crossover, no mutation and chromsize equals 16? Best, Worst, Mean , Std. Dev., column counts Best=17, Worst=1, Mean=9ish, Std. Dev. constant-ish, pop converges randomly.
Reproduction in GAs Need selective pressure for reproduction to improve the population fitness None leads to random walk (slow) Some leads to geometric growth of best (fast) Infinite populations select individuals on relative fitness: fit/mean(fit) Finite populations also affected by how many copies are already present
Types of Selection Fitness-Proportionate Rank-Order Tournament Elitism Fitness scaling based on raw fitness where if fita < fitb then scaled(fita) scaled(fitb) Scaling can be altered dynamically Rank-Order Tournament Elitism
Initialising the Population Uniformly at random Best Guesses Converged to Best Known From Real World Hybrid
Mutation Goal of selection: survival of the fittest Goal of mutation: explore lost or never seen alleles Random reset versus bit flip Reset rate = ½ bit flip rate Mutation as a spring In infinite time every possible population visited an infinite number of times Alternative to mutation: complement
Crossover Goal: to try out different combinations of good bits of individuals Crossover point One-point Two-point N-point Uniform
Crossover (2) Closer genes are less likely to be split by crossover AB###### probability of split with one-point crossover = 1/7 A######B probability of split = 1 Local maxima can occur (e.g. for onemax) 11011 fit=4 1011000101 00100 fit=1 0010100000 All children have lower fitness than parents
Design Decisions If genes are linked then the representaion of an individual ought to keep them close together Get the balance right: Popsize too small premature convergence Popsize too large too slow to compute Mutation rate too low not enough exploring Mutation rate too high too much noise