An
An Introduction
Introduction to
to Genetic
Genetic Algorithms
Algorithms
Rajkumar Pant
Aerospace Engineering Department
IIT Bombay
PDF created with pdfFactory Pro trial version www.pdffactory.com
OUTLINE
OUTLINE
( Historical background
( Working Principles of GA
( GA operators
( Concept of schemata in GA
( GA v/s traditional methods
( Drawbacks of GA
( GA for constrained optimization
( Modern developments
PDF created with pdfFactory Pro trial version www.pdffactory.com
OPTIMIZATION
OPTIMIZATION TECHNIQUES
TECHNIQUES
x = xi, i = 1, n ‘n’ Design Variables
f(x) Objective function
Ui ≤ xi ≤ Li, i = 1,n Bounds on Design Variables
gk(x) ≤ 0, k = 1,m ‘m’ inequality Constraints
hj(x) = 0, j = 1,p ‘p’ equality Constraints
Trivial Solution Exhaustive Search
Initial Point >>>>>>>>>>>>>> Trial Point
Deterministic Methods Direct mathematical link
Stochastic Methods Element of randomness
PDF created with pdfFactory Pro trial version www.pdffactory.com
Historical Background
(Mechanics of natural genetics and evolution
u Survival of the fittest
u Evolution of the species
(John Holland, University of Michigan
s Adaptation in natural and artificial systems, 1975
(David Goldberg, University of Illinois
s Genetic Algorithms in Search, Optimization and Machine
Learning,1989
(ICGA, 1985, 87, 89, …….
PDF created with pdfFactory Pro trial version www.pdffactory.com
Working Principles of GA
(Unconstrained Optimization
u Maximize f(x), x = xi, i = 1, n, Ui ≤ xi ≤ Li, i = 1,n
(Coding of x in string structures
x
u Not absolutely essential (Real GA)
u Usually Binary Coding
s each xi coded in k sub-strings of length li, k = 2 {li}
s sub-string element sk(m) ∈(0,1), m = 0, li-1
• sk = sl-1sl-2 ….. s2s1s0
s Discrete values of xi mapped
• xi = Li , DV(si) * (Ui - Li) / (2{li} - 1), where
DV(sk) = Decoded value of (sk) = ∑ 2m.sk(m), m = 0, l-1
PDF created with pdfFactory Pro trial version www.pdffactory.com
Example of Binary Coding
u Decoding Procedure k sk DECODING OF sk x1(k)
s i=1, l1 = 4 1 0000 (0)*23 + (0)22 + (0)*21 + (0)*20 0
3 2 1 0
2 0001 (0)*2 + (0)2 + (0)*2 + (1)*2 1
3 2 1 0
3 0010 (0)*2 + (0)2 + (1)*2 + (0)*2 2
s k = total number of discrete
4 0011 (0)*23 + (0)22 + (1)*21 + (1)*20 3
values of x1 =2 {l1} = 24 =16 5 0100 3 2 1
(0)*2 + (1)2 + (0)*2 + (0)*2 0
4
3 2 1 0
6 0101 (0)*2 + (1)2 + (0)*2 + (1)*2 5
3 2 1 0
s string sk = s3s2s1s0 7 0110 (0)*2 + (1)2 + (1)*2 + (0)*2 6
3 2 1 0
8 0111 (0)*2 + (1)2 + (1)*2 + (1)*2 7
s sk(m) ∈(0,1), m =0, 3
9 1000 (1)*23 + (0)22 + (0)*21 + (0)*20 8
10 1001 (1)*23 + (0)22 + (0)*21 + (1)*20 9
3 2 1 0
11 1010 (1)*2 + (0)2 + (1)*2 + (0)*2 10
m.
s DV (sk) =∑ 2 sk(m), m = 0, 3 12 3 2 1 0
1011 (1)*2 + (0)2 + (1)*2 + (1)*2 11
3 2 1 0
13 1100 (1)*2 + (1)2 + (0)*2 + (0)*2 12
3 2 1 0
14 1101 (1)*2 + (1)2 + (0)*2 + (1)*2 13
u Accuracy
15 1110 (1)*23 + (1)22 + (1)*21 + (0)*20 14
s ≈ (Ui - Li) / 2 {li} 3 2 1 0
16 1111 (1)*2 + (1)2 + (1)*2 + (1)*2 15
s Exponential increase with
string length
PDF created with pdfFactory Pro trial version www.pdffactory.com
Working Principles of GA
(Fitness Function F(x)
u Directly related to f(x)
s F(x) = f(x) for maximization
s F(x) = 1/ (1, f(x)) for minimization
(Steps in GA
u Create initial population (randomly) by concantening sub-strings
u Evaluate F(x) of each member, identify best member(s)
u Create next generation, using GA operations
s Reproduction
s Crossover
s Mutation
u Iterate till convergence
PDF created with pdfFactory Pro trial version www.pdffactory.com
Reproduction
(Insertion of strings with higher F(x) in mating pool
u Strings with low F(x) may also get selected
(Selection strategies
u Proportionate
s probability of selection proportional to F(x)
• Roulette-Wheel selection
u Ranking
s best of a few strings selected each time
• Tournament selection
PDF created with pdfFactory Pro trial version www.pdffactory.com
Crossover
u Two strings from mating pool selected (randomly)
u Location(s) of crossover location determined (randomly )
u Bits of Strings interchanged between crossover location(s)
(Single point Crossover
(0) 0 0 0 0 =====> 0 0 0 1 (1)
(11) 1 0 1 1 =====> 1 0 1 0 (10)
Parent Strings Child Strings
(Crossover can be beneficial or detrimental
u Crossover Probability pc ≈ 0.7 to 0.9
PDF created with pdfFactory Pro trial version www.pdffactory.com
Mutation
(Flipping of bits of strings at random
u local search around current solution
u maintain genetic diversity of population
u enable search to climb towards global optimum
u mutation probability pm ≈ 0.005 to 0.015
(Illustration with pm = 0.10
u Original population
0010,1001,0001,1111,0111,1101,1111,1001
(2) (9) (1) (16) (7) (13) (16) (9)
u After Mutation
0 0 1 0 , 1 0 0 1 , 0 1 0 1 , 1 1 1 1 , 0 1 1 0 , 1 1 0 1, 1 1 1 1 , 1 1 0 1
(2) (9) (5) (16) (6) (13) (16) (13)
PDF created with pdfFactory Pro trial version www.pdffactory.com
GA Operators - Summary
(Reproduction
u Select good strings from population (eliminate bad strings)
(Crossover
u Recombine strings and (hopefully) create better strings
(Mutation
u Once in a while, create even better/worse strings
PDF created with pdfFactory Pro trial version www.pdffactory.com
Concept of Schemata in GA
(Schemata
s number of strings with similarities at certain string positions
s total schemata for binary representation = 3l, l = string length
s defining length δ(H) = difference in outermost defining points
s order o(H) = number of fixed point
s Example for H = 1*0*
• δ(H)= o(H) =2
• strings = 1101, 1100, 1000, 1001
• occupies 25% of search space
0000 0001 0010 0011
0100 0101 0110 0111
1000 1001 1010 1011
1100 1101 1110 1111
s population = 16, but total schemata = 34 = 81
PDF created with pdfFactory Pro trial version www.pdffactory.com
Schemata Theorem
F (H ) δ (H )
m( H , t + 1) ≥ m( H , t ) 1 − pc − pmo( H )
Favg l −1
Where,
m(H,t) = Number of strings of schema H in generation t
F(H) = Average fitness of strings of schema H
Favg = Average fitness of the population
pc = Probability of crossover
pm = Probability of mutation
l = String length
δ (H) = Defining length of schema H
o(H) = Order of schema H
PDF created with pdfFactory Pro trial version www.pdffactory.com
Building Block Hypothesis
u Building Blocks
s Schema with lowδ (H) & o(H), and F(H) > Favg
• Represent different large, good regions in search space
• Propagate exponentially with generations
• Combine with each other vigorously
• Lead to
l optimum (near-optimal) solutions
u Implicit Parallelism
s In each generation
• n function evaluations
• n3 schemata processed
• without any specific book-keeping !
PDF created with pdfFactory Pro trial version www.pdffactory.com
GA v/s Traditional methods
(Direct Methods
u Gradients or any auxiliary information not required
u Can handle discontinuous, Multi-modal functions
(Stochastic formulation
u Independent of starting point
(Work on coding of variables
u Domain Discretization
u General purpose & robust code possible
(Work on a population of points
u Better chance of converging to global minimum
u Can identify multiple optimal solutions
PDF created with pdfFactory Pro trial version www.pdffactory.com
Drawbacks of GA
u Coding scheme should be meaningful & appropriate
s premature convergence
u GA parameters have to be tuned before starting
s population size, max. generations, pc, pm
s crossover type, selection strategy
u Constraints cannot be implicitly handled
s penalty function approach (usually)
u Large number of function evaluations
s Orders of magnitude higher than traditional algorithms
PDF created with pdfFactory Pro trial version www.pdffactory.com
GA for constrained optimization
Maximize F(x) = 1/(1+ P(x)) or
Minimize F(x) = P(x), where
J K
P ( x ) = f ( x ) + ∑ u j g j ( x ) + ∑ v k hk ( x )
2 2
j =1 k =1
f (x)= objective function
uj = penalty coefficients for J inequality constraints gj
vk = penalty coefficients for K equality constraints hk
uj &vk are usually kept constant during one GA run
Large values can be assigned to uj &vk
PDF created with pdfFactory Pro trial version www.pdffactory.com
Other GA operators
u Fitness Function scaling
s To avoid premature convergence due to
• dominance by one string
• presence of several average fit strings
l transform F (x) to S(x) = aF(x) + b ; choose a & b such that
l best string has a predefined number of copies
l each string with average fit has only one copy
u Multi-point Crossover
s Single point crossover is biased in favor of right-most bits
u Uniform Crossover
s A bit at any location chosen either parent with p = 0.5
s for e.g. if 1st and 3rd bits are changed, then
(0) 0 0 0 0 =====> 1010 (10)
(11) 1 0 1 1 =====> 0001 (1)
PDF created with pdfFactory Pro trial version www.pdffactory.com
Recent development in GAs
u Real Coded GA
s work directly on design variables
u Simultaneous multiple solutions of multi-modal functions
s divide population using sharing functions
u Multi-criteria optimization
s pareto-optimal solutions
u Reported applications of GA in literature
s Gas pipeline layout optimization
s Job shop scheduling, Routing, Travelling salesperson
s Aircraft Design and Structural / Aerodynamic optimization
s Gas Turbine blade design
s Laminate stacking in Composite structures
PDF created with pdfFactory Pro trial version www.pdffactory.com
Happy computing with GA !!
PDF created with pdfFactory Pro trial version www.pdffactory.com