Theory of Computer Science June 1, 2016 — E5. Some NP-Complete Problems, Part II Theory of Computer Science E5. Some NP-Complete Problems, Part II E5.1 Routing Problems Malte Helmert E5.2 Packing Problems University of Basel E5.3 Conclusion June 1, 2016 M. Helmert (Univ. Basel) Theorie June 1, 2016 1 / 42 M. Helmert (Univ. Basel) Theorie June 1, 2016 2 / 42 Overview: Course Overview: Complexity Theory contents of this course: ◮ logic � Complexity Theory ⊲ How can knowledge be represented? E1. Motivation and Introduction ⊲ How can reasoning be automated? E2. P, NP and Polynomial Reductions ◮ automata theory and formal languages � E3. Cook-Levin Theorem ⊲ What is a computation? E4. Some NP-Complete Problems, Part I ◮ computability theory � ⊲ What can be computed at all? E5. Some NP-Complete Problems, Part II ◮ complexity theory ⊲ What can be computed efficiently? M. Helmert (Univ. Basel) Theorie June 1, 2016 3 / 42 M. Helmert (Univ. Basel) Theorie June 1, 2016 4 / 42
Further Reading (German) Further Reading (English) Literature for this Chapter (German) Literature for this Chapter (English) Introduction to the Theory of Computation by Michael Sipser (3rd edition) Theoretische Informatik – kurz gefasst ◮ Chapter 7.5 by Uwe Sch¨ oning (5th edition) Note: ◮ Chapter 3.3 ◮ Sipser does not cover all problems that we do. M. Helmert (Univ. Basel) Theorie June 1, 2016 5 / 42 M. Helmert (Univ. Basel) Theorie June 1, 2016 6 / 42 E5. Some NP-Complete Problems, Part II Routing Problems E5. Some NP-Complete Problems, Part II Routing Problems 3SAT ≤ p DirHamiltonCycle SAT 3SAT E5.1 Routing Problems Clique DirHamiltonCycle SubsetSum IndSet HamiltonCycle Partition VertexCover TSP BinPacking M. Helmert (Univ. Basel) Theorie June 1, 2016 7 / 42 M. Helmert (Univ. Basel) Theorie June 1, 2016 8 / 42
E5. Some NP-Complete Problems, Part II Routing Problems E5. Some NP-Complete Problems, Part II Routing Problems DirHamiltonCycle is NP-Complete (1) DirHamiltonCycle is NP-Complete (2) Proof. DirHamiltonCycle ∈ NP: guess and check. Definition (Reminder: DirHamiltonCycle ) DirHamiltonCycle is NP-hard: The problem DirHamiltonCycle is defined as follows: We show 3SAT ≤ p DirHamiltonCycle . Given: directed graph G = � V , E � ◮ We are given a 3-CNF formula ϕ where each clause contains Question: Does G contain a Hamilton cycle? exactly three literals and no clause contains duplicated literals. ◮ We must, in polynomial time, construct Theorem a directed graph G = � V , E � such that: DirHamiltonCycle is NP-complete. G contains a Hamilton cycle iff ϕ is satisfiable. ◮ construction of � V , E � on the following slides . . . M. Helmert (Univ. Basel) Theorie June 1, 2016 9 / 42 M. Helmert (Univ. Basel) Theorie June 1, 2016 10 / 42 E5. Some NP-Complete Problems, Part II Routing Problems E5. Some NP-Complete Problems, Part II Routing Problems DirHamiltonCycle is NP-Complete (3) DirHamiltonCycle is NP-Complete (4) Proof (continued). ◮ For every variable X i , add vertex x i with 2 incoming and 2 outgoing edges: Proof (continued). x 1 x 2 x n . . . ◮ Let X 1 , . . . , X n be the propositional variables in ϕ . ◮ Let c 1 , . . . , c m be the clauses of ϕ with c i = ( l i 1 ∨ l i 2 ∨ l i 3 ). ◮ For every clause c j , add the subgraph C j with 6 vertices: ◮ Construct a graph with 6 m + n vertices (described on the following slides). a A . . . b B c C ◮ We describe later how to connect these parts. . . . M. Helmert (Univ. Basel) Theorie June 1, 2016 11 / 42 M. Helmert (Univ. Basel) Theorie June 1, 2016 12 / 42
E5. Some NP-Complete Problems, Part II Routing Problems E5. Some NP-Complete Problems, Part II Routing Problems DirHamiltonCycle is NP-Complete (5) DirHamiltonCycle is NP-Complete (6) Proof (continued). Proof (continued). Connect the “open ends” in the graph as follows: ◮ Identify entrances/exits of the clause subgraph C j Let π be a Hamilton cycle of the total graph. with the three literals in clause c j . ◮ Whenever π enters subgraph C j from one of its “entrances”, ◮ One exit of x i is positive, the other one is negative. it must leave via the corresponding “exit”: ( a − → A , b − → B , c − → C ). ◮ For the positive exit, determine the clauses Otherwise, π cannot be a Hamilton cycle. in which the positive literal X i occurs: ◮ Connect the positive exit of x i with the X i -entrance ◮ Hamilton cycles can behave in the following ways with regard to C j : of the first such clause graph. ◮ Connect the X i -exit of this clause graph with the X i -entrance ◮ π passes through C j once (from any entrance) of the second such clause graph, and so on. ◮ π passes through C j twice (from any two entrances) ◮ Connect the X i -exit of the last such clause graph ◮ π passes through C j three times (once from every entrance) with the positive entrance of x i +1 (or x 1 if i = n ). . . . ◮ analogously for the negative exit of x i and the literal ¬ X i . . . M. Helmert (Univ. Basel) Theorie June 1, 2016 13 / 42 M. Helmert (Univ. Basel) Theorie June 1, 2016 14 / 42 E5. Some NP-Complete Problems, Part II Routing Problems E5. Some NP-Complete Problems, Part II Routing Problems DirHamiltonCycle is NP-Complete (7) DirHamiltonCycle is NP-Complete (8) Proof (continued). Proof (continued). The construction is polynomial and is a reduction: ( ⇐ ): construct a satisfying assignment from a Hamilton cycle ( ⇒ ): construct a Hamilton cycle from a satisfying assignment ◮ A Hamilton cycle visits every vertex x i ◮ Given a satisfying assignment I , construct a Hamilton cycle and leaves it by the positive or negative exit. that leaves x i through the positive exit if I ( X i ) is true ◮ Map X i to true or false depending on which exit and by the negative exit if I ( X i ) is false. is used to leave x i . ◮ Afterwards, we visit all C j -subgraphs for clauses ◮ Because the cycle must traverse each C j -subgraph that are satisfied by this literal. at least once (otherwise it is not a Hamilton cycle), ◮ In total, we visit each C j -subgraph 1–3 times. this results in a satisfying assignment. (Details omitted.) . . . M. Helmert (Univ. Basel) Theorie June 1, 2016 15 / 42 M. Helmert (Univ. Basel) Theorie June 1, 2016 16 / 42
E5. Some NP-Complete Problems, Part II Routing Problems E5. Some NP-Complete Problems, Part II Routing Problems DirHamiltonCycle ≤ p HamiltonCycle HamiltonCycle is NP-Complete (1) SAT Definition (Reminder: HamiltonCycle ) 3SAT The problem HamiltonCycle is defined as follows: Given: undirected graph G = � V , E � Question: Does G contain a Hamilton cycle? Clique DirHamiltonCycle SubsetSum Theorem HamiltonCycle is NP-complete. IndSet HamiltonCycle Partition VertexCover TSP BinPacking M. Helmert (Univ. Basel) Theorie June 1, 2016 17 / 42 M. Helmert (Univ. Basel) Theorie June 1, 2016 18 / 42 E5. Some NP-Complete Problems, Part II Routing Problems E5. Some NP-Complete Problems, Part II Routing Problems HamiltonCycle is NP-Complete (2) HamiltonCycle ≤ p TSP SAT Proof sketch. 3SAT HamiltonCycle ∈ NP: guess and check. HamiltonCycle is NP-hard: We show DirHamiltonCycle ≤ p HamiltonCycle . Clique DirHamiltonCycle SubsetSum Basic building block of the reduction: ⇒ = v 1 v 2 v 3 v IndSet HamiltonCycle Partition VertexCover TSP BinPacking M. Helmert (Univ. Basel) Theorie June 1, 2016 19 / 42 M. Helmert (Univ. Basel) Theorie June 1, 2016 20 / 42
E5. Some NP-Complete Problems, Part II Routing Problems E5. Some NP-Complete Problems, Part II Routing Problems TSP is NP-Complete (1) TSP is NP-Complete (2) Definition (Reminder: TSP ) TSP (traveling salesperson problem) is the following decision problem: ◮ Given: finite set S � = ∅ of cities, symmetric cost function Proof. cost : S × S → N 0 , cost bound K ∈ N 0 TSP ∈ NP: guess and check. ◮ Question: Is there a tour with total cost at most K , i. e., TSP is NP-hard: We showed HamiltonCycle ≤ p TSP a permutation � s 1 , . . . , s n � of the cities with in Chapter E2. � n − 1 i =1 cost ( s i , s i +1 ) + cost ( s n , s 1 ) ≤ K ? German: Problem der/des Handlungsreisenden Theorem TSP is NP-complete. M. Helmert (Univ. Basel) Theorie June 1, 2016 21 / 42 M. Helmert (Univ. Basel) Theorie June 1, 2016 22 / 42 E5. Some NP-Complete Problems, Part II Packing Problems E5. Some NP-Complete Problems, Part II Packing Problems 3SAT ≤ p SubsetSum SAT 3SAT E5.2 Packing Problems Clique DirHamiltonCycle SubsetSum IndSet HamiltonCycle Partition VertexCover TSP BinPacking M. Helmert (Univ. Basel) Theorie June 1, 2016 23 / 42 M. Helmert (Univ. Basel) Theorie June 1, 2016 24 / 42
Recommend
More recommend