1 / 38

CS 312: Algorithm Analysis

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License . CS 312: Algorithm Analysis. Lecture #34: Branch and Bound Design Options for Solving the Traveling Salesman Problem: Tight Bounds.

sinead
Download Presentation

CS 312: Algorithm Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. CS 312: Algorithm Analysis Lecture #34: Branch and Bound Design Options for Solving the Traveling Salesman Problem: Tight Bounds Slides by: Eric Ringger, with contributions from Mike Jones, Eric Mercer, and Sean Warnick

  2. Announcements • Homework #24 due now • Homework #25 due Friday • Project #7: TSP • ASAP: Read the helpful “B&B for TSP Notes” linked from the schedule • Read Project Instructions • Today: We continue discussing main ideas • Next Wednesday: Early day • Week from Friday: due

  3. Objectives • Review the Traveling Salesman Problem (TSP) • Develop a good bound function for the TSP • Reason about Tight Bounds • Augment general B&B algorithm

  4. 1 2 5 3 4 Traveling Salesman (Optimization) Problem • Rudrata or Hamiltonian Cycle • Cycle in the graph that passes through each vertex exactly once + • Find the least cost or “shortest”cycle 9 1 8 2 10 6 5 3 12 7 Distinguish from theTSP search problem and theTSP decision problem 4

  5. How to solve? • If with B&B, what do we need?

  6. How to solve? • If with B&B, what do we need?

  7. 1 2 5 3 4 Initial BSSF How to compute? Should be quick. What if you have a complete graph? What if you don’t? 9 1 8 2 10 6 5 3 12 7 4

  8. 1 2 5 3 4 Simple-Minded Initial BSSF Cost of BSSF = 9+5+4+12+1 = 31 9 1 8 2 10 6 5 3 12 7 4

  9. 1 2 5 3 4 A Bound on Possible TSP Tours We need a bound function. Lower or Upper? How to compute? 9 1 8 2 10 6 5 3 12 7 4

  10. 1 2 5 3 4 A Bound on Possible TSP Tours We need a bound function. Lower or Upper? How to compute? 9 1 8 2 10 6 5 3 12 7 4

  11. 1 2 5 3 4 A Bound on Possible TSP Tours 9 1 8 2 10 6 5 3 12 7 4 What’s the cheapest way to leave each vertex?

  12. 1 2 5 3 4 Bound on Possible TSP Tours Rough draft bound= 8+6+3+2+1 = 20 9 1 8 2 10 6 5 3 12 7 4 Save the sum of those costs in the bound (as a rough draft).

  13. 1 2 5 3 4 Bound on Possible TSP Tours Rough draft bound = 20 9-8=1 1 8-8=0 2 10 6 4 3 12 7 4 For a given vertex, subtract the least cost departure from each edge leaving that vertex.

  14. 1 2 5 3 4 Bound on Possible TSP Tours Rough draft bound = 20 1 0 0 0 9 0 2 0 6 1 1 Repeat for the other vertices. What do the numbers on the edges mean now?

  15. 1 2 5 3 4 Bound on Possible TSP Tours Rough draft bound = 20 1 0 0 0 9 0 2 0 6 1 1 Now, can we find a tighter lower bound?

  16. 1 2 5 3 4 Bound on Possible TSP Tours Rough draft bound = 20 1 0 0 0 9 0 2 0 6 1 1 Does that set of edges now having 0 residual cost arrive at every vertex?

  17. 1 2 5 3 4 Bound on Possible TSP Tours Rough draft bound = 20 1 0 0 0 9 0 2 0 6 1 1 In this case, those edges never arrive at vertex #3.

  18. 1 2 5 3 4 Bound on Possible TSP Tours Rough draft bound = 20 1 0 0 0 9 0 2 0 6 1 1 We have to take an edge to vertex 3 from somewhere. Assume we take the cheapest.

  19. 1 2 5 3 4 Bound on Possible TSP Tours Bound = 21 1 0 0 0 9 0 1 0 6 0 1 Subtract its cost from other edges entering vertex 3 and add the cost to the bound. We have just tightened the bound.

  20. This Bound • It will cost at least this much to visit all the vertices in the graph. • There’s no cheaper way to get in and out of each vertex. • Each edge is now labeled with the extra cost of choosing that edge. • The bound is not a solution; it’s a bound! • Why are tight bounds desirable?

  21. 9 1 1 8 2 2 5 10 6 3 4 12 7 3 4 4 Bound on Possible TSP Tours To: 1 2 3 4 5 From: 1 2 3 4 5 Our algorithm can do this reasoning using a cost matrix.

  22. 1 0 1 0 0 2 5 9 0 0 2 6 1 3 4 1 Bound on Possible TSP Tours To: 1 2 3 4 5 From: 1 2 3 4 5 Reduce all rows.

  23. 1 0 1 0 0 2 5 9 0 0 2 6 1 3 4 1 Bound on Possible TSP Tours To: 1 2 3 4 5 From: 1 2 3 4 5 Then reduce column #3. Now we have a tighter bound.

  24. Search • Let’s start the search • Arbitrarily start at vertex 1 • Why is this OK? • Focus on: • the bound function and • the reduced cost matrix representation of states

  25. Using this bound for TSP in B&B Start at vertex 1 in graph (arbitrary) BSSF=31 bound = 21 What should our state expansion strategy be?

  26. Using this bound for TSP in B&B Start at vertex 1 in graph (arbitrary) BSSF=31 bound = 21 1-2 1-5 1-3 1-4 bound = 21 bound = 21+1

  27. 1 1 2 2 5 5 3 3 4 4 Focus: going from 1 to 2 BSSF=31 bound = 21 Before After 1 0 1 0 1-2 0 0 0 9 9 0 1 0 1 6 6 0 0 1 1 bound = 22 Add extra cost from 1 to 2, exclude edges from 1 or into 2.

  28. 1 1 2 2 5 5 3 3 4 4 Focus: going from 1 to 2 BSSF=31 bound = 21 Before After 1 0 1 0 1-2 0 0 0 9 9 0 1 0 1 6 6 0 0 1 1 bound = 22+1 No edges into vertex 4 w/ 0 reduced cost.

  29. 1 2 5 3 4 Focus: going from 1 to 2 BSSF=31 bound = 21 1 0 1-2 0 8 1 6 0 0 bound = 21+1+1 Add cost of reducing edge into vertex 4.

  30. Bounds for other choices Agenda: BSSF=31 bound = 21 1-2(23),1-4(21) 1-2 1-5 1-3 1-4 bound = 23 bound = 21

  31. 1 2 5 3 4 Leaving Vertex 4 BSSF=31 1-4 0 0 bound = 21 0 0 1 0 6 0 1-4-2 1-4-3 1-4-5 bound = 22 bound = 21 bound = 28

  32. 1 2 5 3 4 Leaving Vertex 4 BSSF=31 1-4 Agenda: 0 0 1-4-2(22), 1-4-3(21) 1-4-5(28),1-2(23) bound = 21 0 0 1 0 6 0 1-4-2 1-4-3 1-4-5 bound = 22 bound = 21 bound = 28

  33. 1 2 5 3 4 Leaving Vertex 3 BSSF=31 1-4-3 0 bound = 21 0 0 0 0 1-4-3-2 bound = 21

  34. 1 2 5 3 4 Leaving Vertex 3 BSSF=31 1-4-3 Agenda: 0 bound = 21 0 4-2(22), 3-2(21) 4-5(28), 1-2(23), 0 0 0 1-4-3-2 bound = 21

  35. Search Tree for This Problem b=21 1-to-2 1-to-4 b=23 b=21 4-to-2 4-to-3 4-to-5 b=22 b=21 b=28 3-to-2 b=21 2-to-5

  36. Termination Criteria for a B&B Algorithm • Repeat until • Agenda is empty • Or time is up • Or BSSF cost is equal to original LB

  37. Update: Branch and Bound functionBandB(v) BSSF  quick-solution(v) // BSSF.cost holds cost Agenda.clear() v.b  bound(v) Agenda.add(v, v.b) while !Agenda.empty() andtime remains and BSSF.cost != v.bdo u  Agenda.first() Agenda.remove_first() children = generate_children_ascending(u) for each w in childrendo if ! time remains then break w.b  bound(w) if (w.b < BSSF.cost) then if criterion(w) then BSSF  w • Agenda.prune(BSSF.cost) else ifpartial_criterion(w) then Agenda.add(w, w.b) return BSSF

  38. Assignment • HW #25: • Compute bound for TSP instance using today’s method • Reason about search for TSP solution

More Related