CS 312: Algorithm Analysis

Slides:



Advertisements
Similar presentations
Great Theoretical Ideas in Computer Science
Advertisements

Reducibility Class of problems A can be reduced to the class of problems B Take any instance of problem A Show how you can construct an instance of problem.
Techniques for Dealing with Hard Problems Backtrack: –Systematically enumerates all potential solutions by continually trying to extend a partial solution.
Great Theoretical Ideas in Computer Science.
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
Branch and Bound Searching Strategies
Approximation Algorithms: Combinatorial Approaches Lecture 13: March 2.
Branch and Bound Similar to backtracking in generating a search tree and looking for one or more solutions Different in that the “objective” is constrained.
Is the following graph Hamiltonian- connected from vertex v? a). Yes b). No c). I have absolutely no idea v.
1 Branch and Bound Searching Strategies 2 Branch-and-bound strategy 2 mechanisms: A mechanism to generate branches A mechanism to generate a bound so.
Ch 13 – Backtracking + Branch-and-Bound
Jin Zheng, Central South University1 Branch-and-bound.
Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,
Backtracking.
ECE669 L10: Graph Applications March 2, 2004 ECE 669 Parallel Computer Architecture Lecture 10 Graph Applications.
The Travelling Salesman Algorithm A Salesman has to visit lots of different stores and return to the starting base On a graph this means visiting every.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
CS 312: Algorithm Analysis Lecture #3: Algorithms for Modular Arithmetic, Modular Exponentiation This work is licensed under a Creative Commons Attribution-Share.
EECS 203: It’s the end of the class and I feel fine. Graphs.
Branch & Bound UPPER =  LOWER = 0.
CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.
SPANNING TREES Lecture 21 CS2110 – Spring
CS 312: Algorithm Analysis Lecture #4: Primality Testing, GCD This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
CS 312: Algorithm Design & Analysis Lecture #17: Connectedness in Graphs This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
CS 312: Algorithm Analysis Lecture #8: Non-Homogeneous Recurrence Relations This work is licensed under a Creative Commons Attribution-Share Alike 3.0.
6.1 Hamilton Circuits and Paths: Hamilton Circuits and Paths: Hamilton Path: Travels to each vertex once and only once… Hamilton Path: Travels to each.
BackTracking CS335. N-Queens The object is to place queens on a chess board in such as way as no queen can capture another one in a single move –Recall.
CS 312: Algorithm Analysis Lecture #32: Intro. to State-Space Search This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
CS 312: Algorithm Design & Analysis Lecture #23: Making Optimal Change with Dynamic Programming Slides by: Eric Ringger, with contributions from Mike Jones,
CS 312: Algorithm Design & Analysis Lecture #12: Average Case Analysis of Quicksort This work is licensed under a Creative Commons Attribution-Share Alike.
CS 312: Algorithm Design & Analysis Lecture #24: Optimality, Gene Sequence Alignment This work is licensed under a Creative Commons Attribution-Share Alike.
CS 312: Algorithm Design & Analysis Lecture #2: Asymptotic Notation This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
CS 312: Algorithm Analysis Lecture #4: Primality Testing, GCD This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
CS 312: Algorithm Design & Analysis Lecture #35: Branch and Bound Design Options: State Spaces Slides by: Eric Ringger, with contributions from Mike Jones,
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
1 Branch and Bound Searching Strategies Updated: 12/27/2010.
COPING WITH THE LIMITATIONS OF ALGORITHM POWER
TSP – Upper Bounds and Lower Bounds Initial problem : Upper Bound A salesman based in Stockton needs to visit shops based in Darlington, Billingham, Middlesbrough,
CS 312: Algorithm Design & Analysis Lecture #37: A* (cont.); Admissible Heuristics Credit: adapted from slides by Stuart Russell of UC Berkeley. This work.
CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg.
Slides by: Eric Ringger, adapted from slides by Stuart Russell of UC Berkeley. CS 312: Algorithm Design & Analysis Lecture #36: Best-first State- space.
CS 312: Algorithm Analysis Lecture #7: Recurrence Relations a.k.a. Difference Equations Slides by: Eric Ringger, with contributions from Mike Jones, Eric.
CS 312: Algorithm Analysis Lecture #8: Non-Homogeneous Recurrence Relations This work is licensed under a Creative Commons Attribution-Share Alike 3.0.
CS 312: Algorithm Analysis Lecture #33: Branch and Bound, Job Assignment This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
Graph Algorithms Maximum Flow - Best algorithms [Adapted from R.Solis-Oba]
CS 312: Algorithm Analysis
CS 312: Algorithm Analysis Lecture #31: Linear Programming: the Simplex Algorithm, part 2 This work is licensed under a Creative Commons Attribution-Share.
CS 312: Algorithm Analysis Lecture #35: Branch and Bound Design Options - State Spaces Slides by: Eric Ringger, with contributions from Mike Jones, Eric.
CS 312: Algorithm Analysis Lecture #31: Linear Programming: the Simplex Algorithm, part 2 This work is licensed under a Creative Commons Attribution-Share.
CS 312: Algorithm Analysis Lecture #4: Primality Testing, GCD This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
Branch and Bound Searching Strategies
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
CS 312: Algorithm Analysis Lecture #9: Recurrence Relations - Change of Variable Slides by: Eric Ringger, with contributions from Mike Jones, Eric Mercer,
CS 312: Algorithm Design & Analysis Lecture #26: 0/1 Knapsack This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
Unit 2 Hamiltonian Circuits. Hamiltonian Circuit: A tour that starts at a vertex of a graph and visits each vertex once and only once, returning to where.
CS 312: Algorithm Design & Analysis Lecture #29: Network Flow and Cuts This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
CS 312: Algorithm Analysis Lecture #30: Linear Programming: Intro. to the Simplex Algorithm This work is licensed under a Creative Commons Attribution-Share.
CS 312: Algorithm Analysis Lecture #27: Network Flow This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
EMIS 8373: Integer Programming Combinatorial Optimization Problems updated 27 January 2005.
Shortest Path Problems
BackTracking CS255.
Maximum Flow - Best algorithms
Genome Assembly.
Branch and Bound.
Applied Combinatorics, 4th Ed. Alan Tucker
Branch and Bound Searching Strategies
Richard Anderson Lecture 26 NP-Completeness
Backtracking and Branch-and-Bound
EMIS 8373: Integer Programming
Presentation transcript:

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 Slides by: Eric Ringger, with contributions from Mike Jones, Eric Mercer, and Sean Warnick

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

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

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 1 2 3 4 5 8 6 7 9 10 12 Distinguish from the TSP search problem and the TSP decision problem

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

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

Initial BSSF How to compute? Should be quick. 1 2 3 4 5 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 7 12 4 If not, think SCC algorithm

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

A Bound on Possible TSP Tours We need a bound function. Lower or Upper? How to compute? 1 2 3 4 5 8 6 7 9 10 12 One good idea not pursued here: MST

A Bound on Possible TSP Tours We need a bound function. Lower or Upper? How to compute? 1 2 3 4 5 8 6 7 9 10 12 One good idea not pursued here: MST

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

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

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

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

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

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

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

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

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

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?

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

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

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

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

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

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

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

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

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

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

Two Possibilities on the Agenda 1 2 3 4 5 1 2 3 4 5 1 9 1 1 6 6 1 bound = 23 bound = 21

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

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

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

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

Search Tree for This Problem 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

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

Update: Branch and Bound function BandB(v) BSSF  quick-solution(v) // BSSF.cost holds cost Agenda.clear() v.b  bound(v) Agenda.add(v, v.b) while !Agenda.empty() and time remains and BSSF.cost != v.b do u  Agenda.first() Agenda.remove_first() children = generate_children_ascending(u) for each w in children do 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 if partial_criterion(w) then Agenda.add(w, w.b) return BSSF

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