0% found this document useful (0 votes)
711 views

7.travelling Salesman Problem

An assignment problem involves assigning operations to operators where each operator performs one operation. It can be solved as a transportation problem where source and destination capacities are 1 using the Hungarian method. The travelling salesman problem, where a salesman must visit each city once before returning home, can also be formulated as an assignment problem to find the shortest route.

Uploaded by

Raghav Naagar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
711 views

7.travelling Salesman Problem

An assignment problem involves assigning operations to operators where each operator performs one operation. It can be solved as a transportation problem where source and destination capacities are 1 using the Hungarian method. The travelling salesman problem, where a salesman must visit each city once before returning home, can also be formulated as an assignment problem to find the shortest route.

Uploaded by

Raghav Naagar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Travelling Salesman Problem

Prof. Dr. V. Maitri


•Consider a travelling salesman who has to
visit a certain number of cities in his assigned
territory.
•For each city of his territory, he wishes to
visit each city once and only once and arrive
back in the city from where he started.
•He knows the distances (or cost or time) of
journey between every pair of cities, and
wishes to determine the tour schedule that
represents the least distance/ cost/ time.
•Such types of problems can be solved by the
assignment algorithm.
•The difference between a travelling salesman
problem and an assignment problem is that in an
assignment problem, different destinations are
assigned to different sources
•But in a travelling salesman problem, a
destination is assigned to a source.
•Then this destination becomes another source to
which we assign another destination, which in
turn becomes another source, and so on.
Ex
•A travelling salesman has to visit five cities.
•He wishes to start from a particular city, visit
each city once and then return to his
starting point.
•The travelling time (in hours) for each city
from a particular city is given
From/To A B C D E
A ∞ 5 8 4 5
B 5 ∞ 7 4 5
C 8 7 ∞ 8 6
D 4 4 8 ∞ 8
E 5 5 6 8 ∞
What is the sequence of visits of the salesman so
that the total travelling time is minimised?
Applying the Hungarian method to this problem,
we get
From/To A B C D E
A ∞ 0 2 0 0
B 0 ∞ 1 0 0
C 2 1 ∞ 3 0
D 0 0 3 ∞ 4
E 0 0 0 4 ∞
•As per the above assignment, the salesman
should travel from A to D, D to B, B to A, i.e.,
A D B A.
•The above solution is not a complete solution of
the travelling salesman problem as the salesman
returns to A without travelling through all the
cities.
• So, we proceed as follows
•Since the assignment of zeroes has not given the
solution of the travelling salesman problem, we
bring the next minimum non-zero element into
the solution.
•Thus, we obtain the next best solution by bringing
1 into the solution.
•Had there not been 1 in any cell, then take the
minimum, but greater than 1 value from amongst
all the values of the table.
•Here, we have 1 and it appears in two places in
this problem. One of these is chosen arbitrarily.
•Let us choose the cell (B, C) and form a rectangle
around the value in this cell and cross out the
zeroes in its row and column.
•Now, we apply the Hungarian method for the
assignment of zeroes. Thus,
From/To A B C D E
A ∞ 0 2 0 0
B 0 ∞ 1 0 0
C 2 1 ∞ 3 0
D 0 0 3 ∞ 4
E 0 0 0 4 ∞
Alternatively

From/To A B C D E
A ∞ 0 2 0 0
B 0 ∞ 1 0 0
C 2 1 ∞ 3 0
D 0 0 3 ∞ 4
E 0 0 0 4 ∞
•In the case of the first alternative, the
optimum assignment is A D A, but
this is not the solution of the travelling
salesman problem.
•In the case of the second alternative, the
optimum assignment is
A E C B D A
This is the complete solution for the
problem as starting from A, the salesman
returns to A visiting all the other cities.
The minimum time taken by him to travel to
all the cities is 5 + 6 + 7 + 4 + 4 = 26 hrs.
Summary – 1…

• In an assignment problem, the number of operations


is assigned to an equal number of operators where
each operator performs only one operation.
• So, an assignment problem may be considered as a
special type of transportation problem in which the
capacity of each of the sources as well as the
requirement of each of the destinations is taken as 1.
Summary - 1

•In an assignment problem, the given matrix


must necessarily be a square matrix, which is
not the condition for a transportation problem.
•Such problems are solved using the Hungarian
method, which is shorter and easier compared
to any other method of finding the optimal
solution
Summary – 2…
•There may be assignment problems where
maximisation is required to be done instead of
minimisation.
•To handle such a problem, we find the
opportunity loss matrix by subtracting the value
of each cell from the largest value chosen from
amongst all the given cells.
Summary - 2
• When the value of a cell is subtracted from the
highest value, it gives the loss of amount caused by
not getting the opportunity which would have given
the highest value.
• The matrix so obtained is known as the opportunity
loss matrix and is handled in the same way as the
minimisation problem
Summary - 3
• The assignment problem wherein the number of rows is not
equal to the number of columns is said to be an unbalanced
problem.
• Such a problem is handled by introducing dummy row(s) if
the number of rows is less than the number of columns and
dummy column(s) if the number of columns is less than the
number of rows.
• All elements for such a dummy row/column are taken as zero.
• The augmented problem is then solved by the Hungarian
method.
Summary - 4
• While assigning zeroes in an assignment problem, if we
neither find any row nor any column which has single zero,
then we first move row-wise and then column-wise to locate
a row/column having two (if not two, then three or more)
zeroes.
• Then a rectangle is formed arbitrarily around one of these
zeroes and the others are crossed.
• Alternatively, the zero around which the rectangle has been
made could have been crossed and the rectangle could have
been formed around any of the other zeroes.
• This leads to alternative optimum solutions
Summary - 5

• Sometimes, there may be restriction on assigning a


particular activity to a particular resource.
• Then a very large cost (or time or anything else
which is to be minimised) is considered and
represented by ∞ or M for such a restricted pair.
Summary – 6…
• The travelling salesman problem wherein there are
a certain number of cities to be visited by a
salesman in his assigned territory can also be
solved as an assignment problem.
• The only difference between the travelling
salesman problem and an assignment problem is
that in an assignment problem different
destinations are assigned to different sources.
Summary – 6…
• But in a travelling salesman problem, a destination is
assigned to a source and then that destination
becomes another source to which another
destination is assigned, and so on.
• This is because, in a travelling salesman problem, for
each city of his territory, the salesman wishes to visit
each city once and only once and arrive back at the
city from where he started. He wishes to determine
the tour schedule that represents the least
distance/cost/time.
Thanks

You might also like