Topics:
- Hill-climbing search
- Simulated Annealing
- Example: Simulated Annealing for TSP
Hill Climbing
- in state x choose the successor with the best heuristic value
- space requirements O(1)
- time complexity O(d)
- may not find the minimum cost solution
- may get stuck in local minima
beam search
- w is the beam width; at each step keep the best w alternatives
- w = b gives breadth-first search
- w = 1 gives hill climbing
The main problem with Hill Climbing is getting stuck in a local
minimum. Simulated annealing works as a hill-climbing search method
that allows moves in less good goal directions once in a while to
escape local minima.
The metaphore comes from annealing, the process of cooling material
in a heat bath. If the solid material is heated past its melting point
and then cooled down in a solid state, the structural properties of
the cooled solid depend on the rate of cooling. SLow cooling leads to
strong, large crystals. Fast cooling results in imperfections.
Suppose we have a minimization problem over a set of feasible
solutions and a cost function f which can be calculated for all
feasible solutions. The optimal solution could be calculated by
exhaustively searching the space, calculating f(s) and selecting the
minimum. In practice, the feasible solution space is often too large
for this to be feasible. Local optimization solves this by searching
only a small subset of the solution space. This is achieved by
defining a neighbourhood structure on the space and searching only the
neighbourhood of the current solution for an improvement. If there is
no improvement, the current solution is taken as an approximation of
the optimal solution. If there is an improvement, the current solution
is replaced by the improvement and the process is repeated. Simulated
annealing works essentially like this, except that the neighbourhood
is searched in a random way. A neighbour whose cost is worse than the
current solution may be accepted depending on a control parameter
called a temperature.
The Simulated Annealing Algorithm
- Select an initial temperature t_0 (a large number)
- Select an initial solution s_0
- Select a cost function f
- Select a neighbourhood structure for the solution space
- Select a temperature reduction function alpha( t )
- Repeat
- Repeat
- randomly select s in N(s_0)
- diff = f(s) - f(s_0)
- if diff > 0 then s_0 = s
- else generate random x in (0, 1) and if x < exp( -diff/t) then s_0 = s
- until iteration count = max_number_iteration
- t = alpha(t)
- until stopping condition
s_0 is the approximation solution
To apply simulated annealing to a problem, several devcisions need to
be made: choosing t_0, alpha(t), the stopping condition, the
neighbourhood structure, and the cost function
Cooling Schedules
- alpha(t) = a*t with a between 0.8 and 0.99
- alpha(t) = t / (1 + b*t), with b small (around 0)
- alpha(t) = c / log( 1 + k ), where c is a constant at least as
deep as the deepest local minimum and k the number of iterations. This
cooling schedule guarantees asymptotic convergence to the optimal
solution.
Example: Simulated Annealing for TSP
- the solution to TSP on n points is a permutation on n points
- there are n! possible solutions
- define a k-neighbourhood of a tour by removing k edges and replacing
them with k different edges so as to maintain the tour
- example: k = 2; remove links (vi, v_i+1), (v_j, v_j+1) and add
links (v_i, v_j) and (v_i+1, v_j+1)
- example: consider tour 58134276; the tour 58124376 is in its
k-neighbourhood
- a 2-neighbourhood of a tour is completely determined by the indices
i and j that denote the edges to be swapped with i < j (there is only
one way to reconnect the tour)
- there are n(n-1)/2 possibilities for choosing i and j (thus, a
2-neighbourhood) which is much smaller than the original space
- Lemma1: any tour can be obtained from any other tour by a sequence
of 2-neighbourhood changes. To see this consider the tour
123456789 and suppose you are interested in swapping edges 2 and 8 to
generate 183456729. You can do this in the following manner
123456789
123458769
123854769
183254769
183452769
183456729
- Lemma2: Any neighbourhood can be generated at random by generating 2
uniform numbers for i and j.
- Cost function: length of the tour; it can be computed incrementally
as d(v_i, v_j) + d(v_i+1, v_j+1) - d(v_i, v_i+1) - d(v_j+1, v_j)
- The simulated annealing solution for TSP is
- s_0 = generate random perturbation of indices
- t_0 = some large number
- Repeat
- select s in N(s_0) (i.e., select i and j)
- cost = d(v_i, v_j) + d(v_i+1, v_j+1) - d(v_i, v_i+1) - d(v_j+1, v_j)
- if cost > 0 then s_0 = s
- else generate random x in (0, 1); if x < exp(-cost/t) then s_0 = s
- t = t / (1 + b t)
- until stopping condition
Switch to:
vasilis@cs.dartmouth.edu