Lecture 22: Travelling Salesman Problem

Lecture 22: Travelling Salesman Problem#

General Description#

For a network modeled as a directed graph \(G=(N,A)\), with \(N\) and \(A\) representing the set of nodes and arcs, respectively, the objective of a Travelling Salesman Problem is to develop a least cost route visiting every node exactly once, given that each arc \((i,j) \in A\) has a cost \(c_{ij}\).

Objective:

\[ \min_{\mathbf{x}} z = \sum_{(i,j)\in A} c_{ij}x_{ij} \]

Subject to:

\[\begin{split} \begin{aligned} \sum_{i \in T(j)} x_{ij} & = \sum_{k \in H(j)} x_{jk} & \ \forall \ j \in N \\ \sum_{i \in T(j)} x_{ij} & = 1 & \ \forall \ j \in N \\ \sum_{(i,j) \in S} x_{ij} & \leq |S| - 1 & \ \forall \ S \subset N, \ |S| \geq 2 \\ x_{ij} & \in \{0,1\} & \ \forall \ (i,j) \in A \\ \end{aligned} \end{split}\]

Here, \(T(i)\) represents the set of predecessor (tail) nodes of node \(i\), while \(H(i)\) represents the set of successor (head) nodes, defined as follows,

\[\begin{split} \begin{aligned} T(i) & = \{j; \ (j,i) \in A\} \\ H(i) & = \{j; \ (i,j) \in A\} \end{aligned} \end{split}\]

Note, \(x_{ij}\) represents traversal on arc \((i,j)\).

Note

\(\sum_{(i,j) \in S} x_{ij} \leq |S| - 1 \ \forall \ S \subset N, \ |S| \geq 2\) is a subtour elimination constraint preventing the optimisation model from yeilding a solution where the nodes are visited in separate, smaller tours instead of a single, large tour.

Example#

The post-master plans to visit 5 Post Offices (P.O.) in the Chennai Metropolitan Region. Given the distances between these post offices, in which order should the post-master visit each post office.

P.O.

1

2

3

4

5

1

0

10

15

20

25

2

10

0

35

25

30

3

15

35

0

30

20

4

20

25

30

0

15

5

25

30

20

15

0

  1. Formulate a linear optimisation model for this problem.

    Objective:

    \[\begin{split} \begin{aligned} \min_{\mathbf{x}} z & = 10x_{12} + 15x_{13} + 20x_{14} + 25x_{15} \\ & \ + 10x_{21} + 35x_{23} + 25x_{24} + 30x_{25} \\ & \ + 15x_{31} + 35x_{32} + 30x_{34} + 20x_{35} \\ & \ + 20x_{41} + 25x_{42} + 30x_{43} + 15x_{45} \\ & \ + 25x_{51} + 30x_{52} + 20x_{53} + 15x_{54} \end{aligned} \end{split}\]

    Subject to:

    \[\begin{split} \begin{aligned} x_{21} + x_{31} + x_{41} + x_{51} & = x_{12} + x_{13} + x_{14} + x_{15} \\ x_{12} + x_{32} + x_{42} + x_{52} & = x_{21} + x_{23} + x_{24} + x_{25} \\ x_{13} + x_{23} + x_{43} + x_{53} & = x_{31} + x_{32} + x_{34} + x_{35} \\ x_{14} + x_{24} + x_{34} + x_{54} & = x_{41} + x_{42} + x_{43} + x_{45} \\ x_{15} + x_{25} + x_{35} + x_{45} & = x_{51} + x_{52} + x_{53} + x_{54} \\ x_{21} + x_{31} + x_{41} + x_{51} & = 1 \\ x_{12} + x_{32} + x_{42} + x_{52} & = 1 \\ x_{13} + x_{23} + x_{43} + x_{53} & = 1 \\ x_{14} + x_{24} + x_{34} + x_{54} & = 1 \\ x_{15} + x_{25} + x_{35} + x_{45} & = 1 \\ x_{12} + x_{21} & \leq 1 \\ x_{13} + x_{31} & \leq 1 \\ x_{14} + x_{41} & \leq 1 \\ x_{15} + x_{51} & \leq 1 \\ x_{23} + x_{32} & \leq 1 \\ x_{24} + x_{42} & \leq 1 \\ x_{25} + x_{52} & \leq 1 \\ x_{34} + x_{43} & \leq 1 \\ x_{35} + x_{53} & \leq 1 \\ x_{45} + x_{54} & \leq 1 \\ x_{12} + x_{21} + x_{13} + x_{31} + x_{23} + x_{32} & \leq 2 \\ x_{12} + x_{21} + x_{14} + x_{41} + x_{24} + x_{42} & \leq 2 \\ x_{12} + x_{21} + x_{15} + x_{51} + x_{25} + x_{52} & \leq 2 \\ x_{13} + x_{31} + x_{14} + x_{41} + x_{34} + x_{43} & \leq 2 \\ x_{13} + x_{31} + x_{15} + x_{51} + x_{35} + x_{53} & \leq 2 \\ x_{14} + x_{41} + x_{15} + x_{51} + x_{45} + x_{54} & \leq 2 \\ x_{23} + x_{32} + x_{24} + x_{42} + x_{34} + x_{43} & \leq 2 \\ x_{23} + x_{32} + x_{25} + x_{52} + x_{35} + x_{53} & \leq 2 \\ x_{24} + x_{42} + x_{25} + x_{52} + x_{45} + x_{54} & \leq 2 \\ x_{34} + x_{43} + x_{35} + x_{53} + x_{45} + x_{54} & \leq 2 \\ x_{12} + x_{21} + x_{13} + x_{31} + x_{14} + x_{41} + x_{23} + x_{32} + x_{24} + x_{42} + x_{34} + x_{43} & \leq 3 \\ x_{12} + x_{21} + x_{13} + x_{31} + x_{15} + x_{51} + x_{23} + x_{32} + x_{25} + x_{52} + x_{35} + x_{53} & \leq 3 \\ x_{12} + x_{21} + x_{14} + x_{41} + x_{15} + x_{51} + x_{24} + x_{42} + x_{25} + x_{52} + x_{45} + x_{54} & \leq 3 \\ x_{13} + x_{31} + x_{14} + x_{41} + x_{15} + x_{51} + x_{34} + x_{43} + x_{35} + x_{53} + x_{45} + x_{54} & \leq 3 \end{aligned} \end{split}\]
  2. Solve the above linear optimisation model using a spreadsheet to find the optimal solution.

    The optimal tour is 1-2-4-5-3-1, rendering a total distance traveled of 85kms.


Note

As seen in our 5-node problem, we have 35 constraints. As the problem size increases, the number of constraints grows exponentially, making direct solution approaches computationally expensive. To address this, researchers have developed exact optimization methods such as Branch-and-Bound (B&B) and Branch-and-Price (which combines Column Generation with B&B). These methods decompose the problem into smaller subproblems and iteratively refine solutions to find the global optimum efficiently. However, for large instances, exact methods may still be computationally prohibitive. In such cases, heuristic and metaheuristic approaches, including Nearest Neighbor, Genetic Algorithms, Simulated Annealing, and Ant Colony Optimization, provide near-optimal solutions in a reasonable time. In the next module, we will explore some of these heuristic approaches.