860 likes | 1.05k Views
The Traveling Salesman Problem in Theory & Practice. Lecture 2: NP-Hardness 28 January 2014 David S. Johnson dstiflerj@gmail.com http:// davidsjohnson.net Seeley Mudd 523, Tuesdays and Fridays. Today’s Outline. NP-completeness and the complexity of finding optimal TSP tours.
E N D
The Traveling Salesman Problem in Theory & Practice Lecture 2: NP-Hardness 28 January 2014 David S. Johnson dstiflerj@gmail.com http://davidsjohnson.net Seeley Mudd 523, Tuesdays and Fridays
Today’s Outline • NP-completeness and the complexity of finding optimal TSP tours. • Hardness of Approximation, the PCP Theorem, and the TSP.
Sources • Garey & Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness, 1979. • Johnson & Papadimitriou, “Computational Complexity,” Chapter 3 of Lawler, Lenstra, RinnooyKan, & Shmoys, The Traveling Salesman Problem, 1985. • Johnson, “The tale of the second prover” (NP-Completeness Column #23), J. Algorithms 13 (1992), 502-524 [Also available on DSJ’s website]. • Johnson, “A brief history of NP-completeness, 1954-2012,” in Optimization Stories, Martin Grötschel (Editor), Special Volume of DocumentaMathematica(2012), 359-376. (Book distributed at the 21st International Symposium on Mathematical Programming, Berlin, August 19-24, 2012) [Also available on DSJ’s website].
NP-Completeness Concept invented contemporaneously and independently by Stephen Cook [1971] and Leonid Levin [1973] Breadth of applicability first illustrated by Karp [1972]
First Book M. R. Garey & D. S. Johnson Computers and Intractability: A Guide to the Theory of NP-Completeness W.H. Freeman, 1979
Still an Open Question: Does P = NP? Note: If you can provide a valid proof of the answer, you will win fame and fortune ($1,000,000 from the Clay Institute)
The P-versus-NP Pagehttp://www.win.tue.nl/~gwoegi/P-versus-NP.htm
Proving that the TSP is NP-Hard • What we will actually prove: HAMILTON CYCLE for “grid graphs” is NP-complete. Finite subgraph of the infinite rectilinear grid.
General Asymmetric TSP Asymmetric Triangle Inequality TSP Symmetric TSP Directed Hamilton Cycle Hamilton Cycle Symmetric Triangle Inequality TSP Hamilton Cycle for Bipartite Planar Graphs Rectilinear TSP Euclidean TSP Hamilton Cycle for Grid Graphs
EXACT COVER • Instance: A finite set U together with a collection C of subsets of U. • Question: Does C contain an exact cover for U, that is, a subcollection S’ ⊆ S such that every element of U occurs in exactly one member of S’? • Status: NP-complete [Karp, 1972].
SATISFIABILITY EXACT COVER HAMILTON CYCLE for Bipartite, Max Degree 3 Graphs HAMILTON CYCLE for Planar Bipartite, Max Degree 3 Graphs HAMILTON CYCLE for Grid Graphs
SATISFIABILITY • Instance: A set of X variables {x1,x2,…,xn} and a set of clauses C = {c1,c2,…,cm}, where each ci is a subset of the “literals” {x1,¬x1,x2,¬x2, … , xn,¬xn}. • Question: Is there an assignment of the values “true” or “false” to the variables so that each clause c contains at least one true literal (where ¬xi is true if xi is assigned the value “false” and otherwise is false) ? • Status: NP-complete [Cook, 1971], [Levin, 1973]
Transformation:SATISFIABILITY to EXACT COVER Elements of X: • <c,x> for each combination of a clause c and a literal x that it contains. • Plus |c|-1 auxiliary “garbage collection” elements for each clause c. • Plus auxiliary elements for each variable
Clause Component <c,x3> <c,¬x6> <c,¬x7> <c,x21> Garbage Collection Elements To cover the garbage collection elements, we must pick up all but one of the <c,x> elements, and all choices of the uncovered <c,x> are possible. The uncovered <c,x> specifies the literal x chosen to satisfy the clause c. Need Variable Components to insure that no conflicting literal choices are made (elements <c,x> and <c’,¬x> are left uncovered).
Variable Component for x <c2,¬x> <c7,x> <c4,¬x> <c9,x> <c22,¬x> <c15,x> <c11,¬x>
Nx= max(|{c: clause c contains literal x}|, |{c: clause c contains literal ¬x}|) We begin with 2Nx red elements. <c2,¬x> <c7,x> <c4,¬x> <c9,x> <c22,¬x> <c15,x> <c11,¬x>
Theorem The original SATISFIABILITY instance is satisfiable if and only if the resulting EXACT COVER instance has an exact cover. Corollary: Since the construction can be accomplished in polynomial time, we have produced a polynomial reduction from SATISFIABILITY to EXACT COVER.
EXACT COVER to HAMILTON CIRCUIT for Bipartite Graphs with Max Degree 3 • The construction involves three types of components this time. • Element components • Set Choosing components • Linking components • We will exploit the fact that a tour is 2-connected and has only degree-2 vertices.
Component for Element u Suppose that element u is contained in sets Sa[1], Sa[2], …, Sa[k]. Sa[1] Sa[2] Sa[k]
Component for Element u Proposition:Every Hamilton Cycle omits precisely one of the bottom edges of the component for u, and any one those bottom edges can be the omitted one. (The omitted edge identifies the set that is supposed to cover element u.) Proof: We will illustrate the proof for the case of k = 6
Any one of the bottom edges can be the omitted one. (Edges Forced by Degree-2 and 2-Connectivity Constraints)
Every Hamilton Cycle omits precisely one of the bottom edges. If none of the edges is omitted, the rest of the component cannot be in the tour.
Every Hamilton Cycle omits precisely one of the bottom edges. Suppose 2 or more edges are omitted. Consider the leftmost omitted edge. Tour must contain these edges. Consider the rightmost omitted edge. Tour must contain these edges. Oops!
Set Choosing Components S1 • S2 Sm A set is in the cover if the Hamilton path takes the top path in the pair for that set.
Linking Component: The Exclusive-Or Graph Only two options for edges linking to the outside world. Choice 1 Choice 2
Linking Component: The Exclusive-Or Graph Forced by Degree-2 Constraints Suppose we take top left edge but not the bottom. Then these edges are forced.
Linking Component: The Exclusive-Or Graph Suppose we take bottom left edge but not the top.. Then these edges are forced.
Linking Component: The Exclusive-Or Graph Suppose we take both bottom and top left edges. Then these edges are forced. Oops!
Linking Component: The Exclusive-Or Graph Suppose we take neither bottom nor top left edge. Then these edges are forced. Oops!
Linking Component: The Exclusive-Or Graph Shorthand for Exclusive-Or
The Transformation fromEXACT COVER to HAMILTONIAN CYCLE Oops! – Not Bipartite Fixed! a b c {a,b} {a,c} {b} {b,c}
Getting to the Grid Lemma: Any 2-connected planar graph with f faces and n edges (all of degree 2 or 3) has an embedding in the 2D grid that can be contained in square of size 2f+n (has “extent” no more than 2f+n).
Proof of Lemma • Note that, if a graph is planar, then for each of its faces there is a planar representation in which that face is the external face (that is, the one that contains all the other vertices). • We proceed by induction on the number of faces f, with the hypothesis that, for any graph G as above and a designated face, there is a grid embedding of extent 2f+n or less, such that • the designated face is the external face of the embedding, and • no degree-2 vertex of the external face has any vertex or edge of the embedding to its right on the gridline containing it.
Base Case: f = 1 ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ 2f + n = 4 + 6 = 10 > 7
Inductive step: Assume true for all f’ < f ∂∂∂ Chosen Face F ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ Planar 2-connected graph G with all vertex degrees equal to 2 or 3
Pick a face F’ that shares an edge with our chosen face. Delete all shared edges and degree-2 vertices leaving n’ vertices. Now we have an (f-1)-face graph and a chosen face, for which the induction hypothesis holds. ∂∂∂ Neighboring Face F’ Chosen Face F ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ Combined Face F’’ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂
Embedding with F’’ as external face. Extent no more than 2(f-1)+n’ ∂∂∂ Degree 2 vertices on the boundary of our original face ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ Two Cases for the boundary of F’’ that is not shared with F: Interior Exterior
First Case: Internal ∂∂∂ Degree 2 vertices on the boundary of our original face Deleted edges and degree-2 vertices from F. ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ ∂∂∂ Extent no more than 2(f-1)+n’ + 1 < 2f+n Extent no more than 2(f-1)+n’ ∂∂∂