Professional Documents
Culture Documents
Genetic Algorithms (GA) OVERVIEW
Genetic Algorithms (GA) OVERVIEW
local
Genetic Algorithms (GA) OVERVIEW
A standard method of finding maxima or
minima is via the “gradient decent” global
(gradient ascent) method.
local
I found
the top!
My height
My height is 7.5m
is 3.6m
I found
A climber has approached the
the top!
“global maximum”
Genetic Algorithms (GA) OVERVIEW
o A class of probabilistic optimization algorithms.
o Inspired by the biological evolution process.
o Uses concepts of “Natural Selection” and “Genetic
Inheritance” (Darwin 1859).
o Originally developed by John Holland (1975).
o Particularly well suited for hard problems where
little is known about the underlying search space.
o Widely-used in business, science and engineering.
Genetic Algorithms (GA) OVERVIEW
–Evolutionary Computation (EC)
–Evolutionary Algorithms (EA)
Short
Tall Tall
Phenotype:
A board’s configuration ..
Genotype:
Obvious mapping
A permutation of
the numbers 1 : 8 1 3 5 2 6 4 7 8
A Basic Example ..
The 8 Queens Problem: Fitness
Function (Evaluation) ..
1 3 5 2 6 4 7 8 1 3 5 4 2 8 7 6
8 7 6 5 4 3 2 1 8 7 6 2 4 1 3 5
A Basic Example ..
The 8 Queens Problem: Mutation ..
1 3 5 2 6 4 7 8 1 3 7 2 6 4 5 8
A Basic Example ..
The 8 Queens Problem: Parents’ Selection
for Replacement ..
An Early Phase:
Quasi-random population distribution.
A Middle Phase:
Population arranged around/on hills.
A Late phase:
Population concentrated on high hills.
Simple Genetic Algorithm
parents
selection modification
modified
offspring
initiate &
population evaluation
evaluate evaluated offspring
deleted
members
discard
Simple Genetic Algorithm
The Evolutionary Cycle
Initialize Population (initialization)
Examples:
o A pre-determined number of generations or time has
elapsed.
o A satisfactory solution has been achieved.
o No improvement in solution quality has taken place for
a pre-determined number of generations.
Typical Run: Progression of Fitness
generation
Lecture 6 [ PART B ]
Beyond Classical Search:
Evolutionary Computation [ Genetic Algorithms ]
Dr. Amr S. Ghoneim
(Computer Science Department)
Helwan University
Fall 2020
population
individual gene
selection
crossover
insertion
mutation
genetic
operators
alleles gene
0 1 0 1 1 1 1 0 1 0 0 1 ….. 0 1
decoding H
Design 10010011110
(chromosome) encoding
Radius R = 2.57 [m]
x1 x2 xn
0 1 0 1 1 1 1 0 1 0 0 1 … .. 0 1
.. BUT ..
probability to be chosen
Before crossover:
s1` = 1111010101 s5` = 0100010011
s2` = 1110110101 s6` = 1110111101
After crossover:
s1`` = 1110110101 s5`` = 0100011101
s2`` = 1111010101 s6`` = 1110110011
Example ..
theMAXONE problem .. Mutation
The final step is to apply random mutation: for each bit
that we are to copy to the new population we allow a small
probability of error (for instance 0.1)
Before applying mutation:
s1`` = 1110110101
s2`` = 1111010101
s3`` = 1110111101
s4`` = 0111000101
s5`` = 0100011101
s6`` = 1110110011
Example ..
theMAXONE problem .. Mutation
initialization?
F
F: fitness after smart initialisation
T
Time (Number of Generations)
Answer:
- it depends. Possibly, if good solutions/methods exist ..
Components of GA ..
Selection
6 Sum of individual's
Sum
3 selection probabilities
Example: Let D j P
1 j
select the kth most fit member of a population
1
to be a parent with probability Pk D1
k
Better ranking has a higher probability of being chosen,
e.g. 1st 1, 2nd 1/2, 3rd 1/3 ...
Components of GA ..
Selection .. Tournament Selection
2 members of current Dominant performer
population chosen randomly placed in intermediate
population of survivors
n
Population
Filled ?
y
Crossover and
Mutation form new
population
Old Population Fitness Survivors Fitness
101010110111 8 101010110111 8
100100001100 4 001000111110 6
001000111110 6 101010110111 8
Components of GA ..
Recombination (Crossover)
0 1 0 1 1 1 1 0 1 1 1 1 ….. 1 1 P1
1 1 1 0 0 1 0 0 0 1 0 1 ….. 0 0 P2
crossover
O1 ?
O2 ?
a b cd
ac OR ad OR bc OR bd
P1 0 1 1 0 1 0 1 1 1 1 O1
P2 1 0 0 1 1 1 0 0 0 1 O2
P1 0 1 1 0 1 0 1 1 1 1 C1
l = length
of chromosome
P2 1 0 0 1 1 1 0 0 0 1 C2
Results:
o Movement in the search space.
o Restoration of lost information to the population.
Components of GA ..
Elitism
Results:
Elitism can very rapidly increase performance of GA,
because it prevents losing the best found solution.
Components of GA ..
Evaluation (Fitness Function)
Example:
p1 = (1 2 3 4 5 6 7 8 9) and p2 = (4 5 2 1 8 7 6 9 3)
First, the segments between cut points are copied
into offspring:
o1 = (x x x 4 5 6 7 x x) and o2 = (x x x 1 8 7 6 x x)
Example:
The Traveling Salesman Problem (TSP)
(Crossover)
Next, starting from the second cut point of one parent,
the cities from the other parent are copied in the same
order.
The sequence of the cities in the second parent is:
9–3–4–5–2–1–8–7–6
After removal of cities from the first offspring we get:
9–3–2–1–8
This sequence is placed in the first offspring:
o1 = (2 1 8 4 5 6 7 9 3), and similarly in the second:
o2 = (3 4 5 1 8 7 6 9 2)
Example:
The Traveling Salesman Problem (TSP)
(Mutation: Inversion)
Example:
(1 2 3 4 5 6 7 8 9) is changed into (1 2 7 6 5 4 3 8 9)