slides for cis 675
play

Slides for CIS 675 NP-Complete Problems, Part 2 Jim Royer DPV - PowerPoint PPT Presentation

Slides for CIS 675 NP-Complete Problems, Part 2 Jim Royer DPV Chapter 8 April 15, 2019 Uncredited diagrams are from DPV or homemade. NP-Completeness (DPV Chapter 8) April 15, 2019 1 / 35 The Plan of 8.3 All of NP S AT 3S AT I NDEPENDENT


  1. Slides for CIS 675 NP-Complete Problems, Part 2 Jim Royer DPV Chapter 8 April 15, 2019 Uncredited diagrams are from DPV or homemade. NP-Completeness (DPV Chapter 8) April 15, 2019 1 / 35

  2. The Plan of § 8.3 All of NP S AT 3S AT I NDEPENDENT SET 3D MATCHING V ERTEX COVER C LIQUE ZOE S UBSET SUM ILP R UDRATA CYCLE TSP NP-Completeness (DPV Chapter 8) April 15, 2019 2 / 35

  3. Warm up: Rudrata ( s , t ) -Path � Rudrata Cycle Rudrata ( s , t ) -Path Rudrata Cycle Given: G = ( V , E ) . Given: G = ( V , E ) and s , t ∈ V . Find: A path from s to t in G passing through Find: A cycle in G passing through each vertex each vertex once. once. Rudrata ( s , t ) -Path � Rudrata Cycle: Given an instance of Rudrata ( s , t ) -Path, ( G , s , t ) , construct G ′ by adding an new vertex x and new edges ( x , s ) and ( x , t ) . If P is a Rudrata-cyclc in G ′ , then leaving x , ( x , s ) and ( x , t ) out of P gives an ( s , t ) -Rudrata path in G . If G has a ( s , t ) -Rudrata path P , then adding ( x , s ) and ( x , t ) to P yields a Rudrata cycle in G ′ . ∴ If G ′ has no Rudrata cycle, then G has no ( s , t ) -Rudrata path. NP-Completeness (DPV Chapter 8) April 15, 2019 3 / 35

  4. The Plan of § 8.3 All of NP S AT 3S AT I NDEPENDENT SET 3D MATCHING V ERTEX COVER C LIQUE ZOE S UBSET SUM ILP R UDRATA CYCLE TSP NP-Completeness (DPV Chapter 8) April 15, 2019 4 / 35

  5. 3SAT � Independent Set, 1 3SAT Given: A CNF formula θ in which each clause has at most 3 literals. Find: A satisfying assignment for θ . Independent Set Problem Given: G = ( V , E ) and b . Find: An independent set for G of size ≥ b . I.e., Find U ⊆ V with | U | ≥ b and ( ∀ u , v ∈ U )[( u , v ) / ∈ E ] . Puzzle: These are very different looking problems. How to we get a reduction? NP-Completeness (DPV Chapter 8) April 15, 2019 5 / 35

  6. 3SAT � Independent Set, 1 3SAT Given: A CNF formula θ in which each clause has at most 3 literals. Find: A satisfying assignment for θ . Independent Set Problem Given: G = ( V , E ) and b . Find: An independent set for G of size ≥ b . I.e., Find U ⊆ V with | U | ≥ b and ( ∀ u , v ∈ U )[( u , v ) / ∈ E ] . Puzzle: These are very different looking problems. How to we get a reduction? Think circuits, but not too literally. NP-Completeness (DPV Chapter 8) April 15, 2019 5 / 35

  7. 3SAT � Independent Set, 2 To build a satisfying assignment of an instance of 3SAT, we have to pick out at least one literal per clause to be T RUE — consistently! NP-Completeness (DPV Chapter 8) April 15, 2019 6 / 35

  8. 3SAT � Independent Set, 2 To build a satisfying assignment of an instance of 3SAT, we have to pick out at least one literal per clause to be T RUE — consistently! Consider: ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ ( x ∨ y ) . y y y y x z x z x z x NP-Completeness (DPV Chapter 8) April 15, 2019 6 / 35

  9. 3SAT � Independent Set, 2 To build a satisfying assignment of an instance of 3SAT, we have to pick out at least one literal per clause to be T RUE — consistently! Consider: ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ ( x ∨ y ) . A clause ( ℓ 1 ∨ ℓ 2 ∨ ℓ 3 ) is represented by a triangle with verts labeled: ℓ 1 , ℓ 2 , & ℓ 3 . y y y y x z x z x z x NP-Completeness (DPV Chapter 8) April 15, 2019 6 / 35

  10. 3SAT � Independent Set, 2 To build a satisfying assignment of an instance of 3SAT, we have to pick out at least one literal per clause to be T RUE — consistently! Consider: ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ ( x ∨ y ) . A clause ( ℓ 1 ∨ ℓ 2 ∨ ℓ 3 ) is represented by a triangle with verts labeled: ℓ 1 , ℓ 2 , & ℓ 3 . Idea: If v ∈ U an indep. set and v has label ℓ , then the truth assignment corresponding to U sets ℓ to T RUE . y y y y x z x z x z x NP-Completeness (DPV Chapter 8) April 15, 2019 6 / 35

  11. 3SAT � Independent Set, 2 To build a satisfying assignment of an instance of 3SAT, we have to pick out at least one literal per clause to be T RUE — consistently! Consider: ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ ( x ∨ y ) . A clause ( ℓ 1 ∨ ℓ 2 ∨ ℓ 3 ) is represented by a triangle with verts labeled: ℓ 1 , ℓ 2 , & ℓ 3 . Idea: If v ∈ U an indep. set and v has label ℓ , then the truth assignment corresponding to U sets ℓ to T RUE . Set g = # of clauses. So any indep. set must have one vertex from each triangle. (Why?) y y y y x z x z x z x NP-Completeness (DPV Chapter 8) April 15, 2019 6 / 35

  12. 3SAT � Independent Set, 2 To build a satisfying assignment of an instance of 3SAT, we have to pick out at least one literal per clause to be T RUE — consistently! Consider: ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ ( x ∨ y ) . A clause ( ℓ 1 ∨ ℓ 2 ∨ ℓ 3 ) is represented by a triangle with verts labeled: ℓ 1 , ℓ 2 , & ℓ 3 . Idea: If v ∈ U an indep. set and v has label ℓ , then the truth assignment corresponding to U sets ℓ to T RUE . Set g = # of clauses. So any indep. set must have one vertex from each triangle. (Why?) But we have to have consistency checks. We don’t want to set x and x to T RUE . y y y y x z x z x z x NP-Completeness (DPV Chapter 8) April 15, 2019 6 / 35

  13. 3SAT � Independent Set, 2 To build a satisfying assignment of an instance of 3SAT, we have to pick out at least one literal per clause to be T RUE — consistently! Consider: ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ ( x ∨ y ) . A clause ( ℓ 1 ∨ ℓ 2 ∨ ℓ 3 ) is represented by a triangle with verts labeled: ℓ 1 , ℓ 2 , & ℓ 3 . Idea: If v ∈ U an indep. set and v has label ℓ , then the truth assignment corresponding to U sets ℓ to T RUE . Set g = # of clauses. So any indep. set must have one vertex from each triangle. (Why?) But we have to have consistency checks. We don’t want to set x and x to T RUE . So put an edge between each occurrence of a variable x and each occurrence of x . This enforces consistency. (Why?) y y y y x z x z x z x NP-Completeness (DPV Chapter 8) April 15, 2019 6 / 35

  14. 3SAT � Independent Set, 3 Construction: 3SAT instance � → IS instance Given an instance of 3SAT C 1 , . . . , C k . For each clause C i = ( ℓ 1 , ℓ 2 , ℓ 3 ) , build a triangle with vertices labeled ℓ 1 , ℓ 2 , & ℓ 3 . Add an edge between each literal and all of its opposites. Set g = k . Construction: IS solution �→ 3SAT solution Given an independent set U : for each v ∈ U with label ℓ , set ℓ to T RUE . For each variable that does not yet have a truth value, set it to T RUE . y y y y ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ x z x z x z x ( x ∨ y ) NP-Completeness (DPV Chapter 8) April 15, 2019 7 / 35

  15. 3SAT � Independent Set, 3 Construction: 3SAT instance � → IS instance Given an instance of 3SAT C 1 , . . . , C k . For each clause C i = ( ℓ 1 , ℓ 2 , ℓ 3 ) , build a triangle with vertices labeled ℓ 1 , ℓ 2 , & ℓ 3 . Add an edge between each literal and all of its opposites. Set g = k . Construction: IS solution �→ 3SAT solution Given an independent set U : for each v ∈ U with label ℓ , set ℓ to T RUE . For each variable that does not yet have a truth value, set it to T RUE . Claim 1: Both constructions are poly-time. Claim 2: Given an indep. set, we can construct a satisfying assignment for C 1 , . . . , C k . Claim 3 ′ : If C 1 , . . . , C k has an satisfying assignment, then there is size g indep. set. y y y y ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ ( x ∨ y ∨ z ) ∧ z x z x z x x ( x ∨ y ) NP-Completeness (DPV Chapter 8) April 15, 2019 7 / 35

  16. The Plan of § 8.3 All of NP S AT 3S AT I NDEPENDENT SET 3D MATCHING V ERTEX COVER C LIQUE ZOE S UBSET SUM ILP R UDRATA CYCLE TSP NP-Completeness (DPV Chapter 8) April 15, 2019 8 / 35

  17. SAT � 3SAT Construction: SAT instance � → 3SAT instance Translate each clause to sequence of clauses. ( ℓ 1 ∨ ℓ 2 ∨ · · · ∨ ℓ k ) �→ ( ℓ 1 ∨ ℓ 2 ∨ y 1 ) ( y 1 ∨ ℓ 3 ∨ y 2 ) · · · ( y k − 3 ∨ ℓ k − 1 ∨ ℓ k ) where k > 3 and y 1 , . . . , y k − 3 are new vars. Clauses with ≤ 3 literals translate to themselves. Construction: 3SAT solution �→ SAT solution Take the truth assignment for the 3SAT formula & restrict it to the original vars. NP-Completeness (DPV Chapter 8) April 15, 2019 9 / 35

  18. SAT � 3SAT Construction: SAT instance � → 3SAT instance Translate each clause to sequence of clauses. ( ℓ 1 ∨ ℓ 2 ∨ · · · ∨ ℓ k ) �→ ( ℓ 1 ∨ ℓ 2 ∨ y 1 ) ( y 1 ∨ ℓ 3 ∨ y 2 ) · · · ( y k − 3 ∨ ℓ k − 1 ∨ ℓ k ) where k > 3 and y 1 , . . . , y k − 3 are new vars. Clauses with ≤ 3 literals translate to themselves. Construction: 3SAT solution �→ SAT solution Take the truth assignment for the 3SAT formula & restrict it to the original vars. Claim 1: Both constructions are poly-time. NP-Completeness (DPV Chapter 8) April 15, 2019 9 / 35

Recommend


More recommend