Professional Documents
Culture Documents
Simulated Annealing: Petru Eles
Simulated Annealing: Petru Eles
Simulated Annealing: Petru Eles
Petru Eles
1
Petru Eles, 2010
Outline
Neighborhood Search
Greedy Heuristics
Theoretical Foundation
Hardware/Software
Partitioning
2
Petru Eles, 2010
Neighborhood Search
Move
Neighbour
Solution
3
Petru Eles, 2010
Neighborhood Search
Problems:
Moves
Neighbour
Move
4
Petru Eles, 2010
5
Petru Eles, 2010
Greedy Heuristics
6
Petru Eles, 2010
Greedy Heuristics
Greedy heuristics always move from the current solution to the best
neighboring solution.
Heuristic Algorithms for Combinatorial Optimization Problems
Simulated Annealing
7
Petru Eles, 2010
Greedy Heuristics
Local optimum
8
Petru Eles, 2010
Hill Climbing
Local optimum
In
Global optimum
9
Petru Eles, 2010
manner
10
Petru Eles, 2010
Metropolis - 1953:
A solid material is heated past its melting point and then cooled
back into a solid state (annealing).
11
Petru Eles, 2010
Metropolis - 1953:
A solid material is heated past its melting point and then cooled
back into a solid state (annealing).
The final structure depends on how the cooling is performed
12
Petru Eles, 2010
According to thermodynamics:
is:
pE = eE
kT
13
Petru Eles, 2010
14
Petru Eles, 2010
Thermodynamic simulation
System states
Energy
Change of state
Temperature
Frozen state
SA Optimization
Feasible solutions
Cost
Neighboring solution
Control parameter
Solution (close to optimal)
15
Petru Eles, 2010
16
Petru Eles, 2010
Theoretical Foundation
a number of different
homogeneous chains
17
Petru Eles, 2010
Theoretical Foundation
For optimal convergence:
18
Petru Eles, 2010
Theoretical Foundation
For optimal convergence:
19
Petru Eles, 2010
SA Parameters
construct initial solution x0; xnow = x0
set initial temperature T = TI
repeat
for i = 1 to TL do
generate
randomly a
neighbouring
xnow
solution
x=x (accept new
elsenow
state)
N(x )
Generate q = random(0,1)
compute change of cost C = C(x) - C(xnow)
if q <
eC T then xnow =
if
C 0 then
x end if
end if
end for
set new temperature T = f(T)
until stopping criterion
return solution
corresponding to the minimum
Heuristic Algorithms for Combinatorial Optimization Problems
cost
function
Simulated Annealing
20
Petru Eles, 2010
SA Parameters
Two kinds of decisions have to be taken heuristically:
Generic decisions
problem.
problem.
21
Petru Eles, 2010
Generic Decisions
stopping criterion
cooling schedule
22
Petru Eles, 2010
starting solution
23
Petru Eles, 2010
Initial Temperature
24
Petru Eles, 2010
Initial Temperature
=
in
C ma x T
run:
-
25
Petru Eles, 2010
Initial Temperature
=
in
C ma x T
run:
-
But, in
any case,
Simulated
Annealing experimental tuning is needed!
26
Petru Eles, 2010
27
Petru Eles, 2010
f(T)
28
Petru Eles, 2010
29
Petru Eles, 2010
30
Petru Eles, 2010
An extreme approach:
f(T) = T/(1 + ),
31
Petru Eles, 2010
Stopping Criterion
32
Petru Eles, 2010
Neighborhood structure
:)
33
Petru Eles, 2010
Cost function
Should be calculated quickly - possibly
incrementally.
Generated randomly.
Good solution (possibly produced by another heuristics);
in this case the starting temperature should be lower.
34
Petru Eles, 2010
Postprocessin
g
Make sure that the local minimum close to the final solution is
reached: run a small, quick greedy optimization.
35
Petru Eles, 2010
Travelling Salesman
Hardware/Software
Partitioning
36
Petru Eles, 2010
A salesman has to travel to a number of cities and then return to the initial city;
each city has to be visited once. The objective is to find the tour with
minimum distance.
37
Petru Eles, 2010
If the problem consists of n cities ci, i = 1, .., n, any tour can be represented
as a permutation of numbers 1 to n.
d(ci,cj) = d(cj,ci) is the distance between ci and cj.
Given a permutation of the n cities, vi and vi+1 are adjacent cities in the
permutation. The permutation has to be found that minimizes:
n1
d (vi,vi + 1) + d (vn,v1)
i= 1
38
Petru Eles, 2010
TSP: Moves&Neighborhood
If k 2, there are several ways of reconnecting after the k links have been
removed.
For k = 2, there is only one way of reconnecting the tour after two links
have been removed.
39
Petru Eles, 2010
TSP: Moves&Neighborhood
With k = 2:
n(n - 1)/2
40
Petru Eles, 2010
TSP: Moves&Neighborhood
0
2
1
Permutation:
[0 2 4 6 7 5 3 1]
3
5
6
7
41
Petru Eles, 2010
TSP: Moves&Neighborhood
0
2
1
links (v3,v1), (v4,v6)
are removed
3
5
6
7
42
Petru Eles, 2010
TSP: Moves&Neighborhood
0
2
1
Permutation:
[0 2 4 3 5 7 6 1]
3
5
6
7
43
Petru Eles, 2010
TSP: Moves&Neighborhood
All 2-neighbors of a certain solution are defined by the pair i, j so that i < j.
44
Petru Eles, 2010
21255.
-
45
Petru Eles, 2010
46
Petru Eles, 2010
Output:
47
Petru Eles, 2010
Hardware
P8
P7
P3
P14
P11
P5
P2
P9
P13
P6
P1
P10
P4
P12
Software
48
Petru Eles, 2010
M C L K CL + M U K U + M P K P M S O K S O
i
K iCL
K iU
K iP
K SO
i
i
i
Nr_o pi
-------L_path i
op j SP i
--------- --
w op j
Nr_o pi
K iP
K iU
K iSO
49
Petru Eles, 2010
ij cut
E
1ij
W 2ijE
W 2 iN
W 1iN
i Hw
-------------+ Q2 ------------- Q3
N H ------------------------------ ----------------------------NH
-----i-j--
i Hw
Ratio
com/cmp
amount of
i
Sw
W2 N
NS
Difference of
average weights
Restrictions:
H
H_costi Max
iH
S_costi Max
iH
W Ni Lim1 i Hw
W Ni Lim1 i Sw
50
Petru Eles, 2010
Simple moves:
A node is randomly selected for being moved to the other
partition.
Improved move:
Together with the randomly selected node also some of its direct
neighbors are moved; a direct neighbor is moved together with the
se- lected node if its movement improves the cost function and does
not violate any constraint.
51
Petru Eles, 2010
repeated move of the same or similar node groups from one partition
to the other a reduction of the spectrum of visited solutions.
52
Petru Eles, 2010
Cooling schedules
number of
nodes
20
40
100
400
TI
TL
SM
IM
SM
400
500
500
1400
400
450
450
1200
90
200
500
7500
a
IM
SM
IM
75
0.96 0.95
150 0.98 0.97
200 0.98 0.97
2750 0.998 0.995
53
Petru Eles, 2010
IM
20
0.28
0.23
22%
40
1.57
1.27
24%
100
7.88
2.33
238%
400
4036
769
425%
speedup
SM
54
Petru Eles, 2010
10000
1000
100
10
0.1
10
20
40
100
400
1000
SM
IM
Heuristic Algorithms for Combinatorial Optimization Problems
Simulated Annealing
55
Petru Eles, 2010
75000
70000
65000
60000
55000
50000
45000
40000
35000
0
1000
2000
3000
4000
5000
6000
7000
Number of iterations
56
Petru Eles, 2010
75000
70000
65000
60000
55000
50000
45000
40000
35000
0
200
400
600
800
1000
1200
1400
Number of iterations
57
Petru Eles, 2010
Conclusions
58
Petru Eles, 2010