Heuristic Techniques:
A Basic Introduction to Genetic Algorithms
Lecture 11
March 8, 2004
Olivier de Weck
Part 1 - Introduction
-Observe convergence
-Notice “mutants”
-Compare to gradient search
population gene
individuals
selection
crossover
insertion
mutation
genetic
operators
Generation n Generation n+1
11 © Massachusetts Institute of Technology - Prof. de Weck and Prof. Willcox
Engineering Systems Division and Dept. of Aeronautics and Astronautics
Chromosomes
Chromosome (string)
alleles gene
0 1 0 1 1 1 1 0 1 0 0 1 ….. 0 1
genotype phenotype
coded domain decision domain
expression
Biology UGCAACCGU
(“DNA” blocks) sequencing
“blue eye”
decoding
Design 10010011110 H
(chromosome) encoding
Genetic Code: (U,C,G,A are the four bases of the nucleotide
building blocks of messenger-RNA): Uracil-Cytosin- Radius R=2.57 [m]
Adenin-Guanin - A triplet leads to a particular aminoacid (for protein
synthesis) e.g. UGG-tryptophane
16 © Massachusetts Institute of Technology - Prof. de Weck and Prof. Willcox
Engineering Systems Division and Dept. of Aeronautics and Astronautics
Decoding
x1 x2 xn
0 1 0 1 1 1 1 0 1 0 0 1 ….. 0 1
10100011
(1*27+0*26+1*25+0*24+0*23+0*22+1*21+1*20)
128 + 0 + 32 + 0 + 0 + 0 + 2 + 1 = 163
1 6
4
city 5
2
3
Same problem,
The arcs The ordering but two different
chromosome
1 2 3 4 5 6 1 6 5 4 2 3 representations
6 3 1 2 4 5
7
6
5
9
8
12 10
11
13 14
• N-obj
• 1/obj
• -obj
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
29 © Massachusetts Institute of Technology - Prof. de Weck and Prof. Willcox
Engineering Systems Division and Dept. of Aeronautics and Astronautics
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 ?
Child
This is where
a b cd the word
crossover
comes from
Crossover produces ac
either of these results
for each chromosome 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
C2
C1
... Cn
P2
P1
P1 1 0 0 1 0 0 1 and 0 0 1 0 1 0 0 P2
Children
1 0 0 1 0 0 0
Create a path of children,
1 0 0 1 1 0 0 then select the best one.
1 2 3 4 5 1 2 3 4 5
5 3 1 2 4 2 4 5 3 1
5 4
2
1
3
Problem: 1 2 3 4 5
Naïve 1-point 5 3 1 3 1
crossover does not
produce a valid route. doesn’t work !!!
37 © Massachusetts Institute of Technology - Prof. de Weck and Prof. Willcox
Engineering Systems Division and Dept. of Aeronautics and Astronautics
Clever TSP crossover rule
Example:
3 7 8 6 1 9 2 4 5 Parent 1
8 2 6 9 4 5 3 1 7 Parent 2
subpath P
8 6 1 9 2 4 5 3 7 Child
• “Elitist” strategy
- small number of fittest individuals survive unchanged
• “Hall-of-fame”
- remember best past individuals, but don’t use them for progeny
39 © Massachusetts Institute of Technology - Prof. de Weck and Prof. Willcox
Engineering Systems Division and Dept. of Aeronautics and Astronautics
Replacement schemes
• replace all
• replace worst
• replace parent
• replace random
• replace most similar there are others ….
Converged too
fast (mutation rate
too small?)
generation
Average performance of individuals in a
population is expected to increase, as good individuals
are preserved and bred and less fit individuals die out.
42 © Massachusetts Institute of Technology - Prof. de Weck and Prof. Willcox
Engineering Systems Division and Dept. of Aeronautics and Astronautics
GA Stopping Criteria
Some options: