100 likes | 123 Views
Learn about Genetic Algorithms (GAs), an evolutionary computing technique invented by John Holland in 1975. Explore how GAs differ from traditional methods, their vocabulary, and a simple example. Understand the basic Genetic Algorithm steps, selection, crossover, and mutation. Discover GAs in games like Space Ship AI and available resources.
E N D
Introduction to Genetic Algorithms Jeff Plummer Nov. 2003
Background • Problems are solved by an evolutionary process resulting in a best (fittest) solution (survivor). • Evolutionary Computing • 1960s by I. Rechenberg • Genetic Algorithms • Invented by John Holland 1975 • Made popular by John Koza 1992
How GA are Different than Traditional Search Methods • GAs work with a coding of the parameter set, not the parameters themselves. • GAs search from a population of points, not a single point. • GAs use payoff information, not derivatives or auxiliary knowldege. • GAs use probablistic transition rules, not deterministic rules.
Vocabulary • Gene – An single encoding of part of the solution space. • Chromosome – A string of “Genes” that represents a solution. • Population - The number of “Chromosomes” available to test.
Simple Example • f(x) = {MAX(x2): 0 <= x <= 32 } • Encode Solution: Just use 5 bits (1 or 0). • Generate initial population. • Evaluate each solution against objective.
Simple Example (cont.) • Create next generation of solutions • Probability of “being a parent” depends on the fitness. • Ways for parents to create next generation • Reproduction • Use a string again unmodified. • Crossover • Cut and paste portions of one string to another. • Mutation • Randomly flip a bit. • COMBINATION of all of the above.
The Basic Genetic Algorithm • [Start] Generate random population of n chromosomes (suitable solutions for the problem) • [Fitness] Evaluate the fitness f(x) of each chromosome x in the population • [New population] Create a new population by repeating following steps until the new population is complete • [Selection] Select two parent chromosomes from a population according to their fitness (the better fitness, the bigger chance to be selected) • [Crossover] With a crossover probability cross over the parents to form new offspring (children). If no crossover was performed, offspring is the exact copy of parents. • [Mutation] With a mutation probability mutate new offspring at each locus (position in chromosome). • [Accepting] Place new offspring in the new population • [Replace] Use new generated population for a further run of the algorithm • [Test] If the end condition is satisfied, stop, and return the best solution in current population • [Loop] Go to step 2
Example Applet • http://www.rennard.org/alife/english/gavintrgb.html
GAs and Games • GAs are learning systems • Consider a Space Ship AI - Evade • Chromosome encoding is string of “Up, Down, Left, Right, Accelerate, Decelerate” • Fitness of “Chromosome” is proportional to the length of time it can evade a player. • As player plays, ships get better at evading. • DOESN’T REQUIRE A LIVE PLAYER!!!!!!
Bibliography • Genetic Algorithms in Search, Optimization, and Machine Learning by David E. Goldberg. • http://cs.felk.cvut.cz/~xobitko/ga/ • http://www.sambee.co.th/MazeSolver/mazega.htm • http://www.rennard.org/alife/english/gavintrgb.html