MCS 312 NPcompleteness and Approximation Algorithms Instructor Neelima

  • Slides: 21
Download presentation
MCS 312: NP-completeness and Approximation Algorithms Instructor: Neelima Gupta http: //people. du. ac. in/~ngupta/

MCS 312: NP-completeness and Approximation Algorithms Instructor: Neelima Gupta http: //people. du. ac. in/~ngupta/ 1

Table of Contents Class NP and Co-NP revisited Problem discussed Shortest Path Problem

Table of Contents Class NP and Co-NP revisited Problem discussed Shortest Path Problem

So far you must have seen… • • Polynomial time algorithms Exponential time algorithms

So far you must have seen… • • Polynomial time algorithms Exponential time algorithms Parallel algorithms Randomized algorithms

Optimization Problems you must have seen • • • Longest Common Subsequence Matrix Chain

Optimization Problems you must have seen • • • Longest Common Subsequence Matrix Chain Multiplication Optimal Binary Search Tree Activity Selection Problem Minimum Spanning Tree Shortest Path - Solvable in Polynomial Time by Dynamic Programming or Greedy Approach.

Optimization Vs Decision Problems • In case of Optimization problems, each feasible solution has

Optimization Vs Decision Problems • In case of Optimization problems, each feasible solution has an associated value, and we want the feasible solution with the ‘best’ value. • Eg: Shortest path problem-Given an undirected graph (G, s, t), we want to compute the shortest path from vertex s to vertex t (path using fewest edges).

Optimization & Decision Problems • In case of Decision problems, the answer to the

Optimization & Decision Problems • In case of Decision problems, the answer to the problem is a simple ‘yes’ or a ‘no’ (more formally, 1 or 0). • We can obtain a related decision problem for a given optimization problem by bounding the value to be optimized. • Eg: Shortest path problem (decision version 1) -Given an undirected graph (G, s, t, k), is there a path from vertex s to vertex t consisting of exactly k edges? • Shortest path problem (decision version 2) -Given an undirected graph (G, s, t, k), is there a path from vertex s to vertex t consisting of at most k edges?

Assignment 1 • Give the decision versions(both) for the following problems : i. iii.

Assignment 1 • Give the decision versions(both) for the following problems : i. iii. iv. v. Longest Common Subsequence Matrix Chain Multiplication Optimal Binary Search Tree Activity Selection Problem Minimum Spanning Tree

Class NP • The class of decision problems for which there is a polynomially

Class NP • The class of decision problems for which there is a polynomially bounded nondeterministic algorithm. • NP-completeness does not apply directly to optimization problems, but to decision problems. • We can obtain a decision version of an optimization problem, which will be “easier” or at least, “no harder” than the optimization problem. • Optimization problem is the harder of the two.

Verification • A Verification algorithm takes as an input, a problem instance, and a

Verification • A Verification algorithm takes as an input, a problem instance, and a certificate and decides whether it is a yes-instance. • A(x, y) = 1; iff, y is a valid certificate. input certificate instance • Eg: Shortest path (verification version) – Given an undirected graph (G, s, t, k, c), is c a path from vertex s to vertex t of length = (or <= for version 2) k? – Here, c will be a sequence of edges (path) from s to t.

Verification • Let L 1 - SP = {<G, s, t, k>: Э a

Verification • Let L 1 - SP = {<G, s, t, k>: Э a path from s to of length = k} • Let x SP, then we claim that Э a certificate y such that, <G, s, t, k, y> can be verified in polynomial time. – What is that? – Ans: Since x SP, Э a path from s to of length = k. This path itself serves as the certificate. – What does the verification algorithm do? – Ans: Check that the given sequence of vertices u 1 , u 2 , … um indeed forms a path in G and, – That its length is k i. e. m-1 = k.

Verification Algorithm • For every ui, – check if ui+1 is adjacent to it

Verification Algorithm • For every ui, – check if ui+1 is adjacent to it …. takes O(V) time Overall time for this step is O(V 2 ) • Checking that m – 1 <= k can be done in O(1) time. • Hence, we can verify the certificate in polynomial time.

Complement of Shortest Path Problem • Let L 2 - SPC = {<G, s,

Complement of Shortest Path Problem • Let L 2 - SPC = {<G, s, t, k>: !Э a path from s to t of length <=k} i. e. Is G a graph with no path between s and t of length <=k? • Big Q: Does there exist a certificate which can be verified for SPC in polynomial time? • Existence of one path satisfying the condition (yes) does not imply it is the only path i. e. we cannot confirm non-existence of other certificates.

Verification of SPC • In case of SP problem which is polynomial time solvable,

Verification of SPC • In case of SP problem which is polynomial time solvable, this certificate exists – – – – What is that? The shortest path itself. Can you verify it in polynomial time? yes What should the verification algorithm do? 1. Verify that given sequence of edges indeed form a path in G. 2. Verify that it is indeed the shortest (Important!! How? SP algorithm like Djikstra’s) – 3. Verify that its length is greater than k (the shortest path of length > k iff every path is of length > k i. e. iff there is no path of length <= k) • Hence SPC can also be verified in polynomial time.

Class ℕℙ & ℙ • ℙ : Set of problems which can be solved

Class ℕℙ & ℙ • ℙ : Set of problems which can be solved in polynomial time using deterministic algorithms. • ℕℙ : Set of problems which we can be verified i polynomial time. Eg: Shortest-path problem, even optimization problem belongs to class ℙ. NP P -P is a small part of NP. -Problems which cannot be verified in polynomial time are harder, and are outside NP.

CLASS Co- ℕℙ • Co- ℕℙ : Set of problems whose complement can be

CLASS Co- ℕℙ • Co- ℕℙ : Set of problems whose complement can be verified in polynomial time. • Q: Does SP belong to Co - ℕℙ? – Ans: Yes

SP belongs to NP ∩ Co-NP SP NP Is every polynomial time solvable problem

SP belongs to NP ∩ Co-NP SP NP Is every polynomial time solvable problem in NP ∩ Co. NP ?

Assignment 2 • Show that P is contained in NP ∩ Co-NP. i. e.

Assignment 2 • Show that P is contained in NP ∩ Co-NP. i. e. All polynomial time solvable problems and their complements are verifiable in polynomial time.

Open Questions? • Is P = NP? (Unlikely) • Is NP = Co-NP? (Unlikely)

Open Questions? • Is P = NP? (Unlikely) • Is NP = Co-NP? (Unlikely) • Is P = NP ∩ Co-NP?

The Class NP ∩ co-NP A problem that belongs to NP ∩ co-NP is

The Class NP ∩ co-NP A problem that belongs to NP ∩ co-NP is said to have a Good Characterization Ø It has short proofs for both “yes” and “no” instances. Ø An example problem belonging to NP ∩ co-NP The graph isomorphism problem Computational problem of determining whether two finite graphs are isomorphic.

Status of GI problem is unknown. It is neither known to be NP-Complete nor

Status of GI problem is unknown. It is neither known to be NP-Complete nor known to be in P, we’ll talk about NPCompleteness a little while later. The generalization of GI namely Subgraph Isomorphism is known to be NPC.

More NP Problems • • Satisfiability Independent Set Clique Vertex Cover Hamiltonian Cycle Subset

More NP Problems • • Satisfiability Independent Set Clique Vertex Cover Hamiltonian Cycle Subset Sum Set Cover