Chapter 4: Using NP-Completeness to Analyze Subproblems

Slides:



Advertisements
Similar presentations
Covers, Dominations, Independent Sets and Matchings AmirHossein Bayegan Amirkabir University of Technology.
Advertisements

Orthogonal Drawing Kees Visser. Overview  Introduction  Orthogonal representation  Flow network  Bend optimal drawing.
Introduction to Kernel Lower Bounds Daniel Lokshtanov.
Generalization and Specialization of Kernelization Daniel Lokshtanov.
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.
The Theory of NP-Completeness
Complexity 11-1 Complexity Andrei Bulatov NP-Completeness.
Introduction to Approximation Algorithms Lecture 12: Mar 1.
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
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.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
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.
Lecture 22 More NPC problems
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
Techniques for Proving NP-Completeness Show that a special case of the problem you are interested in is NP- complete. For example: The problem of finding.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
NP-Complete problems.
1.1 Chapter 3: Proving NP-completeness Results Six Basic NP-Complete Problems Some Techniques for Proving NP-Completeness Some Suggested Exercises.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
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.
Given this 3-SAT problem: (x1 or x2 or x3) AND (¬x1 or ¬x2 or ¬x2) AND (¬x3 or ¬x1 or x2) 1. Draw the graph that you would use if you want to solve this.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
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.
CHAPTER SIX T HE P ROBABILISTIC M ETHOD M1 Zhang Cong 2011/Nov/28.
Theory of Computational Complexity Probability and Computing Chapter Hikaru Inada Iwama and Ito lab M1.
Young CS 530 Ad. Algo. D&A NP-Completeness1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey.
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
The NP class. NP-completeness
NP-Complete Problems.
Chapter 10 NP-Complete Problems.
Planar Graphs Hubert Chan (Chapter 9.7) [O2 Proof Techniques]
8.3.2 Constant Distance Approximations
8.2 – Strong NP Completeness
Introduction to Approximation Algorithms
Richard Anderson Lecture 26 NP-Completeness
COMPLEXITY THEORY IN PRACTICE
Computability and Complexity
Richard Anderson Lecture 26 NP-Completeness
Hard Problems Introduction to NP
NP-Completeness Yin Tat Lee
Analysis and design of algorithm
ICS 353: Design and Analysis of Algorithms
Complexity 6-1 The Class P Complexity Andrei Bulatov.
Parameterised Complexity
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP-Completeness
Chapter 8 NP and Computational Intractability
NP-Complete Problems.
CS 3343: Analysis of Algorithms
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness Yin Tat Lee
CSE 6408 Advanced Algorithms.
Copyright © Cengage Learning. All rights reserved.
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
Pseudo-polynomial time algorithm (The concept and the terminology are important) Partition Problem: Input: Finite set A=(a1, a2, …, an} and a size s(a)
Complexity Theory in Practice
The Theory of NP-Completeness
Trevor Brown DC 2338, Office hour M3-4pm
Complexity Theory in Practice
CSC 380: Design and Analysis of Algorithms
Richard Anderson Lecture 25 NP Completeness
Instructor: Aaron Roth
Instructor: Aaron Roth
CHAPTER 7 Time complexity
Presentation transcript:

Chapter 4: Using NP-Completeness to Analyze Subproblems Analyzing sub-problems Number problems & strong NP-completeness Time complexity as a function of natural parameters

Introduction Proving a problem NP-complete is not the end, but rather the beginning: Sub-problems (special cases) may be solved in polynomial time Heuristics with provable performance bounds may exist Pseudo-polynomial time algorithms may exist An actual occurrence of the problem in the real world may, in fact, be a special case.

Sub-Problems Recall that a problem  consists of: a set D of instances, and a set Y’ ⊆ D of “yes” instances A sub-problem of a problem  = (Y’, D) is a problem ’ = (Y’’, D’) where: D’ ⊆ D, and Y’’ = Y ∩ D’ Note that a sub-problem is sometimes referred to as a special case. Normally the set of instances is a proper subset of the original problem. Also note that, technically, every problem is a sub-problem of itself. This is the same concept used restriction, just used differently. With restriction we know the second problem is NP-complete, whereas in our consideration of sub-problems, we know the first problem is NP-complete.

Examples of Restrictions Graph problems: vertex degree limits planarity, bipartite, acyclic Set problems: limits on set sizes number of common elements between sets total number of sets Logic problems: size of clauses number of times a literal occurs Scheduling problems: limits on task lengths, deadlines, orderings Arbitrary parameters: number of colors, assignments, bins Normally the set of instances is a proper subset of the original problem. Also note that, technically, every problem is a sub-problem of itself. Sounds a bit like restriction, and in fact, it is the same basic technique. The difference is in how we use it. With restriction we know the second problem is NP-complete, whereas in our consideration of sub-problems, we know the first problem is NP-complete.

Examples of Sub-Problems Satisfiability sub-problems: 2-SAT, 3-SAT, 4-SAT, K-SAT for any fixed K ≥ 0. Each clause contains only “positive” variables, or “negative” variables. Each literal occurs in at most 5 clauses (more generally K clauses, for fixed K ≥ 1) Note that 3SAT is not a sub-problem of 4SAT. Similarly, 3DM is not a sub-problem of 4DM. Note, however, that AM3SAT is a sub-problem of AM4SAT (what the heck is AM?).

Examples of Sub-Problems Thus, a problem  may have many sub-problems, many of which are sub-problems of each other. Any of these, including , may be NP-complete or solvable in polynomial time. Note, however, that if a  ∊ P then every sub-problem ’ ∊ P. SAT AM4SAT AM3SAT AM2SAT

Examples of Sub-Problems Graph colorability sub-problems: Graph colorability for planar graphs. Graph 2-colorability, 3-colorability, K-colorability for any fixed K ≥ 0. Graph K-colorability for planar graphs, for any fixed K ≥ 0. Graph K-colorability for graphs where no vertex has degree exceeding J, for any fixed J ≥ 0 and any fixed K ≥ 0. Graph K-colorability for planar graphs where no vertex has degree exceeding J, for any fixed J ≥ 0 and any fixed K ≥ 0. Graph K-colorability for acyclic planar graphs where no vertex has degree exceeding J, any fixed J ≥ 0 and any fixed K ≥ 0. Exercise – draw the boundary diagram for the above set of problems.

General Approach to Proving Complexity Results How does one approach a new problem or sub-problem? Obsessively pursue an NP-completeness proof. Obsessively pursue a polynomial-time algorithm. Alternate between the two, until one approach leads to success. Alternate between related sub-problems, pursuing both NP-completeness results, and polynomial-time algorithms. Place special emphasis on the border between the unknown and the known. For NP-completeness proofs: Modify an NP-completeness proof for the more general problem so that it applies to the sub-problem. Transform the more general problem, known to be NP-complete, to the sub-problem.

3-Dimensional Matching attempt to constrain the NP-completeness proof for this problem to apply to the sub-problem attempt to generalize the poly-time algorithm for this problem to apply to the more general problem A good example of this is the way Steve Hedetniemi’s Friday seminar worked. All they did was look at various sub-problems. The hierarchy they developed was huge.

Precedence Constrained Scheduling INSTANCE: A finite set T of “tasks” (each assumed to have “length” 1), a partial order ⋖ on T, a number m  Z+ of “processors,“ and an overall “deadline” D  Z+. QUESTION: Is there a “schedule” σ:T→{0,1,…,D} such that for each i ∈ {0,1,…,D}, |{t∊T: σ(t) = i}| ≤ m, and such that , whenever t ⋖ t’ , then σ(t) < σ(t’)? Other scheduling problems we have considered: MULTIPROCESSOR SCHEDULING INSTANCE: A finite set A of “tasks,” a “length” l(a)  Z+ for each a  A, a number m  Z+ of “processors,“ and a “deadline” D  Z+. QUESTION: Is there a partition A = A1 ∪ A2 ∪ … ∪ Am of A into m disjoint sets such that: It is not unusual for some students to think PCS is a special case of MS, mainly because the former has task lengths restricted to 1. However, because PCS has a partial order, while MS does not, it is therefore not a special case. Sometimes students want to just ignore the partial order in an instance of PCS to get an instance of MS. However,Consider the following no-instance of PCS: t1, t1, t2, t4 m = 2 d = 4 t1<t2, t2<t3, t3<t4,t4<t1 If you drop the partial order, and set the task lengths to all 1, you get a no-instance of MS. Thus, it doesn’t preserve yes instances.

Precedence Constrained Scheduling INSTANCE: A finite set T of “tasks” (each assumed to have “length” 1), a partial order ⋖ on T, a number m  Z+ of “processors,“ and an overall “deadline” D  Z+. QUESTION: Is there a “schedule” σ:T→{0,1,…,D} such that for each i ∈ {0,1,…,D}, |{t∊T: σ(t) = i}| ≤ m, and such that , whenever t ⋖ t’ , then σ(t) < σ(t’)? Other scheduling problems we have considered: MINIMUM TARDINESS SEQUENCING INSTANCE: A finite set T of “tasks,” each t  T having “length” 1 and a “deadline” d(t)  Z+, a partial order ⋖ on T, and a non-negative integer K ≤ |T|. QUESTION: Is there a “schedule” σ:T→{0,1,…,|T|-1} such that σ(t) ≠ σ(t’) whenever t ≠ t’, such σ(t) < σ(t’) whenever t ⋖ t’ , and such that |{t∊T: σ(t)+1>d(t)}|≤K? MTD can be restricted to PCS by considering those instances where d(t) is the same for all the tasks, and where k=0. This is incorrect because there is no # of processors in the MTD instance.

Precedence Constrained Scheduling INSTANCE: A finite set T of “tasks” (each assumed to have “length” 1), a partial order ⋖ on T, a number m  Z+ of “processors,“ and an overall “deadline” D  Z+. QUESTION: Is there a “schedule” σ:T→{0,1,…,D} such that for each i ∈ {0,1,…,D}, |{t∊T: σ(t) = i}| ≤ m, and such that , whenever t ⋖ t’ , then σ(t) < σ(t’)? Current state of knowledge concerning PCS sub-problems: “m arbitrary” means part of the problem instance When we say “m arbitrary” we mean part of the problem instance, or rather, input. Similarly for graph-colorability, for arbitrary K, NP-complete, and for fixed K>=3 NP-complete also. Might be interesting to consider if the partial order is an acyclic graph. When the partial order is empty, the schedule is trivial. *Figure is incorrect in book where m≤3

Vertex Degree Bounds on Graphs For graph problems a common restriction is on the degree of a vertex, i.e., a maximum bound on the number of adjacent vertices for a given vertex. Many problem become solvable in polynomial time when the maximum degree of a vertex is bounded. In P for d(v)≤ NP-complete for d(v)≥ VERTEX COVER 2 3 HAMILTONIAN CIRCUIT 2 3 GRAPH 3-COLORABILITY 3 4 FEEDBACK VERTEX SET 2 3

Vertex Degree Bounds on Graphs How about the CLIQUE problem? For any fixed upper bound on d(v), the CLIQUE problem is solvable in polynomial time. Observation - If a graph G has d(v) ≤ D then the largest clique it can contain is at most D+1. Algorithm: input: Graph G with d(v)≤D, for all v, and an integer J≥0; if (J ≥ D+1) then print(“no”); else { for (each subset S of D+1 vertices or less) { if (S forms a clique) { print(“yes”); return; } return “no”; Since D is fixed, it follows that the above runs in polynomial time.

Graph 3-Colorability Recall Graph K-Colorability (for arbitrary K): INSTANCE: A Graph G = (V, E), positive integer K ≤ |V|. QUESTION: Is G K-colorable, that is, does there exist a function f :V→{1,2,…,K} such that f(u) ≠ f(v) whenever {u, v} ∊ E? Fact: GKC is NP-complete.

Graph 3-Colorability Also, Graph K-colorability is NP-complete for any fixed K≥3. For example – G3C is NP-complete: GRAPH 3-COLORABILITY INSTANCE: A Graph G = (V, E). QUESTION: Is G 3-colorable, that is, does there exist a function f :V→{1,2,3} such that f(u) ≠ f(v) whenever {u, v} ∊ E? Fact: G3C is NP-complete.

Graph 3-Colorability How about G3C, where d(v) ≤ 4, for all v. GRAPH 3-COLORABILITY WITH RESTRICTED DEGREE INSTANCE: A Graph G = (V, E), where d(v) ≤ 4, for all v ∊ V. QUESTION: Is G 3-colorable, that is, does there exist a function f :V→{0,1,3} such that f(u) ≠ f(v) whenever {u, v} ∊ E? Theorem 4.1: GRAPH 3-COLORABILITY with no vertex degree exceeding 4 is NP-complete. Proof: 1) Membership in NP follows immediately from that for the general problem. 2) G3C  G3CRD

Graph 3-Colorability Consider the following graph: Observations: d(v) ≤ 4 The graph is 3-colorable In any 3-coloring of the graph, all “outer” vertices are the same color

Graph 3-Colorability Now consider the following graph, which has the same properties: Observations: d(v) ≤ 4 The graph is 3-colorable In any 3-coloring of the graph, all “outer” vertices are the same color Given a graph G, replace each vertex with d(v) ≥ 5 by this subgraph (of an appropriate size). It follows that the resulting graph G’: has d(v) ≤ 4 is 3-colorable if and only if G is 3-colorable. In a real world application, vertex degrees might be limited. This is a good example of where someone might look at a real world problem and conclude that the problem is NP-complete. Had they looked a bit more closely, however, the might have noticed that in that particular application, vertex degree is at most 4.

Vertex Degree Bounds on Graphs Another restriction for graph problems that frequently results in polynomial time complexity, is by restricting a problem to planar graphs. A graph is planar if it can be embedded in the plane by identifying each vertex with a unique point and each edge with a line (not necessarily straight) connecting its endpoints, so that no two lines meet except at a common endpoint.

Subproblems Based on Planarity CLIQUE is solvable in polynomial time when restricted to planar graphs. Fact - A planar graph cannot contain a complete subgraph of more than 4 vertices. Algorithm: (for detecting a clique of size K in a planar graph) input: Planar graph G and integer K≥0; if (K ≥ 4) then print(“no”); else { for (each subset S of K vertices) { if (S forms a K-clique) { print(“yes”); return; } return “no”; Since K is at most 4, it follows that the above algorithm operates in polynomial O(nk) time.

Planar Graph 3-Colorability In contrast, GRAPH 3-COLORABILITY is NP-complete for planar graphs: PLANAR GRAPH 3-COLORABILITY INSTANCE: A planar graph G = (V, E). QUESTION: Is G 3-colorable, that is, does there exist a function f :V→{1,2,3} such that f(u) ≠ f(v) whenever {u, v} ∊ E? Fact: PG3C is NP-complete.