CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.

Slides:



Advertisements
Similar presentations
1 NP-completeness Lecture 2: Jan P The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many.
Advertisements

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 
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
February 23, 2015CS21 Lecture 201 CS21 Decidability and Tractability Lecture 20 February 23, 2015.
Approximation Algorithms Lecture for CS 302. What is a NP problem? Given an instance of the problem, V, and a ‘certificate’, C, we can verify V is in.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
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.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
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
CSEP 521 Applied Algorithms Richard Anderson Lecture 10 NP Completeness.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
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.
Unit 9: Coping with NP-Completeness
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness and course wrap up.
NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
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.
CSE 6311 – Spring 2009 ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS Lecture Notes – Feb. 3, 2009 Instructor: Dr. Gautam Das notes by Walter Wilson.
NPC.
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.
CSC 413/513: Intro to Algorithms
1 Ch 10 - NP-completeness Tractable and intractable problems Decision/Optimization problems Deterministic/NonDeterministic algorithms Classes P and NP.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
CSE 421 Algorithms Richard Anderson Lecture 28 Survey of NP Complete Problems NP-Complete P.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
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.
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
Richard Anderson Lectures NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
Richard Anderson Lecture 29 NP-Completeness and course wrap-up
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Richard Anderson Lecture 26 NP-Completeness
Hard Problems Introduction to NP
Richard Anderson Lecture 25 Min Cut Applications and NP-Completeness
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
Intro to Theory of Computation
CS154, Lecture 16: More NP-Complete Problems; PCPs
ICS 353: Design and Analysis of Algorithms
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP-Completeness
Richard Anderson Lecture 29 NP-Completeness
Richard Anderson Lecture 30 NP-Completeness
Richard Anderson Lecture 28 NP Completeness
Richard Anderson Lecture 27 NP Completeness
CS 3343: Analysis of Algorithms
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness Yin Tat Lee
CSE 6408 Advanced Algorithms.
CS154, Lecture 16: More NP-Complete Problems; PCPs
Richard Anderson Lecture 27 Survey of NP Complete Problems
CSE 589 Applied Algorithms Spring 1999
Richard Anderson Lecture 25 NP Completeness
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Presentation transcript:

CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness

Algorithms vs. Lower bounds Algorithmic Theory –What we can compute I can solve problem X with resources R –Proofs are almost always to give an algorithm that meets the resource bounds Lower bounds –How do we show that something can’t be done?

Theory of NP Completeness

The Universe NP-Complete NP P

Polynomial Time P: Class of problems that can be solved in polynomial time –Corresponds with problems that can be solved efficiently in practice –Right class to work with “theoretically”

What is NP? Problems solvable in non-deterministic polynomial time... Problems where “yes” instances have polynomial time checkable certificates

Decision Problems Theory developed in terms of yes/no problems –Independent set Given a graph G and an integer K, does G have an independent set of size at least K –Vertex cover Given a graph G and an integer K, does the graph have a vertex cover of size at most K.

Certificate examples Independent set of size K –The Independent Set Satifisfiable formula –Truth assignment to the variables Hamiltonian Circuit Problem –A cycle including all of the vertices K-coloring a graph –Assignment of colors to the vertices

Polynomial time reductions Y is Polynomial Time Reducible to X –Solve problem Y with a polynomial number of computation steps and a polynomial number of calls to a black box that solves X –Notations: Y < P X

Lemma Suppose Y < P X. If X can be solved in polynomial time, then Y can be solved in polynomial time.

Lemma Suppose Y < P X. If Y cannot be solved in polynomial time, then X cannot be solved in polynomial time.

NP-Completeness A problem X is NP-complete if –X is in NP –For every Y in NP, Y < P X X is a “hardest” problem in NP If X is NP-Complete, Z is in NP and X < P Z –Then Z is NP-Complete

Cook’s Theorem The Circuit Satisfiability Problem is NP- Complete

Garey and Johnson

History Jack Edmonds –Identified NP Steve Cook –Cook’s Theorem – NP-Completeness Dick Karp –Identified “standard” collection of NP-Complete Problems Leonid Levin –Independent discovery of NP-Completeness in USSR

Populating the NP-Completeness Universe Circuit Sat < P 3-SAT 3-SAT < P Independent Set 3-SAT < P Vertex Cover Independent Set < P Clique 3-SAT < P Hamiltonian Circuit Hamiltonian Circuit < P Traveling Salesman 3-SAT < P Integer Linear Programming 3-SAT < P Graph Coloring 3-SAT < P Subset Sum Subset Sum < P Scheduling with Release times and deadlines

Cook’s Theorem The Circuit Satisfiability Problem is NP- Complete Circuit Satisfiability –Given a boolean circuit, determine if there is an assignment of boolean values to the input to make the output true

Circuit SAT AND OR AND OR ANDNOTOR NOT x1x1 x2x2 x3x3 x4x4 x5x5 AND NOT AND OR NOT AND OR AND Find a satisfying assignment

Proof of Cook’s Theorem Reduce an arbitrary problem Y in NP to X Let A be a non-deterministic polynomial time algorithm for Y Convert A to a circuit, so that Y is a Yes instance iff and only if the circuit is satisfiable

Satisfiability Given a boolean formula, does there exist a truth assignment to the variables to make the expression true

Definitions Boolean variable: x 1, …, x n Term: x i or its negation !x i Clause: disjunction of terms –t 1 or t 2 or … t j Problem: –Given a collection of clauses C 1,..., C k, does there exist a truth assignment that makes all the clauses true –(x 1 or !x 2 ), (!x 1 or !x 3 ), (x 2 or !x 3 )

3-SAT Each clause has exactly 3 terms Variables x 1,..., x n Clauses C 1,..., C k –C j = (t j1 or t j2 or t j3 ) Fact: Every instance of SAT can be converted in polynomial time to an equivalent instance of 3-SAT

Find a satisfying truth assignment (x || y || z) && (!x || !y || !z) && (!x || y) && (x || !y) && (y || !z) && (!y || z)

Theorem: CircuitSat < P 3-SAT

Theorem: 3-SAT < P IndSet

Sample Problems Independent Set –Graph G = (V, E), a subset S of the vertices is independent if there are no edges between vertices in S

Vertex Cover –Graph G = (V, E), a subset S of the vertices is a vertex cover if every edge in E has at least one endpoint in S

IS < P VC Lemma: A set S is independent iff V-S is a vertex cover To reduce IS to VC, we show that we can determine if a graph has an independent set of size K by testing for a Vertex cover of size n - K

IS < P VC Find a maximum independent set S Show that V-S is a vertex cover

Clique –Graph G = (V, E), a subset S of the vertices is a clique if there is an edge between every pair of vertices in S

Complement of a Graph Defn: G’=(V,E’) is the complement of G=(V,E) if (u,v) is in E’ iff (u,v) is not in E Construct the complement

IS < P Clique Lemma: S is Independent in G iff S is a Clique in the complement of G To reduce IS to Clique, we compute the complement of the graph. The complement has a clique of size K iff the original graph has an independent set of size K

Hamiltonian Circuit Problem Hamiltonian Circuit – a simple cycle including all the vertices of the graph

Thm: Hamiltonian Circuit is NP Complete Reduction from 3-SAT

Traveling Salesman Problem Given a complete graph with edge weights, determine the shortest tour that includes all of the vertices (visit each vertex exactly once, and get back to the starting point) Find the minimum cost tour

NP-Completeness Reductions If X is NP-Complete, Y is in NP, and X < P Y, then Y is NP-Complete

Hamiltonian Circuit, Hamiltonian Path How do you show that Hamiltonian Path is NP-Complete?

Local Modification Convert G to G’ Pick a vertex v –Replace v by v’ and v’’ –If (u,v) is an edge, include edges (u, v’), (u, v’’) G’ has a Hamiltonian Path from v’ to v’’ iff G has a Hamiltonian Circuit

HamPath < P DirHamPath How do you show that Directed Hamiltonian Path is NP-Complete?

Problem definition Given a graph G, does G have an independent set? Given a graph G, does G have an independent set of size 7? Given a graph G, and an integer K, does G have an independent set of size K?

Graph Coloring NP-Complete –Graph K-coloring –Graph 3-coloring Polynomial –Graph 2-Coloring

Number Problems Subset sum problem –Given natural numbers w 1,..., w n and a target number W, is there a subset that adds up to exactly W? Subset sum problem is NP-Complete Subset Sum problem can be solved in O(nW) time

Subset sum problem The reduction to show Subset Sum is NP- complete involves numbers with n digits In that case, the O(nW) algorithm is an exponential time and space algorithm

What is NP? Problems where ‘yes’ instances can be efficiently verified –Hamiltonian Circuit –3-Coloring –3-SAT Succinct certificate property

What about ‘negative instances’ How do you show that a graph does not have a Hamiltonian Circuit How do you show that a formula is not satisfiable?

What we don’t know P vs. NP NP-Complete NP P NP = P