Beruflich Dokumente
Kultur Dokumente
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
Genetic Algorithms
A dumb solution
A blind generate and test algorithm:
Repeat
Generate a random possible solution
Test the solution and see how good it is
Genetic Algorithms
Sometimes - yes:
if there are only a few possible solutions
and you have enough time
then such a method could be used
Genetic Algorithms
A less-dumb idea
(GA)
Generate a set of random solutions
Repeat
Test each solution in the set (rank them)
Remove some bad solutions from set
Duplicate some good solutions
make small changes to some of them
Genetic Algorithms
10
Genetic Algorithms
11
Genetic Algorithms
12
Genetic Algorithms
Selecting Parents
13
Genetic Algorithms
Example population
No.
1
2
3
4
5
6
7
8
Chromosome
1010011010
1111100001
1011001100
1010000000
0000010000
1001011111
0101010101
1011100111
14
Fitness
1
2
3
1
3
5
1
2
Genetic Algorithms
Roulette Wheel
Selection
1
1
3
2
4
3
6
3
7
5
Rnd[0..18]=7
Rnd[0..18]=12
Chromosome4
Chromosome6
Parent1
Parent2
15
8
2
18
Genetic Algorithms
Crossover Recombination
1011011111
1010000000
Parent1
Offspring1
1001011111
Parent2
Offspring2 1010000000
Crossover
singlepoint
random
Withsomehighprobability(crossover
rate)applycrossovertotheparents.
16
Genetic Algorithms
Mutation
Offspring1
1011011111
mutate
Offspring1
1011001111
Offspring2 1000000000
Offspring2 1010000000
Originaloffspring
Mutatedoffspring
Withsomesmallprobability(themutationrate)flip
eachbitintheoffspring(typicalvaluesbetween0.1
and0.001)
17
Genetic Algorithms
Genetic Algorithms
Many Variants of GA
Different recombination
Multi-point crossover
3 way crossover etc.
Tournament
Elitism, etc.
Integer values
Ordered set of symbols
19
Genetic Algorithms
20
Genetic Algorithms
21
Genetic Algorithms
Classes of Search
Techniques
S e a rc h te c h n iq u e s
C a lc u lu s - b a s e d t e c h n iq u e s
D ir e c t m e t h o d s
F in o n a c c i
G u id e d ra n d o m s e a rc h te c h n iq u e s
I n d ir e c t m e t h o d s
N e w to n
E v o lu tio n a ry a lg o rith m s
E v o lu t io n a r y s t r a t e g ie s
D y n a m ic p r o g r a m m in g
G e n e tic a lg o rith m s
P a ra lle l
C e n tra liz e d
S im u la t e d a n n e a lin g
E n u m e r a t iv e t e c h n iq u e s
D is trib u te d
22
S e q u e n tia l
S te a d y -s ta te
G e n e ra tio n a l
Genetic Algorithms
Components of a GA
A problem to solve, and ...
Encoding technique
(gene, chromosome)
Initialization procedure
(creation)
Evaluation function
(environment)
Selection of parents
(reproduction)
Genetic operators
(mutation, recombination)
Parameter settings
(practice and art)
23
Genetic Algorithms
Simple Genetic
Algorithm
{
initialize population;
evaluate population;
while TerminationCriteriaNotSatisfied
{
24
Genetic Algorithms
The GA Cycle of
Reproduction
reproduction
children
modified
children
parents
population
modification
evaluated children
evaluation
deleted
members
discard
25
Genetic Algorithms
Population
population
Chromosomes could be:
Bit strings
Real numbers
Permutations of element
Lists of rules
Program elements
... any data structure ...
26
Genetic Algorithms
Reproduction
reproduction
children
parents
population
Genetic Algorithms
Chromosome
Modification
children
modification
modified children
Genetic Algorithms
Evaluation
evaluated
children
modified
children
evaluation
Genetic Algorithms
Deletion
population
discarded members
discard
Generational GA:
entire populations replaced with each iteration
Steady-state GA:
a few members replaced each generation
30
Genetic Algorithms
An Abstract Example
Genetic Algorithms
A Simple Example
32
Genetic Algorithms
A Simple Example
The Traveling Salesman Problem:
Find a tour of a given set of cities so that
each city is visited only once
the total distance traveled is minimized
33
Genetic Algorithms
Representation
Representation is an ordered list of city
numbers known as an order-based GA.
1) London
2) Venice
3) Dunedin
4) Singapore
5) Beijing 7) Tokyo
6) Phoenix 8) Victoria
CityList1
(3 5 7 2 1 6 4 8)
CityList2
(2 5 7 6 8 1 3 4)
34
Genetic Algorithms
Crossover
Crossover combines inversion and
recombination:
Parent1
Parent2
Children1
Children2
(3 5 7 2 1 6 4 8)
(2 8 7 6 8 1 3 4)
(3 5 7 6 8 1 3 4)
(2 8 7 2 1 6 3 4)
35
Genetic Algorithms
Mutation
Mutation changing the list:
Before:
*
*
(5 8 7 2 1 6 3 4)
After:
(5 8 6 2 1 7 3 4)
36
Genetic Algorithms
60
50
40
30
20
10
0
0
10
20
30
40
50
60
70
80
90
100
37
Genetic Algorithms
Solution i (Distance =
941)
TSP30 (Performance = 941)
100
90
80
70
60
50
40
30
20
10
0
0
10
20
30
40
50
60
70
80
90
100
38
Genetic Algorithms
Solution j(Distance =
800)
TSP30 (Performance = 800)
100
90
80
70
60
50
40
30
20
10
0
0
10
20
30
40
50
60
70
80
90
100
39
Genetic Algorithms
Solution k(Distance =
652)
TSP30 (Performance = 652)
100
90
80
70
60
50
40
30
20
10
0
0
10
20
30
40
50
60
70
80
90
100
40
Genetic Algorithms
60
50
40
30
20
10
0
0
10
20
30
40
50
60
70
80
90
100
41
Genetic Algorithms
Overview of
Performance
TSP30 - Overview of Performance
1600
1400
D ista n c e
1200
1000
800
600
400
200
0
1
11
13
15
17
19
Generations (1000)
42
21
23
25
27
29
31
Best
Worst
Average
Genetic Algorithms
Considering the GA
Technology
Almost eight years ago ...
people at Microsoft wrote
a program [that] uses
some genetic things for
finding short code
sequences. Windows 2.0
and 3.2, NT, and almost all
Microsoft applications
products have shipped
with pieces of code created
by that system.
- Nathan Myhrvold, Microsoft Advanced
Technology Group, Wired, September 1995
43
Genetic Algorithms
Issues for GA
Practitioners
representation
population size, mutation rate, ...
selection, deletion policies
crossover, mutation operators
Termination Criteria
Performance, scalability
Solution is only as good as the evaluation
function (often hardest part)
44
Genetic Algorithms
Benefits of Genetic
Algorithms
45
Genetic Algorithms
Genetic Algorithms
When to Use a GA
Genetic Algorithms
Some GA Application
Types
D
o
m
a
i
n
A
p
p
l
i
c
a
t
i
o
n
T
y
p
e
s
g
a
s
p
i
p
e
l
i
n
e
,
p
o
l
e
b
a
l
a
n
c
i
n
g
,
m
i
s
s
i
l
e
e
v
a
s
i
o
n
,
p
u
r
s
u
i
t
C
ontrol
s
e
m
i
c
o
n
d
u
c
t
o
r
l
a
y
o
u
t
,
a
i
r
c
r
a
f
t
d
e
s
i
g
n
,
k
e
y
b
o
a
r
d
D
esign cm
oannfiu
gfu
racattuio
n
,
c
o
m
m
u
n
i
c
a
t
i
o
n
n
e
t
w
o
r
k
s
r
i
n
g
,
f
a
c
i
l
i
t
y
s
c
h
e
d
u
l
i
n
g
,
r
e
s
o
u
r
c
e
a
l
o
c
a
t
i
o
n
Scheduling trajectoryplanning
R
obotics designingneuralnetworks,improvingclassification
M
achineLearning afilltgeorrdithem
s
,
c
l
a
s
s
i
f
i
e
r
s
y
s
t
e
m
s
SignalProcessing poker,cshigenckers,prisonersdilemma
G
am
ePlaying setcovering,travelingsalesman,routing,binpacking,
C
om
binatorial graphcolouringandpartitioning
O
ptim
ization
48
Genetic Algorithms
Conclusions
Question:
Answer:
Genetic algorithms are rich - rich in
application across a large and growing number of
disciplines.
- David E. Goldberg, Genetic Algorithms in Search, Optimization and Machine Learning
49
Genetic Algorithms