NP Completeness Piyush Kumar. Today Reductions Proving Lower Bounds revisited Decision and Optimization Problems SAT and 3-SAT P Vs NP Dealing with NP-Complete.

Slides:



Advertisements
Similar presentations
Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
Advertisements

Polynomial-time reductions We have seen several reductions:
NP-Completeness: Reductions
The Theory of NP-Completeness
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
© The McGraw-Hill Companies, Inc., Chapter 8 The Theory of NP-Completeness.
Complexity 16-1 Complexity Andrei Bulatov Non-Approximability.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Introduction to Approximation Algorithms Lecture 12: Mar 1.
Transitivity of  poly Theorem: Let ,  ’, and  ’’ be three decision problems such that   poly  ’ and  ’  poly  ’’. Then  poly  ’’. Proof:
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
NP-Complete Problems Problems in Computer Science are classified into
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
88- 1 Chapter 8 The Theory of NP-Completeness P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class.
Analysis of Algorithms CS 477/677
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
Chapter 11: Limitations of Algorithmic Power
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
P, NP, and NP-Complete Suzan Köknar-Tezel.
1 The Theory of NP-Completeness 2 NP P NPC NP: Non-deterministic Polynomial P: Polynomial NPC: Non-deterministic Polynomial Complete P=NP? X = P.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
Chapter 11 Limitations of Algorithm Power. Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples:
A. Levitin “Introduction to the Design & Analysis of Algorithms,” 3rd ed., Ch. 11 ©2012 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Lecture 22 More NPC problems
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
Prabhas Chongstitvatana1 NP-complete proofs The circuit satisfiability proof of NP- completeness relies on a direct proof that L  p CIRCUIT-SAT for every.
Approximation Algorithms
Polynomial-time reductions We have seen several reductions:
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
Unit 9: Coping with NP-Completeness
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
Instructor Neelima Gupta Table of Contents Class NP Class NPC Approximation Algorithms.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
NP-Algorithms Tractable vs Intractable Some problems are intractable: as they grow large, we are unable to solve them in reasonable time.
CSE 589 Part V One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important. Bertrand Russell.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
NPC.
CSC 413/513: Intro to Algorithms
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
1 The Theory of NP-Completeness 2 Review: Finding lower bound by problem transformation Problem X reduces to problem Y (X  Y ) iff X can be solved by.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
The Theory of NP-Completeness
More NP-Complete and NP-hard Problems
P & NP.
Richard Anderson Lecture 26 NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
ICS 353: Design and Analysis of Algorithms
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP-Completeness
Chapter 11 Limitations of Algorithm Power
The Theory of NP-Completeness
CSE 589 Applied Algorithms Spring 1999
Presentation transcript:

NP Completeness Piyush Kumar

Today Reductions Proving Lower Bounds revisited Decision and Optimization Problems SAT and 3-SAT P Vs NP Dealing with NP-Complete Problems –Average Case / Heuristics / Approx. Alg.

Convex Hulls and Sorting What are convex hulls? Given a program for computing convex hulls, can we use it to sort ?

Reduction from Sorting to CH –Given n real values x i, generate n 2D points on a parabola, e.g. (x i,x i 2 ). –Compute the (ordered) convex hull of the points. –The order of the convex hull points is the numerical order of the x i.

Reduction from Sorting to CH Does this imply a lower bound on computation of convex hulls?  (nlgn) ? Sorting  p CH  p : Can also be read as –“No harder to solve than”

Polynomial time reductions If P is polynomial-time reducible to Q, we will use the notation P  p Q P  p Q and Q  p R –Implies P  p R

Review : P, NP Set of problems : P, NP P = Can be solved in polynomial time NP = You can verify the solution in polynomial time P  NP ? P = NP ? (Probably not?)

definitions NP-Hard : For all R in NP, R  p T –Implies T is NP-Hard NP-Complete –T is both in NP and NP-Hard

Definitions : Revisited NP-Hard –If you can solve it, you can solve everything in NP NP-Complete –NP-Hard and in NP NP : Non-Deterministic Polynomial time. ( Guess and verify )

P NP NP- complete NP-hard Primality testing Semidefinite programming … Hamilton cycle, Independent Set, Vertex Cover, Graph 3-coloring, Satisfiability … Factoring … Halting Problem Assuming P  NP

Decision Vs Optimization Decision Problem: computational problem with intended output of “yes” or “no”, 1 or 0 Optimization Problem: computational problem where we try to maximize or minimize some value Introduce parameter k and ask if the optimal value for the problem is a most or at least k. Turn optimization into decision

Decision Vs Optimization Optimization Problem: TSP Decision problem –Is their a tour of length < k? Simplification: Worry only about decision problems. The class P, NP, NPC, NPH all constitute of only decision problems.

Cook’s Theorem Theorem (Cook 1970) SAT is NP-Complete. –CNF-SAT is also NP-Complete. Corollary 3-SAT is NP-Complete. Proof of Corollary –How do we prove it? –Recall the defn of NP-Complete

Proving NP Completeness What steps do we have to take to prove a problem P is NP-Complete? –A problem P is NP-complete if 1. it is in NP 2.  B  NP, B  p P (it is NP-Hard) –Idea for condition 2 : Use a known NP-Complete problem Q. –Show Q  p P. By transitivity of  p, we are done  B  NP, B  p Q  p P Hence :  B  NP, B  p P

Algorithm for P Reduction R R(x) Input for P Output for P yes/no Output for Q x Input for Q Reduction revisited: ( Q  P) Algorithm for solving Q

3-SAT is NP-Complete 3-SAT is in NP (Trivial) We will pick Q to be CNF-SAT To show : CNF-SAT  P 3-SAT. Let ∏ be the given CNF formula. We want to transform ∏ to an instance of 3-CNF. Idea: Transform each clause of ∏ so that it is 3-CNF

CNF-SAT to 3-SAT If less than 3 literals, repeat them. –Replace (a 1  a 2 ) by (a 1 ∨ a 2 ∨ a 2 ) If 3 literals, leave it as it is.

CNF-SAT to 3-SAT 4 literals : Replace (a 1  a 2  a 3  a 4 ) by (a 1  a 2  z)  (  z  a 3  a 4 ) In general, replace (a 1  a 2    a k ) by (a 1  a 2  z 1 )  (  z 1  a 3  z 2 )  (  z 2  a 4  z 3 )    (  z k-3  a k-1  a k ) – z 1, , z k-3 : new variables –This is analogous to the 4 literal case, just applied multiple times with more variables.

3-SAT is NP-Complete 3-SAT is in NP CNF-SAT  P 3-SAT –Since we can transform an input to the CNF-SAT problem in polynomial time to the 3-SAT problem solver and get a solution to CNF-SAT. Hence CNF- SAT is ‘no harder to solve than’ 3- SAT.

Other NP-Complete Problems Hamiltonian Cycle Of size k? –Vertex cover : A vertex cover of G is a set C  V such that all edges of E have at least one endpoint in C. –Clique : Find in a given graph G, if there is a size k clique?

Other NP-Complete Problems Set Cover : Given n sets, are there k sets out of these whose union is the same as the union of n sets? Subset Sum : Given a set of integers, and another integer k; Is there a subset of them that sum upto k?

Toy Problem TSP is NP-Complete –Decision Version: Does  a TSP with cost < k ? – Is TSP in NP? – What problem should we pick to prove this?

Approximation Algorithms For some NP-Complete problems, there are polynomial time algorithms that give near optimal solutions.

Vertex cover

VC is NP-Complete –(can be reduced from 3-SAT)

Approximation Alg for VC 1.S   2.E  E[G] 3.while E  4.let (u,v) be am arbitrary edge in E 5.S  S  {u,v} 6.remove from E every edge incident on either u or v 7.return S

example

2-Factor : Proof The vertex cover output by the approximation algorithm is no more than twice the size of the optimal vertex cover. Why?