Simulated Annealing on TSP
The traveling salesperson problem (TSP) is a well-studied optimization problem which finds the shortest
The performance of the Nearest Neighbour heuristic (NN) and Simulated Annealing (SA) is
SA provides better routes with lower total distance than NN, but takes longer to run and this holds across different problem sizes.
path connecting cities so that each city is visited exactly once. This is a minimization problem where the objective value to be minimized is the total distance travelled.
A solution of TSP with |
Using the formulation of Dantzig–Fulkerson–Johnson, the problem can be tackled with integer programming. Indeed branch and bound algorithms provide exact solutions to TSP, but since it is an NP-hard problem they can only process small problems containing only 40-60 cities.
Heuristic approaches provide a faster alternative. The simplest method proposed is the nearest neighbour heuristic which takes the salesperson to the nearest unvisited city at each step of the algorithm. Despite its simplicity the output solution is often sub-optimal, as you can see in figure below.
TSP can also be considered to be a permutation problem where the solution is a permutation of the set of cities . A local search algorithm would start at some initial random permutation and iteratively find neighbours of that permutation that improve the objective value. The simplest local search algorithm is the hill climbing method, where a random neighbouring permutation is chosen, provided that it reduces the total distance travelled. Hill climbing terminates when all neighbours of the current solution are worse. A weakness of this method is that it gets trapped in a local optimum and can not get unstuck because all neighbours of the current solution have worse objective
values.
To alleviate this, simulated annealing proposes that worse neighbouring solution should be accepted with probability , where is the deterioration in the objective value and is the "temperature" of the system, which gradually decreases over time/iterations, just like in metallurgical annealing. Initially when the temperature is high, the algorithm explores the solution space by accepting most solutions regardless of how bad they are, but over time
the algorithm becomes less tolerant of objective value deteriorations. A typical formula of temperature
decay is geometric; the temperature in the iteration is . Hill climbing
is a special case of simulated annealing with .
Simulated annealing maximizing a function with solution space |
Note that we still have not defined what a random neighbouring permutation is. Let
be the current permutation. To construct the proposed next permutation, two integers are randomly chosen so that the subpermutation is reversed; such an operation is also known as 2-opt. Another operation that is often applied in simulated annealing is the transporting operation where the subpermutation is transported after the subpermutation . A hybrid approach allows the operation to either be transportation or reversal/2-opt with probability for each operation. In the following figures you can see how current solutions (on the left) are transformed under these two operations to the next proposed permutations.
Reverse operation on nodes |
Transport operation on subpermutations |
The performance of the Nearest Neighbour heuristic (NN) and Simulated Annealing (SA) is
summarised in the table that follows.
|
|
Time(s) |
|
Time(s) |
|
Time(s) |
|
Time(s) |
NN |
2.06 |
4e-5 |
7.04 |
5e-4 |
9.11 |
2e-3 |
12.88 |
7e-3 |
SA |
1.9 |
1.4 |
5.73 |
7 |
8.41 |
13 |
11.82 |
30 |
Check the next blog post on how TSP can be solved using the Genetic Algorithm.
Comments
Post a Comment