Example: Travelling Salesman Problem: To From 1 2 3 4 5 1 2 3 4 5
Example: Travelling Salesman Problem: To From 1 2 3 4 5 1 2 3 4 5
To
From 1 2 3 4 5
1 ∞ 5 8 4 5
2 5 ∞ 7 4 5
3 8 7 ∞ 8 6
4 4 4 8 ∞ 8
5 5 5 6 8 ∞
A travelling salesman, named Rolling Stone plans to visit five cities 1, 2, 3, 4 & 5. The
travel time (in hours) between these cities is shown below:
How should Mr. Rolling Stone schedule his touring plan in order to minimize the total
travel time, if he visits each city once a week?
Solution
After applying steps 1 to 4of the Hungarian method, we get the following assignments.
To
From 1 2 3 4 5
1 ∞ 1 3 1
2 1 ∞ 2 1
3 2 1 ∞ 2
4 3 ∞ 4
5 3 ∞
Number of lines (4) not equal to order of Matrix (5). So optimal condition not
satisfied.
Select the smallest element from all the uncovered elements (LOE=1). Subtract this
LOE from all the uncovered elements and add it to the elements, which lie at the
intersection of two lines. Thus, we obtain another reduced matrix for fresh assignment.
Repeating step 3 on the reduced matrix, we get the following assignments.
To
From 1 2 3 4 5
1 ∞ 2 1
2 ∞ 1 1
3 1 ∞ 2
4 3 ∞ 5
5 4 ∞
The above solution suggests that the salesman should go from city 1 to city 4, city 4 to
city 2, and then city 2 to 1 (original starting point). The above solution is not a solution to
the travelling salesman problem as he visits city 1 twice.
The next best solution can be obtained by bringing the minimum non-zero element, i.e.,
1 into the solution. Please note that the value 1 occurs at two places. We will consider
all the cases separately until the acceptable solution is obtained. To make the
assignment in the cell (2, 3), delete the row & the column containing this cell so that no
other assignment can be made in the second row and third column.
Now, make the assignments in the usual manner as shown in the following table.
He starts from city 1 and goes to city 4; from city 4 to city 2; from city 2 to city 3; from
city 3 to city 5; from city 5 to city 1.