Beruflich Dokumente
Kultur Dokumente
Genetic Algorithms
1
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
GA Quick Overview
Genetic Algorithms
2 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Genetic algorithms
Genetic Algorithms
3 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
SGA technical summary tableau
Genetic Algorithms
4 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Representation
Genetic Algorithms
5 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
SGA reproduction cycle
Genetic Algorithms
6 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
SGA operators: 1-point crossover
Genetic Algorithms
7 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
SGA operators: mutation
Genetic Algorithms
8 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
SGA operators: Selection
B
C 2/6 = 33% Fitness(A) 3
1/6 = 17%
Fitness(B) 2
A Fitness(C) 1
3/5 = 50 %
Genetic Algorithms
9 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
An example after Goldberg „89 (1)
Genetic Algorithms
10 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
X2 example: selection
Genetic Algorithms
11 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
X2 example: Crossover
Genetic Algorithms
12 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
X2 example: Mutation
Genetic Algorithms
13 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
The simple GA
Genetic Algorithms
14 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Alternative Crossover Operators
Genetic Algorithms
15 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
n-point crossover
Genetic Algorithms
16 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Uniform crossover
Genetic Algorithms
17 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Crossover OR mutation?
Genetic Algorithms
18 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Crossover OR mutation? (cont‟d)
Genetic Algorithms
19 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Crossover OR mutation? (cont‟d)
Genetic Algorithms
20 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Other representations
Genetic Algorithms
21 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Integer representations
Genetic Algorithms
22 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Real valued problems
Genetic Algorithms
23 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Mapping real values on bit strings
z [x,y] represented by {a1,…,aL} {0,1}L
y x L1
(a1 ,..., aL ) x L
( aL j 2 j ) [ x, y ]
2 1 j 0
Only 2L values out of infinite are represented
L determines possible maximum precision of solution
High precision long chromosomes (slow evolution)
Genetic Algorithms
24 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Floating point mutations 1
x x1 , ..., xl x x1 , ..., xl
xi , xi LBi , UBi
Uniform Mutation
Genetic Algorithms
25 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Floating point mutations 2
Non-uniform mutations:
Many methods proposed, such as time-varying range of change
etc.
Most schemes are probabilistic but usually only make a small
change to value
Most common method is to add random deviate to each variable
separately, taken from N(0, ) Gaussian distribution and then
curtail to range
Standard deviation controls amount of change (2/3 of drawings
will lie in range (- to + )
Genetic Algorithms
26 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Crossover operators for real valued GAs
Discrete:
each allele value in offspring z comes from one of its parents (x,y)
with equal probability: zi = xi or yi
Could use n-point or uniform
Intermediate
exploits idea of creating children “between” parents (hence a.k.a.
arithmetic recombination)
zi = xi + (1 - ) yi where :0 1.
The parameter can be:
• constant: uniform arithmetical crossover
• variable (e.g. depend on the age of the population)
• picked at random every time
Genetic Algorithms
27 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Single arithmetic crossover
x1 , ..., xk , yk (1 ) xk , ..., xn
Reverse for other child. e.g. with = 0.5
Genetic Algorithms
28 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Simple arithmetic crossover
x , ..., x , y (1 ) x , ..., y (1 ) x
1 k k 1 k 1 n n
reverse for other child. e.g. with = 0.5
Genetic Algorithms
29 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Whole arithmetic crossover
Genetic Algorithms
30 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Permutation Representations
Genetic Algorithms
31 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Permutation representation: TSP example
Problem:
• Given n cities
• Find a complete tour with minimal
length
Encoding:
• Label the cities 1, 2, … , n
• One complete tour is one
permutation (e.g. for n =4 [1,2,3,4],
[3,4,2,1] are OK)
Search space is BIG:
for 30 cities there are 30! 1032
possible tours
Genetic Algorithms
32 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Mutation operators for permutations
Genetic Algorithms
33 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Insert Mutation for permutations
Genetic Algorithms
34 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Swap mutation for permutations
Genetic Algorithms
35 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Inversion mutation for permutations
Genetic Algorithms
36 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Scramble mutation for permutations
Genetic Algorithms
37 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Crossover operators for permutations
12345 12321
54321 54345
Genetic Algorithms
38 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Order 1 crossover
Genetic Algorithms
39 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Order 1 crossover example
Genetic Algorithms
40 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Partially Mapped Crossover (PMX)
Informal procedure for parents P1 and P2:
Genetic Algorithms
41 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
PMX example
Genetic Algorithms
42 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Cycle crossover
Basic idea:
Each allele comes from one parent together with its position.
Informal 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
Genetic Algorithms
43 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Cycle crossover example
Genetic Algorithms
44 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Edge Recombination
Genetic Algorithms
45 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Edge Recombination 2
Genetic Algorithms
46 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Edge Recombination example
Genetic Algorithms
47 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Multi-parent recombination
Recall that we are not constricted by the practicalities of
nature
Noting that mutation uses n = 1 parent, and “traditional”
crossover n = 2, the extension to n > 2 is natural to
examine
Been around since 1960s, still rare but studies indicate
useful
Three main types, based on:
Allele frequencies
Segmentation and recombination of the parents
Numerical operations on real-valued alleles
Genetic Algorithms
48 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Multi-parent recombination, type 1
Genetic Algorithms
49 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Multi-parent recombination, type 2
• Idea: segment and recombine parents
Example: diagonal crossover for n parents:
Choose n-1 crossover points (same in each parent)
Compose n children from the segments of the parents in along a
“diagonal”, wrapping around
Genetic Algorithms
50 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Multi-parent recombination, type 3
Genetic Algorithms
51 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Population Models
SGA uses a Generational model:
each individual survives for exactly one generation
the entire set of parents is replaced by the offspring
At the other end of the scale are Steady-State models:
one offspring is generated per generation,
one member of population replaced,
Generation Gap
the proportion of the population replaced
Makes a parameterized transition between generational and
steady-state GAs
Parameter = 1.0 for GGA, = 1/pop_size for SSGA
The name SSGA is often used for any GA with a
generation gap < 1
Genetic Algorithms
52 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Fitness Based Competition
Genetic Algorithms
53 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Implementation example: SGA
Genetic Algorithms
54 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Fitness-Proportionate Selection
Problems include
One highly fit member can rapidly take over if rest of population is
much less fit: Premature Convergence
At end of runs when fitnesses are similar, loss of selection pressure
Highly susceptible to function transposition
Scaling can fix last two problems
Windowing: f’(i) = f(i) - t
Genetic Algorithms
55 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Function transposition for FPS
Genetic Algorithms
56 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Rank-based Selection
Genetic Algorithms
57 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Linear Ranking
Genetic Algorithms
58 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Exponential Ranking
Genetic Algorithms
59 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Tournament Selection
Genetic Algorithms
60 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Tournament Selection 2
Genetic Algorithms
61 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Survivor Selection
Genetic Algorithms
62 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Two Special Cases
Elitism
Always keep at least one copy of the fittest solution so far
Widely used in both population models (GGA, SSGA)
GENITOR: a.k.a. “delete-worst”
From Whitley‟s original Steady-State algorithm (he also used linear
ranking for parent selection)
Rapid takeover : use with large populations or “no duplicates”
policy
Genetic Algorithms
63 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Example application of order based GAs: JSSP
Genetic Algorithms
64 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
Precedence constrained job shop scheduling GA
Genetic Algorithms
65 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing
JSSP example: operator comparison
Genetic Algorithms
66 / 66
A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing