Professional Documents
Culture Documents
Simulated Annealing
466
Zc
- TTTT
Zn
=
x
Larger T: probability of
Prob{acceptance} = ex
accepting is higher.
0.01
0.990
Simulated annealing starts
-0.25
0.779
with large T, enabling the
search to proceed in almost
-1
0.368
random directions, and
-3
0.050
gradually decreases it as the
-5
0.007
iterations proceed, in order to
emphasis on mostly climbing
upward.
A temperature schedule should be chosen.
Implementation of move selection rule: compare random
number between 0 and 1 to the probability of acceptance.
468
469
470
471
Solving problem
As Zn= 65 < Zc= 69, this is the next trial solution.
Joo M. C. Sousa, U. Kaymak, C.A. Silva, A. Moutinho
472
= e 2/ 13.8 = 0.865
473
Maximize
subject to
Zn Zc
T
f ( x 1 , , x n )
j =
U j Lj
6
reset x j = x j + N(0, j ), for j = 1, , n
L j x j U j , for j = 1, , n
474
Example
Genetic algorithms
Motivation
What evolution brought us?
Zn Zc 3055616 3714121
=
= 0.916
T
748224
Vision
Hearing
Smelling
Taste
Touch
Learning and reasoning
475
476
477
Genetic algorithms
Basic elements
478
479
Genetic algorithm
480
Encoding-crossover-mutation
10010110
01100010
10100100
10011001
01111101
...
...
...
...
Chromosome
1011 0110 1001
Gene
Crossover
10011110
10110010
10010010
10111110
Crossover point
Mutation
10011110
Joo M. C. Sousa, U. Kaymak, C.A. Silva, A. Moutinho
481
Binary encoding
(11, 6, 9)
Elitism
Selection
Crossover
Current
generation
Mutation bit
10011010
482
Mutation
10010110
01100010
10100100
10011101
01111001
...
...
...
...
Next
generation
483
Spaces in GA iteration
gene-space
generation N
01100
10001
11010
00111
11000
10110
Selection (reproduction)
fitness operators
problem-space
fitness-space
(de)coding
12
17
26
7
24
22
fitness function
34
48
23
15
41
50
Proportional selection:
p = 0.19
p = 0.23
p = 0.11
p = 0.07
p = 0.16
p = 0.24
genetic
operators
genes fitness
01100
34
10001
48
11010
23 reproduction
00111
15
11000
41
10110
50
genes
01100
10001
10001
11000
10110
10110
Sum = 211
generation N +1
01011
10111
11001
00011
11010
01010
Tournament selection:
Randomly select pairs
Fitter individual wins (deterministic or probabilistic)
484
485
486
487
Example: 1-2-3-4-5-6-7-1.
Initial population: generated randomly, using possible
links between cities.
488
489
490
492
Curiosities:
Ant colonies exist for more than 100 million years
Myrmercologists estimate that there are around 20 000 species of ants.
Joo M. C. Sousa, U. Kaymak, C.A. Silva, A. Moutinho
493
Food Source
Destination
nodes / arcs
environment is discrete
491
Artificial ants
494
Nest
Source
495
496
Mathematical framework
Choose node
ij ij
, if j
k
pij = ij ij
j
0, otherwise
Update Feasible Neighbourhood List
N =N\ j
Pheromone update
ij (l + 1) = ij (l ) (1 ) + ijk
1/ cij , if ant k travels from i to j
ijk =
0, otherwise
Initialization
Set ij = 0
For l =1: Nmax
Build a complete tour
For i = 1 to n
For k = 1 to m
Choose node
Update N
pijk = f ( ij )
Ant 1, t=0
12
13 +
j =2
Deposit pheromone
i =1
Ant 1, t=1
12
Environment (time)
updates pheromones
j =2
j =3
13
i =1
Ant 2, t=2
12
ij (t + 1) = ij (t ) (1 ) + k
ij
j =2
497
n cities (5)
Complexity: (n1)! / 2
2
2
end
end
Analyze solutions
For k = 1 to m
Compute fk
end
Update pheromones
end
17
17
5
5
498
499
Step #2
2
j =3
13
i =1
Step #1
Choose trail
Step #5
2
17
2
2
Step #3
2
Step #4
2
2
2
17
2
Joo M. C. Sousa, U. Kaymak, C.A. Silva, A. Moutinho
2
5
2
2
500
17
5
501
m ants
n cities
=1/d
vs
ACO balances the heuristic information with the
experience (pheromone) information
Joo M. C. Sousa, U. Kaymak, C.A. Silva, A. Moutinho
503
Step #3
32%
53%
22%
47%
46%
Step #5
Step #4
p12=31%
p13=16%
p14=22%
p15=31%
Step #2
Step #1
100%
Step #1
p12=31%
p13=16%
p14=22%
p15=31%
504
505
Step #2
39%
27%
34%
35%
65%
Step #4
Step #5
100%
Joo M. C. Sousa, U. Kaymak, C.A. Silva, A. Moutinho
f 2 = 2 + 5 + 5 + 2 + 2 = 10.47
506
507
(l + 1) = 0.5
0.5
0.5
Considering the pheromone dropped by the best ant of the present iteration
0.5 0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5 0.5
0
0
0
0.095
0.095
0
0
0.095
0
0
0.095
0
0
0
0
0
0
0
0
0
00.95
0
508
Step #3
32%
22%
29%
Step #5
Step #4
509
46%
p41=19%
p42=26%
p43=23%
p45=32%
Step #1
100%
Step #1
p21=26%
p23=29%
p24=26%
p25=19%
f1 = 2 + 2 + 2 + 5 + 5 = 10.47
510
511
24%
37%
24%
52%
Step #3
63%
Step #4
100%
f 2 = 5 + 5 + 2 + 2 + 2 = 10.47
512
513
0
0
0
0.095
0.095
0
0
0.095
0
0
0.095
0 0
0.095
0
0
0
0 0
0
0.095
0
0
0 + 0
0
0
0.095
0
00.95 0
0
0
0
00.95
0 0.095
0
0
0
0
0
0
0
0.095
0.095
0
0
0
0
0.095
0
0
0.095
0
0
0
0
0
0
0
00.95
0
514