Genetic Algorithms 01
Genetic Algorithms 01
Genetic Algorithms 01
Spring 2009
Outline
Representation of Individuals
Mutation
Recombination
Population Models
Parent Selection
Survivor Selection
Glossary
References
Representation of Individuals
Representation of Individuals
Binary representation
Integer representation
Real-valued representation
Permutations representation
Binary Representations
genes: 0 / 1
Binary Representation
x = 5 00101
Example:
z [1, 10]
We use 8 bits to represent real values in the domain
[1, 10] , i.e., we use 256 numbers
1 00000000 (0)
10 11111111 (255)
Binary Representations
Hamming distance:
Binary Representation
Binary coding of 0-7 :
0
1
2
3
4
5
6
7
000
001
010
011
100
101
110
111
Binary Representation
Gray coding of 0-7:
Gray coding is a representation
that ensures that consecutive
integers always have Hamming
distance one.
Gray coding is a mapping that
means that small changes in the
genotype cause small changes in
the phenotype (unlike binary
coding).
0
1
2
3
4
5
6
7
000
001
011
010
110
111
101
100
Binary Representation
Integer 0 1
2
3
4
5
6
7
Binary 000 001 010 011 100 101 110 111
Gray 000 001 011 010 110 111 101 100
G[i]= B[i]
: for largest i
G[i]= XOR(B[i+1], B[i])
: for i < largest i
B[i]= G[i]
: if for largest i
B[i] = XOR(B[i+1], G[i])
: for i < largest i
Denotes:
XOR(0, 0) = 0, XOR(0, 1) = 1,
XOR(1, 0) =1, XOR(1, 1) = 0
Binary Representation
Integers
Integer representations
Values may be
e.g. {0,1,2,3}
e.g. {North,East,South,West}
Integer representations
Real-valued Representation
Permutation Representations
invalid permutations!
Permutation Representations
based on adjacencies
Permutation Representations
location in a sequence
value of i th element denotes position in sequence
in which i th event occurs
Mutation
Mutation
behaviour of a GA depends on pm
Bitwise Mutation
flips bits
01 and 10
setting of pm depends on nature of problem,
typically between:
1 / pop_size
1 / chromosome_length
Random resetting
Creep Mutation
Random Resetting
Creep Mutation
random value
sampled from a distribution
symmetric around 0
with higher probability of small changes
controlled by parameters
setting of parameters important
Uniform Mutation
Non-Uniform Mutation with a Fixed Distribution
Uniform Mutation
Swap Mutation
Insert Mutation
Scramble Mutation
Inversion Mutation
Swap Mutation
Insert Mutation
Scramble Mutation
Inversion Mutation
Recombination
Recombination
Recombination
else
Recombination
One-Point Crossover
N-Point Crossover
Uniform Crossover
One-Point Crossover
N-Point Crossover
Generalisation of 1 point
Choose n random crossover points
Split along those points
Join parts, alternating between parents
N-Point Crossover
N=2
N=3
Uniform Crossover
Assume array: [0.35, 0.62, 0.18, 0.42, 0.83, 0.76, 0.39, 0.51, 0.36]
Positional bias
Distributional bias
Discrete Recombination
Intermediate or Arithmetic Recombination
Discrete Recombination:
Child 2:
<y1,...,yk, xk+1+(1-)yk+1,, xn+(1-)yn>
child1:
<x1,...,xk-1, yk+(1-)xk, xk+1,, xn>
child2:
<y1,...,yk-1, xk+(1-)yk, yk+1,, yn>
Child1 = . x + (1 ) . y
Child 2 = . y + (1 ) .x
=0.5
12321
54321
54345
Order Crossover
Cycle Crossover
Step 1
Step 2
Step 3
Edge Crossover
Edge Crossover
(once edge table is constructed)
1. Pick an initial element at random and put it in the
offspring
2. Set the variable current element = entry
3. Remove all references to current element from the table
4. Examine list for current element:
Parents: [1 2 3 4 5 6 7 8 9] and [9 3 7 8 2 6 5 1 4]
Order Crossover
Cycle crossover
Basic idea: Each allele comes from one parent together
with its position.
procedure:
1. Make a cycle of alleles from P1 in the following way.
(a) Start with the first allele of P1.
(b) Look at the allele at the same position in P2.
(c) Go to the position with the same allele in P1.
(d) Add this allele to the cycle.
(e) Repeat step b through d until you arrive at the first allele of P1.
2. Put the alleles of the cycle in the first child on the positions
they have in the first parent.
3. Take next cycle from second parent
Multi-Parent recombination
Multi-Parent recombination
Crossover OR mutation?
Crossover OR mutation?
Exploration: Discovering promising areas in the
Mutation is exploitative
Population Models
Population Models
Population Models:
Generational model
Steady state model
Generational Model
Generational Gap
Parent Selection
Selection Types
Parent Selection
Parent Selection
Selection scheme
Fitness-Proportionate, e. g.:
Ranking Selection
Tournament Selection
Fitness-Proportionate Selection
f i / j =1 f j
Premature Convergence
f(i) = f(i) -
where is worst fitness in this (last n) generations
Sigma Scaling:
Implementation
f1
f7
f2
f6
f3
f5
f4
m=7
fitness proportionate
ranking.
ai = 1 Psel (i )
i = 1,2,..., m
m: population size
Fitness
13477
12588
12363
12359
pi
0.265
0.248
0.243
0.243
ai
0.265
0.513
0.756
1.0
f4
f1
f3
f2
m=4
Ranking Selection
Ranking Selection
Linear Ranking
Linear Ranking
Tournament Selection
Ordinal based
RWS and SUS uses info on whole population
Tournament Selection
Tournament Selection
: population size
k: tournament size
Survivor Selection
Survivor Selection
reduces (m+l) to m
Survivor Selection
Age-Based Selection
FIFO
Replace random
Fitness-Based Selection
Elitism
GENITOR
Age-Based Replacement
FIFO
Replace random (not recommended)
Fitness-Based Replacement
Elitism
Glossary
Glossary
Glossary
Glossary
Glossary
References
References
The End