Genetic Algorithms (GA

)

³Genetic Algorithms are good at taking large, potentially huge search spaces and navigating them, looking for optimal combinations of things, solutions you might not otherwise find in a lifetime.´

Originator 

John Holland, University of Michigan (1975)

Variation to GA
o Canonical Genetic Algorithm o Vose, 1993

Introduction  

Computing pioneers (especially in AI) looked to natural systems as guiding metaphors Evolutionary computation 

Any biologically-motivated computing activity simulating natural evolution 

Genetic Algorithms are one form of this activity 

Directed search algorithms based on the mechanics of biological evolution 

Original goals 

Formal study of the phenomenon of adaptation  John Holland  An optimization tool for engineering problems

Introduction (cont.. effective techniques for optimization and machine learning applications Widely-used today in business. scientific and engineering circles .)   Provide efficient.

Classes of Search Techniques S a hte h iq e e rc c n u s C lcu s-b se te n u s a lu a ch iq e E u e tiv te n u s n ra e ch iq e G id dra d ms a hte h iq e u e n o e rc c n u s D ct e o s ire th In ire e os ct th E o tio a a o m v lu n ry lg rith s S u te a n a i la n e lin Dn icp ra in y a ro F oa in n cci Nw n e to Eo tio a s teie G n tica o m v lu n ry tra s e e lg rith s P ra l a lle S q e tia e un l C n liz d e tra e D trib te S a y ta G n ra n l is u d te d -s te e e tio a .

Wh e olution as a meta hor o   Ability to efficiently guide a search through a large solution space Ability to adapt solutions to changing environments ³Emergent´ behavior is the goal  ³The hoped-for emergent behavior is the design of high-quality solutions to difficult problems and the ability to adapt these solutions in the face of a changing environment´  Melanie Mitchell. An Introduction to Genetic Algorithms .

Alleles Fitness. Selection Crossover.Evolutionar terminolog Abstractions imported from biology     Chromosomes. Mutation . Genes.

chromosome) Initialization procedure (creation) Evaluation function (environment) Selection of parents (reproduction) Genetic operators (mutation. recombination) Parameter settings (practice and art) ( Parameters that affect GA are initial population. selection process and fitness function) .Com onents of a GA       Encoding technique (gene. size of the population.

settings  Each chromosome is an encoding of a solution to a problem A population of such chromosomes is operated on by a GA  .GA terminolog  GA chromosomes are strings of genes  Each gene has a number of alleles.e.. i.

different parts of the string represent different aspects of the solution)  .Encoding  A data structure for representing candidate solutions  Often takes the form of a bit string Usually has internal structure.e. i..

Crossover  Mimics biological recombination   Some portion of genetic material is swapped between chromosomes Typically the swapping produces an offspring  Mechanism for the dissemination of ³building blocks´ (schemas) .

Mutation  Selects a random locus ± gene location ± with some probability and alters the allele at that locus The intuitive mechanism for the preservation of variety in the population  .

Fitness  A measure of the goodness of the organism Expressed as the probability that the organism will live another cycle (generation) Basis for the natural selection simulation  Organisms are selected to mate with probabilities proportional to their fitness Probabilistically better solutions have a better chance of conferring their building blocks to the next generation (cycle)    .

A Sim le GA Generate initial population do Calculate the fitness of each member // simulate another generation do Select parents from current population Perform crossover add offspring to the new population while new population is not full Merge new population into the current population Mutate current population while not converged .

Ho do GAs ork    The structure of a GA is relatively simple to comprehend. emphasizing. but the dynamic behavior is complex ³GAs work by discovering. and recombining good µbuilding blocks¶ of solutions in a highly parallel fashion.´ Using formalism   Notion of a building block is formalized as a schema Schemas are propagated or destroyed according to the laws of probability .

characterizes a set of candidate solutions sharing a property This property is the encoded equivalent of a building block . much like a regular expression. describing a set of strings The set of strings represented by a given schema.Schema    A template.

Exam le  0 or 1 represents a fixed bit Asterisk represents a ³don¶t care´ 11****00 is the set of all solutions encoded in 8 bits. beginning with two ones and ending with two zeros    Solutions in this set all share the same variants of the properties encoded at these loci .

Schema qualifiers  Length  The inclusive distance between the two bits in a schema which are furthest apart (the defining length of the previous example is 8)  Order  The number of fixed bits in a schema (the order of the previous example is 4) .

Not just sum of the arts  GAs explicitly evaluate and operate on whole solutions GAs implicitly evaluate and operate on building blocks    Existing schemas may be destroyed or weakened by crossover New schemas may be spliced together from existing schema .

Wh do the  ork Schemas can be destroyed or conserved So how are good schemas propagated through generations?   Conserved ± good ± schemas confer higher fitness on the offspring inheriting them Fitter offspring are probabilistically more likely to be chosen to reproduce  .

A  roximating schema d namics Let H be a schema with at least one instance present in the population at time t Let m(H. t) be the number of instances of H at time t Let x be an instance of H and f(x) be its fitness The expected number of offspring of x is f(x)/f(pop) (by fitness proportionate selection) To know E(m(H. but schema proliferation depends on its value     . t +1)) (the expected number of instances of schema H at the next time unit). sum f(x)/f(pop) for all x in H  GA never explicitly calculates the average fitness of a schema.

A  roximating schema d namics Approximation can be refined by taking into account the operators  Schemas of long defining length are less likely to survive crossover  Offspring are less likely to be instances of such schemas  Schemas of higher order are less likely to survive mutation .

Im lications   Instances of short. low-order schemas whose average fitness tends to stay above the mean will increase exponentially Changing the semantics of the operators can change the selective pressures toward different types of schemas Lemmas t t e    ema T eorem Selection focuses the search Crossover combines good schemas Mutation is the insurance policy .

evaluate population.Sim le Genetic Algorithm { initialize population. while TerminationCriteriaNotSatisfied { select parents for reproduction. perform recombination and mutation. evaluate population. } } .

The GA Cycle of Re roduction re roduction parents children modification modified children o ulation deleted members evaluated children evaluation discard .

.... 0. any data structure .0 89.1 . R22 R23) (genetic programming) ....Po ulation population Chromosomes could be:       Bit strings Real numbers Permutations of element Lists of rules Program elements ..2 -33.. (0101 . E1 E15) (R1 R2 R3 ...2) (E11 E3 E7 .. 1100) (43.

Reproduction reproduction parents children population Parents are selected at random ith selection chances iased in relation to chromosome evaluations. .

Chromosome Modification children modification modified children   Modifications are stochastically triggered Operator types are:  Mutation  Crossover (recombination) .

44 0.4 326.38 -67.38 -69.Mutation: Local Modification Before: After: Before: After:  (1 0 1 1 0 1 1 0) (0 1 1 0 0 1 1 0) (1.1) (1.5 326.44 0.1)  Causes movement in the search space (local or global) Restores lost information to the population .

Crossover: Recom ination * P1 P2 (0 1 1 0 1 0 0 0) (1 1 0 1 1 0 1 0) (0 1 0 0 1 0 0 0) (1 1 1 1 1 0 1 0) C1 C2 Crossover is a critical feature of genetic algorithms:  It greatly accelerates search early in evolution of a population  It leads to effective combination of schemata (sub solutions on different chromosomes) .

Evaluation evaluated children modified children evaluation   The evaluator decodes a chromosome and assigns it a fitness measure The evaluator is the only link between a classical GA and the problem it is solving .

Deletion population discarded members discard   Generational GA: entire populations replaced with each iteration Steady-state GA: a few members replaced each generation .

Generational GA   All parents reproduce at the same time Offspring generation replaces parent generation Parent (temporary) Offspring Current : : : .

Steady State GA  Fewer offspring generated and replace parents or other members of population Select parents Generate one or more offspring : Current population Offspring replace population member .

A set of solutions provided y a human expert . or use .A set of solutions provided y another heuristic algorithm .A previously saved population .Population Initialization Start ith a population of randomly generated individuals.

Types of selection:   Random Selection ± Parents are selected randomly from the population.Parent   election Selection is a procedure of picking parent chromosome to produce off-spring.  o Purpose: to focus the search in promising regions of the   space Inspiration: Darwin¶s ³survival of the fittest´ Trade-off between exploration and exploitation of the search space . Proportional Selection ± probabilities for picking each chromosome is calculated Rank Based Selection ± This method uses ranks instead of absolute fitness values.

.Ho to select these chromosomes o Selection Methods o Fitness Proportionate Selection Roulette wheel selection Rank selection Steady state selection Tournament selection Others. o o o o o .

.Fitness Proportionate Selection A simple selection method is each individual. i. has the probability Fitness(i) / sum_over_all_individuals_j Fitness(j) where Fitness(i) is the fitness function value for individual i.

08 22. like on the following picture.48 2.0 % of total 31 5 38 12 14 100 . Chromosome 1 2 3 4 5 Total Fitness 6.Roulette Wheel Selection Imagine a roulette wheel where are placed all chromosomes in the population.82 1.57 3. every has its place big accordingly to its fitness function.11 8.

i.S) .  Calculate sum of all chromosome fitness in population sum S. while sum < r do i = i + 1.) Let i = 1.e. Calculate P(xi) using proportional selection. where i denotes chromosome index. next chromosome sum = sum + P(xi). repeat until all parents are selected Drawback: If the best chromosome fitness is 90% of all the roulette wheel then the other chromosomes will have very few chances to be selected . sum = P(xi).  Generate random number from interval (0.r.Roulette Wheel Selection ( cont. end return xi as one of the selected parent..

Rank Selection  Rank selection first ranks the population and then every chromosome receives fitness from this ranking. The worst will have fitness 1. Situation before ranking (graph of fitnesses) . second worst 2 etc. and the best will have fitness N (number of chromosomes in population).

Rank Selection ( cont.) Situation after ranking (graph of order numbers) Drawback: This method can lead to slower convergence.. . because the best chromosomes do not differ so much from other ones.

Then some (bad with low fitness) chromosomes are removed and the new offspring is placed in their place. GA then works in a following way.Steady-State Selection Main idea of this selection is that big part of chromosomes should survive to next generation. The rest of population survives to new generation.with high fitness) chromosomes for creating a new offspring. In every generation are selected a few (good .   .

the fittest one is selected as a parent By changing n and/or p.Tournament Selection  Binary tournament  Two individuals are randomly chosen. 0. the fitter of the two is selected as a parent Two individuals are randomly chosen. the GA can be adjusted dynamically   . with a chance p.5<p<1. the fitter of the two is selected as a parent  Probabilistic binary tournament   Larger tournaments n individuals are randomly chosen.

g. 0.0 There is a chance that a gene of a child is changed randomly Generally the chance of mutation is low (e.001)  Mutation   .6 and 1.Reproduction   Reproduction operators  Crossover  Mutation Crossover     Two parents produce two offspring There is a chance that the chromosomes of the two parents are copied unmodified as offspring There is a chance that the chromosomes of the two parents are randomly recombined (crossover) to form offspring Generally the chance of crossover is between 0.

Crossover      Performed on two chromosomes as parents The probability of parents being crossed over is given by crossover rate Crossover points are randomly selected Exchanges genetic code between parents to create two new chromosomes as offspring Commonly used crossover    One-point crossover Two-point crossover Uniform crossover .

One-Point Crossover  Only one crossover point is selected for each parent 11000110Offspring 1 01111100Offspring 2 Parent 1: 11011100 Parent 2: 01100110 Crossover point .

One-Point Crossover  Advantages   Simple to implement Little disruption on evolved schemas Cannot combine many schemas  Weakness  1 * * * 1 1 1 0 0 * 1 1 * 0 0 * * * .

T o-Point Crossover 

Two crossover points are selected for each parent
11011100 01100110 11000100 01111110

Parent 1 Parent 2

Offspring 1 Offspring 2

Crossover Points

T o-Point Crossover 

Advantage 

More likely to combine schemas (downside: more likely to disrupt existing schemas)

1 * * * 1 1 * 0 0 * * *

1 0 0 * 1 1

Uniform Crossover   

Every gene can be swapped between the parents independent of the other genes The probability of swapping genes is fixed at P0 No need to select crossover points
11011100 01100110 11001110 01110100
Offspring 1 Offspring 2

Parent 1 Parent 2

Positional/Defining Length Bias  Defining length  The distance of two remotest genes defined in a schema 1 0 0 * 1 1 Defining length = 5  Formation and disruption of a schema depends on its defining length or its locations in the chromosome  One-point crossover has positional/defining length bias  Schemas with longer defining length are more likely to be disrupted  Uniform crossover has no positional/defining length bias  Each pair of genes has the same probability of being swapped independent of its location .

Distri ution Bias   The number of genes to be swapped may be distributed around a particular value instead of uniformly from 1 to L-1 (L = individual length) One-point crossover has no distribution bias  Crossover point is selected randomly within the chromosome The number of genes to be swapped depends on P0  Uniform crossover has high distribution bias  .

Mutation    Involves only one chromosome Applies to each gene individually The value of a mutated gene is flipped 11011100  11011000 The probability of a gene being mutated is controlled by mutation rate M    The mutation rate per chromosome = M * L Low mutation rate: low exploration power High mutation rate: too disruptive .

Implementation Variations  Varying rates of Crossover/Mutation   Start with low mutation rate and increase afterwards Start with high crossover rate and decrease afterwards Adjust rates under certain conditions  Adaptive crossover and mutation rates    Problem dependent variations Random crossover for variable length GAs   Crossover points can be selected separately for parents Creates offspring with different lengths from their parents Parent 1 Parent 2 Offspring 1 Offspring 2 .

Other Genetic Operators  Inversion 412305 214305 ‡ Transposition 412305 305412 .

A Simple Example The Traveling Salesman Problem: Find a tour of a given set of cities so that   each city is visited only once the total distance traveled is minimized .

Representation Representation is an ordered list of city numbers known as an order-based GA. 2) London 4) Singapore 3) Dunedin 6) Phoenix 5) Beijing CityList1 CityList2 (3 (2 5 2 6 5 6 3 4) 4) .

3.2.3.6.6.5) (4.4.4.2.Initial Population for TSP (5.2.6.6) (5.5.2) (3.4.2.4.2.6.5) (2.6.5) (4.6.6.3.4.5.4) .4.3.5.5.3.6) (3.6.3.6.5.2) (3.2.3.3.6.5) (3.5) (4.4.2) (4.2) (2.

6.5.4.3.6.6.5) (4.2.3.5) (3.6.5.6) (3.3.6) (5.2) (4.6.3. .2.6.5) (2.2) (3.3.4.2.6.4) Try to pick the better ones.Select Parents (5.3.2.3.5.4.4.6.5) (4.2.5.6.3.2) (3.4.5.4.2.6.4.5) (4.2) (2.

2.5) (4.5.6.6.5.5.4.4.4.2) (4.3.6.2) (2.6) (5.2) .3.5) (4.6.4.6.6.6) (3.4.4) (3.6.4.6.3.3.4.6.5) (3.5.3.3.4.2.2) (3.3.Create Off-Spring ± 1 point (5.6.5.2.2.5.2.6.2.2) (3.3.5) (4.5) (2.

6.6.6) (3.5.2.5.4.Create More Offspring (5.4.4.3.6.3) .3.4.2) (5.4.2.6.5) (4.6.6.5.2.6.2.6.4.4.6.3.2.3.5.3.5) (4.4.5) (2.6.2) (4.2.4) (3.5.2) (3.5) (3.6) (5.4.2) (2.6.6.3.3.2.5) (4.2) (3.3.5.

6) (5.4.4.3) .3.4.3.6) (3.2.3.6.4.6.6.3.6.2) (4.4) (3.5.6.6.2.6.2.3.6.5) (4.6.2) (5.5) (4.5) (3.5) (4.2) (3.2.4.4.2.Mutate (5.3.4.3.4.2.5.4.3.5.5) (2.6.5.2) (2.2.2) (3.5.5.6.6.

2) (2.2) (3.2.6.6.6.5.4.3.3) .2.6.4.4.5.5.6.4.6.3.6.4.6.5) (3.6.5) (2.5) (4.2.4.6.6.3.6) (5.3.3.4.3.2) (4.4.4) (3.2.2.5.2) (3.3.4.5) (4.5.6.2) (5.Mutate (5.5) (2.3.2.4.5.6) (3.

.4.2.3.5.3.4.4.6.5) (3.5.5) (2.4.6.3.3.5.5.2) (4.2.3.4.2) (3.5) (4.6.6.2.4) (3.3) Tend to kill off the worst ones.2.6.Eliminate (5.5.5) (2.5.2.6) (3.3.6.6) (5.3.6.6.4.4.2.3.6.4.4.2) (3.2) (5.6.5) (4.6.6.4.2) (2.

5.3.2.2) (3.3.5) (5.4.2) (3.2) (3.5.4.6.3) (3.2.6) (5.6.4.2.4) .5) (4.4.6.4.6.2.3.6.4.5) (2.6.6.4.5.2.4.3.5.Integrate (5.2) (4.6.6.3.6) (3.5.2.3.6.5) (2.4.

4.6.5.5.4.2.5.5) (2.6.5.3.6.3.2) (3.6.2.4.6.2) (3.5) (4.4.6) (3.5.4.6) (5.6.Restart (5.4) .3.4.2.4.5) (5.3) (3.4.2.2.3.4.2) (4.2) (3.6.3.5) (2.2.6.6.3.6.

separate from application Supports multi-objective optimization Good for ³noisy´ environments Always an answer. easily distributed Many ways to speed up and improve a GAbased application as knowledge about problem domain is gained Easy to exploit previous or alternate solutions . answer gets better with time Inherently parallel.Benefits of Genetic Algorithms         Concept is easy to understand Modular.

When to Use a GA      Alternate solutions are too slow or overly complicated Need an exploratory tool to examine new approaches Problem is similar to one that has already been successfully solved by using a GA Want to hybridize with an existing solution Benefits of the GA technology meet key problem requirements .

checkers. routing. prisoner¶s dilemma set covering. bin packing.Some Domain Control Desi n Scheduling Robotics A Application T pes Application T pes gas pipeline pole alancing missile evasion pu sui semiconduc o layou ai c a design keyboa d con igu a ion communica ion ne o ks manu ac u ing acili y scheduling resource alloca ion rajectory planning designing neural networks improving classi ication algorithms classi ier systems ilter design poker. graph colouring and partitioning Machine Learning Signal Processing Game Playing Combinatorial Optimization . travelling salesman.

Genetic Al orithms  Facts   Very robust but slow In the limit. optimal .

Sign up to vote on this title
UsefulNot useful