Академический Документы
Профессиональный Документы
Культура Документы
GA Quick Overview
Akhmad Aminullah
GA in Structural design
Goldberg started apply GA to engineering field,
his studied about “Mass-spring-dashpot
system identification with simple GA” in 1981
and continue many other research
like”Steady-state and transient optimization of
gas pipeline using GA” and “Structural
optimization (plane truss) via GA” (Goldberg,
1989).
Akhmad Aminullah
Engineering application of GA
Akhmad Aminullah
Ch 2 METHOD OF OPTIMIZATION
Akhmad Aminullah
Optimization algorithms
Akhmad Aminullah
Direct search method
Cyclic Coordinate search
Simulated Annealing (SA)
Genetic Algorithm (GA)
Akhmad Aminullah
Integer and Discrete Programming
Akhmad Aminullah
Example Problem
g1 X x1 0.0193 x3 0
g 2 X x2 0.00954 x3 0
Akhmad Aminullah
(3.6)
Comparison from all method
Best solution found
Design Bound and
Variable Cyclic SA GA Farka’s
Branch
x1 0.727590981 0.856745591 0.76 1.125 1.95625
x2 0.359699953 0.423955333 0.3717647 0.625 1.3375
x3 37.69901301 44.29203313 38.58823 48.97 38.125
x4 240 151.2285683 226.2745 106.72 240
g1 -3.03143E-08 -0.001909351 -0.015247161 -0.179879 -1.2204375
g2 -5.13686E-05 -0.001409337 -0.003632986 -0.1578262 -0.9737875
g3 -0.083980743 -10.73604938 -3197.88573 97.90317616 -32047.958
g4 -8.56099E-09 -88.77143173 -13.7255 -133.28 0
F(X) 5804.506651 6047.076189 5970.541429 7981.569061 20400.1411
Akhmad Aminullah
GENETIC ALGORITHM
Akhmad Aminullah
Genetic Algorithm
Based on Darwinian Paradigm
Reproduction Competition
Survive Selection
no
Crossover
(recombination)
Mutation
Akhmad Aminullah
Start
Generation = 1
Initial
Population
FindFitness
Statistics
Scaling
For Generation = 2 to
MaxGeneration
Selection (mate1)
Selection (mate2)
If Rnd <=
CrossOverProbobality
No
yes
Crossover NoCrossover
New Individual
Replace
FindUnknowns
FindFitness
Statistics
Next
Generation
End
GA reproduction cycle
Convergence
When to stop
Basic principles 2
An individual is characterized by a set of parameters:
Genes
The genes are joined into a string: Chromosome
Reproduction
Survivor Selection
Genetic algorithm operator
Genetic algorithm is initialised with a population
of guesses. These are usually random and will
be speared throughout the search space.
Typically genetic algorithm uses three operators,
such as selection, crossover and mutation to
direct the population towards convergence at the
global optimum. (Coley, 1999)
Akhmad Aminullah
Encoding and decoding
GA starts with a set of population represented by
chromosomes. The encoding of a chromosome
is problem dependent. Since any possible data
structure can be used as encoding for the
creation of a search space to represent a given
problem, there are several ways to encode the
design variables, such as the binary encoding,
gray codes, direct encoding and tree based
encoding.
Akhmad Aminullah
Representation
1 1 0 1 0 0 1 0 1 1 0 1 1 1 0 0
Evaluation
Selection
Crossover
Mutation
Akhmad Aminullah
GA operators: 1-point
crossover
Choose a random point on the two parents
Split parents at this crossover point
Create children by exchanging tails
Pc typically in range (0.6, 0.9)
Crossover
Parent 1
1 1 0 1 0 0 1 0 1 1 0 1 1 1 0 0
Child
1 1 0 1 1 0 1 1 0 1 0 1 1 1 0 0
Parent 2
0 0 1 1 1 0 1 1 0 1 0 0 1 0 1 1
Akhmad Aminullah
Alternative Crossover
Operators
Performance with 1 Point Crossover depends on the
order that variables occur in the representation
more likely to keep together genes that are near
each other
Can never keep together genes from opposite
ends of string
This is known as Positional Bias
Can be exploited if we know about the structure
of our problem, but this is not usually the case
n-point crossover
Choose n random crossover points
Split along those points
Glue parts, alternating between parents
Generalisation of 1 point (still some positional bias)
Uniform crossover
Assign 'heads' to one parent, 'tails' to the other
Flip a coin for each gene of the first child
Make an inverse copy of the gene for the second child
Inheritance is independent of position
Reproduction Operators comparison
Cross point
• Two point crossover (Multi point crossover)
One-point crossover - Nature
1 2
1 2
2 1
2 1
Two-point crossover
Randomly two positions in the chromosomes are
chosen
Avoids that genes at the head and genes at the tail
of a chromosome are always split when
recombined
Uniform crossover
A random mask is generated
The mask determines which bits are copied from one parent and
which from the other parent
Bit density in mask determines how much material is taken from the
other parent (takeover parameter)
Uniform crossover
Before
1 1 0 1 1 0 1 1 0 1 0 1 1 1 0 0
After
1 1 0 1 1 0 1 0 0 1 0 1 1 1 0 0
Akhmad Aminullah
Crossover OR mutation?
Akhmad Aminullah
GA operators: Selection
Main idea: better individuals get higher chance
Chances proportional to fitness
Implementation: roulette wheel technique
Assign to each individual a part of the
roulette wheel
Spin the wheel n times to select n
A B fitness(A) = 3
C fitness(B) = 1
3/6 = 50% 2/6 = 33%
fitness(C) = 2
Parent/Survivor Selection
Strategies
Survivor selection
Always keep the best one
Elitist: deletion of the K worst
Probability selection : inverse to their fitness
Etc.
Parent/Survivor Selection
Akhmad Aminullah
Crossover Real Value
Crossover for real value GA used arithmetic crossover. Arithmetic
crossover performs a linear recombination of two genitors as defined by
two chromosomes:
C1 k11 , k 21 ,..., k n1 and C 2 k12 , k 22 ,..., k n2
The linear recombiniation between C1 and C2 produces the new
generation, C*1 and C*2,
C1* k11* , k 21* ,..., k n1* and C*2 k12* , k 22* ,..., k n2*
That are defined by
C1 k11 , k21 ,..., kn1 and C2 k1i* , k2i* ,..., kni*
Where k mi* is defined by:
i*
k mi max k mi if the chosen bit is equal to zero
i
k
k m k m min if the chosen bit is equal to one
m i
i
Where max and min are user-defined boundaries for the domain of the k m
variable, m varies from 1 to n and is a random number from 0 to 1
Akhmad Aminullah
Generation gap
Akhmad Aminullah
Constraints
Most optimization problems have constraints. The solution or set of
solutions which are obtained as the final result of an evolutionary
search must necessarily be feasible, that is, satisfy all constraints.
Taxonomy of constraints can be considered and composed of
(a) Number
(b) Metric
(c) Criticality
(d) Difficulty.
Akhmad Aminullah
An example after Goldberg ‘89 (1)
Random initialisation
Chromosome : 1 2 3 4 5 6
Fitness: 8 2 17 7 4 11
Running total: 8 10 27 34 38 49
N (1 N 49): 23
Selected: 3
Tournament
Binary tournament
Two individuals are randomly chosen; the fitter of the two is
selected as a parent
Probabilistic binary tournament
Two individuals are randomly chosen; with a chance p,
0.5<p<1, the fitter of the two is selected as a parent
Larger tournaments
n individuals are randomly chosen; the fittest one is
selected as a parent
Multi-criterion fitness
Multi-Criterion Fitness
Dominance and indifference
For an optimization problem with more than one objective
function (fi, i=1,2,…n)
given any two solution X1 and X2, then
X1 dominates X2 ( X1 X2), if
fi(X1) >= fi(X2), for all i = 1,…,n
Dominance Check
Multi-Criterion Fitness
Weighted sum
F(x)= w1f1(x1) + w2f2(x2) +…+wnfn(xn)
Problems?
Convex and convex Pareto optimal front
Sensitive to the shape of the Pareto-optimal
front
Selection of weights?
Need some pre-knowledge
Not reliable for problem involving uncertainties
Multi-Criterion Fitness
Optimizing single objective
Maximize: fk(X)
Subject to:
fj(X) <= Ki, i <> k
X in F where F is the solution space.
Multi-Criterion Fitness
Weighted sum
F(x)= w1f1(x1) + w2f2(x2) +…+wnfn(xn)
Problems?
Convex and convex Pareto optimal front
Sensitive to the shape of the Pareto-optimal
front
Selection of weights?
Need some pre-knowledge
Not reliable for problem involving uncertainties
Multi-Criterion Fitness
Preference based weighted sum
(ISMAUT Imprecisely Specific Multiple Attribute Utility Theory)
F(x) = w1f1(x1) + w2f2(x2) +…+wnfn(xn)
Preference
Given two know individuals X and Y, if we prefer X than Y,
then
F(X) > F(Y),
that is
w1(f1(x1)-f1(y1)) +…+wn(fn(xn)-fn(yn)) > 0
Multi-Criterion Fitness
All
the preferences constitute a linear space
Wn={w1,w2,…,wn}
w1(f1(x1)-f1(y1)) +…+wn(fn(xn)-fn(yn)) > 0
w1(f1(z1)-f1(p1)) +…+wn(fn(zn)-fn(pn)) > 0, etc
s.t. : Wn
s.t. : Wn
Multi-Criterion Fitness
Then,
0 Y' Y' '
Reproduction:
Generational: as described before (insects)
Generational with elitism: fixed number of most fit
individuals are copied unmodified into new generation
Steady state: two parents are selected to reproduce
and two parents are selected to die; two offspring are
immediately inserted in the pool (mammals)
Other parameters of GA 2
Stop criterion:
Number of new chromosomes
Number of new and unique chromosomes
Number of generations
Measure:
Best of population
Average of population
Duplicates
Accept all duplicates
Avoid too many duplicates, because that degenerates the
population (inteelt)
No duplicates at all
Example run
Maxima and Averages of steady state and
generational replacement
45 St_max
40 St_av.
Ge_max
35
Ge_av.
30
25
20
15
10
5
0
0 5 10 15 20
Example
b
Encode
B = 60 H = 90 B = 60 H = 90
1 0 1 1 1 0 1 0 1 1 1 0
B = 20 H = 70 B = 20 H = 70
0 0 1 1 0 0 0 0 1 1 0 0
Function
Smallest Weigh W
B = 20 H = 70 B = 60 H = 90
0 0 1 1 0 0 1 0 1 1 1 0
B = 10 H = 70 B = 60 H = 70
0 0 0 1 0 0 1 0 1 1 0 0
Example of GA
Result
Bridge Structure
Bridge Structure
3D Bridge Structure
Final Configuration
Application to Office Building
Steps
Steps
Final Result