Machine Learning 1Genetic Algorithms
Who’s This?
What’s This?
HMS BeagleThe Voyage of the Beagle (1839)
(1831-1836)
Darwin’s Finches
Charles Darwinfrom The Voyage of the Beagle
“The most curious fact is the perfect gradation in the size of the beaks in the different species of Geospiza…. Seeing this gradation and diversity of structure in one small, intimately related group of birds, one might really fancy that from an original paucity of birds in this archipelago, one species had been taken and modified for different ends”
Differential Reproduction
The Tragic Tale of Green Beetles
The Genetic Algorithm
Developed◦John Holland, University of Michigan (~1975)
Widely Applied◦Daniel Goldberg (1989)
Metaphor of natural selection applied to optimization problems
Truss Bridge
Truss Optimization: 64 Bars
2 4 6 8
1 3 5 7
16 24 26 28
15 23 25 27
18
20 22
17
19 21
10 12
14
9 11
13
100 K 100 K
70 K
70 K
20 K
20 K
Optimize?
Minimize the Volume of the Truss◦sum(X-Sectional Area of Member X Length)◦NP-Complete*
*Overbay, S., Ganzerli, S., De Palma, P, Brown, A., Stackle, P. (2006). Trusses, NP-Completeness, and Genetic Algorithms. Proceedings of the 17th Analysis and Computation Specialty Conference. St. Louis, MO.
A Simpler Problem: Word Guess
User thinks of a wordPasses the word to the GA KeeperGA guesses the word
Elements of GA
Idea: Representation selects key items of object for computation Chromosome
◦ Representation of a candidate solution◦ Specs for an individual truss◦ A word
Gene◦ An element of a chromosome◦ Specs for a member◦ A letter
Population◦ Set of chromosomes◦ Specs for a set of trusses◦ Set of letter strings representing candidate solutions
Initialize the Population
Idea: Starting point for speciationRandomly generate a set of chromosomesRandomly generate specifications for
trussesRandomly generate letter strings of the
given size
How Large?
Large Enough to Incorporate Genetic Diversity
Divisible by 264 seems to work
Rank Fitness
Idea: Members of the population have characteristics that better suit them for reproduction
◦Function over the population used to rank the population
◦Truss: The smaller the cross-sectional area, the higher the fitness
◦Word Guess: Proximity to correct word
Pair
match.com for trussesor
words(or whatever)
Zero Population Growth
Idea: Food supply (and memory) cannot tolerate unlimited population growthSuppose current population is max: mCurrent population produces n offspringReduce m + n candidate solutions to mExample: m = 64
◦Select 32 population members to survive◦Group them into 16 breeding pairs◦Allow each to produce 2 children
Selecting Mating Population
Idea: Differential ReproductionRandom: Any PP (potential parent) could
reproduceTruncation Selection
◦Top half: survive and reproduce◦Bottom half: die
Stochastic:◦Spin a roulette wheel
Each element has a slot Size of slot is proportional to 1) fitness 2) probability of
being chosen to reproduce
Pairing
Idea: Maximize the fitness of offspringTop-DownTournament
While ( < 16 mating pairs){ Do twice:
Randomly select subset of the population Select 1 parent at random from subsetAdd parents to set of mating pairs
}Many Others
Mate
Idea: Children preserve parents’ genetic informationGenetic Recombination
Target: ChipolteMany Algorithms
◦Illustrated: single point crossover
PA: CHIP OTLE PB: CHIX LOTL
CA: CHIP LOTL CB: CHIX OTLE
Mutation (and genetic drift)
Idea: Population can get stuck in a local minimumSimulates:
◦chemical mutagens◦radiation◦copying errors◦random loss of population members
Randomly perturb a fraction of the population
Convergence
Idea: No further improvement is possible (within acceptable cost)Stop after a fixed number of iterationsStop when a known solution is foundStop when m% of the population is within
n standard deviations of the mean fitness
Putting It Together: The GA Loop
GA(population){ Initialize(population) //generate population
ComputeCost(population) //compute fitnessSort(population) //rankwhile (population not converged on a good-enough solution){SelectBreeders(population) //who reproduces?Pair(breeders) //love and marriageMate(population) //genetic recombinationMutate(population) //jar from local minimaSort(population) //rankTestConvergence(population) //stop?}
}