travelling salesman intro final

11
Travelling Salesman problem The Travelling Salesman Problem (TSP) is one of the most widely studied integer programming problems. It is an NP-hard problem in combinatorial optimization studied in operations research and theoretical computer science. Given a list of cities and their pair wise distances, the task is to find the shortest possible route that visits each city exactly once and returns to the origin city. It is a special case of the travelling purchaser problem. Although the TSP is conceptually simple, it is difficult to obtain an optimal solution. In an m-city situation, any permutation of m cities yields a possible solution. As a consequence, m! possible tours must be evaluated in the search space. Ideas related to the TSP have been around for a long time: In 1736, Leonard Euler studied the problem of finding a round trip through seven bridges in Konigsberg. In 1832, a handbook was published for German travelling salesmen, which included examples of tours. In the 1850s, Sir William Rowan Hamilton studied Hamiltonian circuits in graphs. He also marketed his ‘Icosian Game', based on finding tours in a graph with 20 vertices and 30 edges. Moving to the 20th century: In the early 1930s, Karl Menger discussed the problem with colleagues in Vienna and Harvard. In the late 1930s, the problem reappeared at Princeton University. Hassler Whitney called it the TSP. In the mid-1940s, the TSP was studied by several statisticians. In the late 1940s and early 1950s, it was studied intensively by researchers at the RAND Corporation.

Upload: saurabh-shah

Post on 17-Apr-2015

20 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Travelling Salesman Intro Final

Travelling Salesman problem

The Travelling Salesman Problem (TSP) is one of the most widely studied integer programming problems. It is an NP-hard problem in combinatorial optimization studied in operations research and theoretical computer science. Given a list of cities and their pair wise distances, the task is to find the shortest possible route that visits each city exactly once and returns to the origin city. It is a special case of the travelling purchaser problem. Although the TSP is conceptually simple, it is difficult to obtain an optimal solution. In an m-city situation, any permutation of m cities yields a possible solution. As a consequence, m! possible tours must be evaluated in the search space.

Ideas related to the TSP have been around for a long time:

In 1736, Leonard Euler studied the problem of finding a round trip through seven bridges in Konigsberg.

In 1832, a handbook was published for German travelling salesmen, which included examples of tours.

In the 1850s, Sir William Rowan Hamilton studied Hamiltonian circuits in graphs. He also marketed his ‘Icosian Game', based on finding tours in a graph with 20 vertices and 30 edges.

Moving to the 20th century:

In the early 1930s, Karl Menger discussed the problem with colleagues in Vienna and Harvard.

In the late 1930s, the problem reappeared at Princeton University. Hassler Whitney called it the TSP.

In the mid-1940s, the TSP was studied by several statisticians. In the late 1940s and early 1950s, it was studied intensively by

researchers at the RAND Corporation.

Definition

Given a set of cities and the cost of travel (or distance) between each possible pairs, the TSP, is to find the best possible way of visiting all the cities and returning to the starting point that minimize the travel cost (or travel distance).

Complexity

Page 2: Travelling Salesman Intro Final

Given n is the number of cities to be visited, the total number of possible routes covering all cities can be given as a set of feasible solutions of the TSP and is given as (n-1)!/2. There are two types of Travelling Salesman Problems :Symmetric TSP: In the symmetric TSP, the distance between two cities is the same in each opposite direction, forming an undirected graph. This symmetry halves the number of possible solutions.

Asymmetric TSP: In the asymmetric TSP, paths may not exist in both directions or the distances might be different, forming a directed graph. Traffic collisions, one-way streets, and airfares for cities with different departure and arrival fees are examples of how this symmetry could break down.

Application of TSP:

The main application of the TSP is to logistics. One may wish to find good routes or schedules for trucks, order-pickers in a warehouse, service engineers, aircraft, tourists etc.It has several applications even in its purest formulation, such as planning, logistics, and the manufacture of microchips. Slightly modified, it appears as a sub-problem in many areas, such as DNA sequencing. In these applications, the concept city represents, for example, customers, soldering points, or DNA fragments, and the concept distance represents travelling times or cost, or a similarity measure between DNA fragments. In many applications, additional constraints such as limited resources or time windows make the problem considerably harder.

TSP can be modeled as an undirected weighted graph, such that cities are the graph's vertices, paths are the graph's edges, and a path's distance is the edge's length. It is a minimization problem starting and finishing at a specified vertex after having visited each other vertex exactly once. Often, the model is a complete graph (i.e. each pair of vertices is connected by an edge). If no path exists between two cities, adding an arbitrarily long edge will complete the graph without affecting the optimal tour.

It is used as a benchmark for many optimization methods. Even though the problem is computationally difficult,[1] a large number of heuristics and exact methods are known, so that some instances with tens of thousands of cities can be solved.

Page 3: Travelling Salesman Intro Final

We will try and understand the problem of Travelling Salesman by Assignment problem.

Mr. Iyer is a saleman with Delite Manufacturing Company. He wants to visit 6 cities, say 1,2,3,4,5 and 6. Starting with city 1 where he is stationed. The distances between the various cities are given in table 1.

Mr. Iyer wants to develop a tour through the 5 other cities and return to his home city in such a way that he has to travel the minimum distance.

It may be noted that the matix of the distances between different cities is not a symmetrical one. For instance the distance from city 1 to 2 is not given to be the same as the distance from city 2 to 1.

Inter-City distance( in km)

The upper bound will be 25+28+14+12+8+39 = 126 km.

Page 4: Travelling Salesman Intro Final

To solve the problem of Mr. Iyer, we have used Branch and Bound procedure along with Assignment Problem of the minimization type.

To begin with, Mr. Iyer travels to the cities in the numerical orders listed and makes his tours as 1-2-3-4-5-6-1. On calculating, this distance comes out to be 126km (=25+28+14+12+8+39). If we consider this solution to be the feasible solution, we will take this as an upper bound limit to solve the problem. And the optimal solution should not increase this.

Let’s solve this problem step by step. First of all, we need to find a lower bound limit on this solution value.

Step 1: We will solve this problem with Assignment Problem method.

We will deduct the minimum distance from each value for all the 6 rows respectively. E.g. in Row 1, the minimum distance is 18. Here, we will deduct it from each value in the row. And so on for all the rows.

Reduced Cost Table # 1

Page 5: Travelling Salesman Intro Final

Step 2: We will assign each city with ‘the city with a 0’ if there is only one 0 in the row. The table will look as follows:

As we can see here, each city has been assign with city with a 0. Hence, the assignment will be as follows:

Assignments: 1-3; 2-1;3-4;4-2;5-6;6-5

Sub tours: 1-3-4-2-1; 5-6-5

Length: 65 km; 15km

Total length: 80 km

This 80 km will be assigned as a lower limit for the solution. Next we will try and reduce the difference between the upper bound and the lower bound limits. This will be done with the help of formulating and solving a series of Assignment Problems which will be aimed at reducing the upper bound and increasing the lower bound. Thus, it will reduce the gap between the two. And we will end when no more gap reduction is possible.

Step 3: Now we will resort to Branching and Bound method.

Reduced Cost Table # 2 And assignment

Page 6: Travelling Salesman Intro Final

We have to tak up the shortest of the sub tours, which 5-6-5. And resort to branching in such a way that by breaking and joining the sub tour, we can form a complete tour.

As we can see above, there are two branches possible: 5-6 and 6-5.

LB=80

Upper Bound = 126 km

Sub Tours:1-3-4-2-1 (65 km)5-6-5 ( 15 km)

Therefore, we break 5-6-5

Page 7: Travelling Salesman Intro Final

Step 4: Now we will take up the first sub route as 5-6.

We will take up the optimal solution that we obtained earlier and put up M in the 5-6 routes.

Now we will solve this as an assignment problem.

Therefore we first break 5-6Reduced Cost

Table # 1

Page 8: Travelling Salesman Intro Final

Now we got the assignments as follows:

Assignment: 1-3; 2-6;3-1;4-2;5-4;6-5

Sub tours: 1-3-1 and 2-6-5-4-2

Length: 40km and 44km

Total Length: 84km

Step 5: We will take up the optimal solution that we obtained earlier and put up M in the 6-5 route.

Now we will again solve this as an assignment problem.

Reduced Cost Table # 2 And assignment

Page 9: Travelling Salesman Intro Final

Now we first break 6-5Reduced Cost Table # 1

Reduced Cost Table # 2 And assignment

Page 10: Travelling Salesman Intro Final

Now we got the assignments as follows:

Assignment: 1-3;2-1;3-5;4-2;5-6;6-4

Tours: 1-3-5-6-4-2-1

Total Length: 87km

Now, the revised upper bound becomes 87km and revised lower bound 84km.

Reduced Cost Table # 3 and Assignment

Page 11: Travelling Salesman Intro Final

Step 6: For the lower bound, now we will make 2 further branches.

We will break the sub tour 1-3-1 into two further routes: 1-3 and 3-1.

We will take up the revised optimal solution that we obtained earlier and put up M in the 1-3 routes.

LB=80

Upper Bound = 126 kmRevised Upper Bound = 87 kmRevised Lower Bound = 84 km

Sub Tours:1-3-1 (40 km)2-6-5-4-2 ( 44 km)

Now we break the 1-3-1 sub tour

84

87 Tour

1-3-5-6-4-2-187 km

Page 12: Travelling Salesman Intro Final

Now we will solve this as an assignment problem.

Now we got the assignments as follows:

Assignment: 1-2; 2-6;3-1;4-3;5-4;6-5

Tour : 1-2-6-5-4-3-1

Now we first break 1-3Reduced Cost Table # 1

Reduced Cost Table # 2

Page 13: Travelling Salesman Intro Final

Total Length: 93km

Step 7:

We will take up the revised optimal solution that we obtained earlier and put up M in the 3-1 routes.

Now we will solve this as an assignment problem.

Now we first break 3-1Reduced Cost Table # 1

Page 14: Travelling Salesman Intro Final

Now we got the assignments as follows:

Assignment: 1-3; 2-1;3-6;4-2;5-4;6-5

Tour : 1-3-6-5-4-2-1

Reduced Cost Table # 2

Reduced Cost Table # 3

Page 15: Travelling Salesman Intro Final

Total Length: 90km

Step 8: Now there is a problem with the movement along this node. As the results obtained (90 and 93km) do not lie between the revised upper(87km) and lower bound(84km). And will make the sales man travel more than the upper bound.

Hence, it can be concluded that the revised upper bound cannot be reduced any further as there is no sub tour available.

The optimal solution to the problem is the tour in the order 1-3-5-6-4-2-1.

LB=80

Upper Bound = 126 kmLower Bound=80 kmRevised Upper Bound = 87 kmRevised Lower Bound = 84 km

Sub Tours:1-3-1 (40 km)2-6-5-4-2 ( 44 km)

Break 1-3-1

84

87

84

87

Sub Tours:1-3-4-2-1 (65 km)5-6-5 ( 15 km)

Therefore, we break 5-6-5

Initial

Revised LB

Revised UB

Not to be considered as the current UB is exceeded

Tour:1-2-6-5-4-3-1 (93 km)

Tour:1-3-6-5-4-2-1 (90 km)