Presentation is loading. Please wait.

Presentation is loading. Please wait.

Applied Combinatorics, 4th Ed. Alan Tucker

Similar presentations


Presentation on theme: "Applied Combinatorics, 4th Ed. Alan Tucker"— Presentation transcript:

1 Applied Combinatorics, 4th Ed. Alan Tucker
Section 3.3 The Traveling Salesperson Problem Prepared by Patrick Asaba and Patrick Scanlon 1/16/2019 Tucker Sec. 3.3 Section 3.3

2 The Traveling Salesperson Problem
The traveling salesperson problems seeks to minimize the cost of the route for a salesperson to visit a set of cities and return home. e a c b d f 5 mi 9 mi 8 mi 10 mi e a c b d f 5 mi 9 mi 15 mi 8 mi 10 mi Total = 62 mi Total = 48 mi 1/16/2019 Tucker Sec. 3.3

3 The Traveling Salesperson Problem
A salesperson, starting at point a has to visit six locations (a to f) and must come back to the starting point. The first route (a-b-c-d-e-f-a), with a total length of 62 mi, is a relevant selection but is not the best solution. The second route (a-c-d-b-e-f-a) represents a much better solution as the total distance, 48 mi, is less than for the first route. 1/16/2019 Tucker Sec. 3.3

4 The Traveling Salesperson Problem
We seek a minimal-cost Hamilton circuit in a complete graph having associated cost matrix C. Entry is the cost of going from vertex (city) i to vertex j. (Note that we do not require ). The infinite costs on the main diagonal indicate that we cannot use these entries. To From 1 4 3 2 7 9 This shows that 2 is three units from 1, 3 is nine units from 1 and 4 is seven units from 1. 1/16/2019 Tucker Sec. 3.3

5 Approaching the Traveling Salesperson Problem
There are 2 approaches to solving this problem, both approaches use trees, but in two very different ways. The first approach is using a “branch and bound” method. Finding the exact solution to problems involving enumeration of very large trees, which has led researchers to concentrate on near-optimal algorithms. A complete graph on n vertices has (n-1)! different Hamilton circuits, for example, a 50-city (vertex) problem has 49! possible circuits. The second approach is to construct a near-minimal solution using an algorithm that is quite fast. This first approach is to systematically consider all the possible ways to build Hamilton circuits in search of the cheapest one, using a “branch and bound” method to limit the number of different vertices in the search tree that must be inspected in search of a minimal solution. Note: The “branch and bound” method reduces substantially the number of circuits that must be checked, however this will not be enough to make it practical to solve large traveling salesperson problems. 1/16/2019 Tucker Sec. 3.3 Section 3.3

6 Branch and Bound All solutions 1/16/2019 Tucker Sec. 3.3

7 Constraints Let us consider a small traveling salesperson problem with four vertices . Let the cost of the matrix for this problem be; To From A Hamilton circuit will use 4 entries in the cost matrix C, one in each row and in each column, such that no proper subset of the entries (edges) forms a subcircuit. 1/16/2019 Tucker Sec. 3.3

8 Approach #1 We start by showing how to obtain a lower bound for the cost of this traveling salesperson problem. Since every solution must contain an entry in the first row, the edges of a minimal tour will not change if we subtract a constant value from the first row of the cost matrix. (Of course, the cost of a minimal tour will change by this constant.) To From 1/16/2019 Tucker Sec. 3.3

9 Approach # 1 continued We subtract the value of the smallest entry in each row to avoid negative entries in the rows. In this case subtract 3, 3, 5 and 4 from rows 1, 2, 3 and 4 respectively. To From To From 15 All rows in the altered matrix now contain a 0 entry. After subtracting from the different rows, a minimal tour using this new cost data will cost 15 less than a minimal tour using original cost data in the altered cost matrix. 1/16/2019 Tucker Sec. 3.3

10 Approach # 1 continued Similarly, we can subtract a constant from any column with a nonzero, without changing the set of edges on a minimal tour. The only such column in the altered matrix is column 4, whose smallest value is 1. So we subtract 1 from the last column to get a new matrix, to obtain 0 entries in every row and column. To From To From Lower bound is now = 16 1/16/2019 Tucker Sec. 3.3

11 Approach # 1 continued We can use this reduction of cost to obtain a lower bound on the cost of a minimal tour: A minimal tour using the costs in our new matrix must trivially cost at least zero, and hence a minimal tour using the original matrix must cost at least 16. Generally, the lower bound for the traveling salesman problems equals the sum of the constants subtracted from the rows and columns of the original cost matrix to obtain a new cost matrix with a 0 entry in each row and column. Now we are ready for the branching part of the “branch and bound” method. We look at an entry in our new matrix that is equal to 0, say , then we can choose use it or not. We “branch” on this choice. In case we do not use , we represent it by setting it equal to infinity; = 1/16/2019 Tucker Sec. 3.3

12 Approach # 1 continued The smallest value in row 1 of the last altered matrix is now = 3, and we can now subtract this amount from row 1. Similarly we can subtract 1 from column 2. So, if we do not use , we obtain this new cost matrix. = To To From -3 From Since we decided not use C12(meaning that we are not going to be taking that route), then we have to continue subtracting the lowest value in row 1 and column 2, because there are no zero entries. The only zero was at C12, but since decided to not use the entry, we had to set it equal to infinite. Do not use Lower bound = 20 -1 Hence, any tour for the original problem that does not use must cost at least 16 + (3+1) = 20. 1/16/2019 Tucker Sec. 3.3 Section 3.3

13 Branch and Bound All solutions L.B. = 16 Solutions without C12
This is the first part of the decision tree. 1/16/2019 Tucker Sec. 3.3

14 Approach # 1 continued If we do use to build a tour, then the rest of the tour cannot use another entry in row 1 or column 2, also entry must be set equal to infinity (to avoid a subcircuit of length 2). To From To From To 2 3 4 From An Example of why we cannot use another entry in row 1 and column 2 for the rest of the tour, if C12 to build a tour. Note: In Matrix C, as you can see row 1 and column 2 to not exist anymore, thus we will not see them for the rest of the tour. However, before you can do this, remember our reduced matrix had a new smallest value. C A B 1/16/2019 Tucker Sec. 3.3 Section 3.3

15 Approach # 1 continued The new smallest value of the reduced matrix in row 2 is 1, and so we subtract 1 from row 2 to obtain a new cost matrix, To 2 3 4 From To 2 3 4 From -1 The lower bound for a tour in the new cost matrix using is now 16+1=17. 1/16/2019 Tucker Sec. 3.3

16 Approach # 1 continued Since our lower bound of 17 is less than the lower bound of 20, when we do not use , we continue our consideration of tours using by determining bounds associated with whether or not to use a second entry with value 0. All solutions L.B. = 16 Solutions with C12 without C12 L.B. = 17 L.B. = 20 We will continue to use these partial tours using C12 as long as the lower bound is less than or equal to 20. If the lower bound were to exceed 20, then we would have to go back and consider partial tours not using C12. Our tree of choices for this problem will be a binary tree whose interval vertices represent choices of the form: use entry Cij or do not use Cij. At any stage, we do not need to look at the subtree of possible tour not using Cij, if the lower bounds for partial tours using Cij are less than the lower bound for tour not using Cij. 1/16/2019 Tucker Sec. 3.3 Section 3.3

17 Approach # 1 continued To extend on our tour, we look at the last new matrix considering whether or not to use Not using will increase the lower bound by 2, (the smallest entry in row after we set = ; column 4 still has a 0.) Not using To 2 3 4 From 2 To 2 3 4 From -2 BEFORE Slide # 18 We extend a tour using C12 by considering another entry with value zero. This next zero entry need not connect with C12, that is, need not be of the form Cj2 or C2j, but for simplicity we shall pick an entry in row 2. When Slide # 18 Appears. Again we have the choice of using C24 or not using C24. After the slide # 18 Actually it is not like we have choice since not using either of C43 or C31 forces us to use an infinite (which represents a forbidden edge). Since C41 = C31 = 0, this tour has cost equal to the lower bound of 17 Lower Bound = = 19 1/16/2019 Tucker Sec. 3.3 Section 3.3

18 Approach # 1 continued This is the decision tree for not using C24
All solutions L.B. = 16 Solutions with C12 without C12 L.B. = 17 L.B. = 20 without C24 L.B. = 19 1/16/2019 Tucker Sec. 3.3

19 we delete row 2 and column 4, and set = , (to block the subcircuit .
Approach # 1 continued Using will not increase the lower bound, and so we further extend the partial tour using and To 2 3 4 From To 3 4 From Use and Lower bound = 17 we delete row 2 and column 4, and set = , (to block the subcircuit Now the way to finish the tour is clear: use entries and for a complete tour 1/16/2019 Tucker Sec. 3.3

20 Over View of Steps Subract as much as possible from rows and columns (until you get 0 entries) and add this amount to the lower bound. Choose an entry = 0 and try two things: Use , so delete the ith row and jth column and put in any edge that would complete a cycle with what you already have. Don’t use , so replace it with In both cases, subtract as much as possible and put each of the resulting lower bounds on the decision tree. Choose the cheapest leaf on the decision tree, and using its cost matrix, go back to step 2. 1/16/2019 Tucker Sec. 3.3

21 Approach # 1 continued Further, this tour must be minimal since its cost equals our lower bound. Rechecking the tour’s cost with the original cost matrix C, we have To From = = 17 4 5 5 3 We summarize the preceding reasoning with the decision tree, summarizing the choices we have made and their lower bounds (L.B). 1/16/2019 Tucker Sec. 3.3

22 Decision Tree All solutions L.B. = 16 L.B. = 17 L.B. = 20 L.B. = 19
with C12 with C24 with C43 with C31 without C43 without C24 without C12 L.B. = 16 L.B. = 17 L.B. = 20 L.B. = 19 L.B. = 21 The branch-and-bound method is used not only to solve optimization problems. It is also a central tool in artificial intelligence. E.G. Computer that play chess make a tree of possible future moves and then assign some sort of “value” to the resulting chessboard situations. A move that leads to bad situation gets a very high value, and future moves from this situation are not pursued. L.B. = 17 1/16/2019 Tucker Sec. 3.3 Section 3.3

23 The approximate Traveling Salesperson Tour construction
Approach # 2 The approximate Traveling Salesperson Tour construction Pick any vertex as a starting circuit consisting of 1 vertex. Given the k-vertex circuit , k 1, find the vertex not on that is closest to a vertex, call it , on Let be the k+1-vertex circuit obtained by inserting immediately in front of in . Repeat steps 2 and 3 until a Hamilton circuit (containing all vertices) is found. The second approach is a quicker algorithm for obtaining good (near-minimal) tours, when the costs are symmetric (i.e Cij = Cji) and the costs satisfy the triangle inequality – Cik <= Cij + Cjk. 1/16/2019 Tucker Sec. 3.3 Section 3.3

24 Example To From We apply the approximate algorithm to a 6-vertex traveling salesperson problem whose cost matrix is given. Name the vertices Start with as Vertex is the closest to , and so is Then is the next vertex closest to either or and not in , thus forming = At the end of slide #23 In this case, the length of the tour obtained with the Quick Tour Construction algorithm is equal to the minimum ( which happens to be 10). Generally the length of the tour depends on the starting vertex. If we suspected that our approximate tour was not equal or really close to satisfactory length, then by trying other vertices as the starting vertices as the starting vertex (that forms C1) and applying the algorithm, we will get other near-minimum tours. Taking the shortest of this set of tours generated by the Quick Tour Construction would give us an improved estimate for the true minimum tour. 1/16/2019 Tucker Sec. 3.3 Section 3.3

25 Example con’t To From Now there are two vertices, and , 3 units from vertices in Suppose we choose It is inserted before to obtain Vertex is still 3 units from and there is nothing closer to 2 than 3 units. So we insert before , obtaining Finally, is within 4 units of and Inserting before , we obtain our near-minimal tour , whose cost we compute to be = 19. 1/16/2019 Tucker Sec. 3.3

26 Theorem The cost of the tour generated by the approximate tour construction is less than twice the cost of the minimal traveling salesperson tour. 1/16/2019 Tucker Sec. 3.3

27 Class Exercise Using approach #1, find a sequence that minimizes the sum of the costs of the tour between the cities (vertices) in the cost matrix below. And what is the minimal cost? To From 1/16/2019 Tucker Sec. 3.3

28 Solution -2 -1 -2 -2 Lower bound is now 7 + (1 + 1) = 9 7 -1 0 -1 0
To From To From Lower bound is now 7 + (1 + 1) = 9 7 Use C12 To From To 2 3 4 From Lower bound = 9 1/16/2019 Tucker Sec. 3.3

29 Solution Not using C12 -1 Lower bound = 9 Lower bound = 9 +1= 10
To From Not using C12 To From -1 Lower bound = 9 Lower bound = 9 +1= 10 Decision Tree All solutions L.B. = 9 Solution without C12 Solution with C12 L.B. = 10 L.B. = 9 1/16/2019 Tucker Sec. 3.3

30 Solution Continued Use C24 Lower bound = 9 Not using C24 -3
To 2 3 4 From To 3 4 From Lower bound = 9 Not using C24 To 2 3 4 From 3 To 2 3 4 From -3 Lower bound = 9+3 = 12 1/16/2019 Tucker Sec. 3.3

31 Solution Continued To 3 4 From At this we are forced to use C43 and C31, the lower bound is still 9. Sequence (tour) is ( ) The minimal cost is 9 1/16/2019 Tucker Sec. 3.3


Download ppt "Applied Combinatorics, 4th Ed. Alan Tucker"

Similar presentations


Ads by Google