Download presentation
Presentation is loading. Please wait.
1
P & NP
2
P & NP
3
How to prove a problem is NP-Complete
4
P & NP
5
NP problems
6
Hamiltonian Cycle/Circuit is NP
Non Determinism: Input is Graph G(V,E). Select the vertices from set “V”. Total number of selections = n+1 If the selected vertex is already present in the set, then again re-start the selection. (Once unique selection set is generated, perform verification). Verification: Check if there exist edge between each two selected vertices and including “n” and “n+1”. The solution generation requires O(n) time and solution verification requires O(E) time. The algorithm results in “YES” or “NO” depending upon the condition. Hence HC problem is NP
7
Circuit SAT is NP Circuit SAT
8
Circuit SAT A Boolean circuit is called as directed graph, where each node is represented as Logic Gate [AND, OR, NOT]. Circuit SAT problem takes input and “ask question whether assignment of input results in output = 1. Such problems are also called as “satisfying assignment” problems. Non Determinism First apply an arbitrary set of input x[1001] to the circuit and at each gate generate the output. Verification Check whether the final output is “1”, if not again change the input. The verification can be performed in polynomial time. Hence SAT problem is NP
9
Vertex cover problem is NP
VC: It is set of vertices of graph, which covers all the edges present in the graph. All the edges of the graph are incident on the vertices present in the VC set. VC problem is to find a set of size [k], containing the vertices covering all the edges. Non Determinism: Select the vertices from the given graph. The selection process is re-started if a vertex is selection is repeated. O(k) Verification Verify if all the edges present in the graph are incident on the selected vertices O(ExE)
10
Application of VC Synonym tree / Ontology tree
The root word will have edges to all Possible synonyms. The tree will be complex structure if constructed for more words. The base idea can be useful in deriving The key word and synonym. The key question to be answered: Why non-deterministic approach is preferred or applied for solving problems like: SAT, VC or HC ? Why deterministic approach is not feasible? The other set of problems discussed during class room sessions: CLIQUE, GPT, ISP
11
NP Completeness: Any problem or language “M” is classified as “NP-HARD” if There exist a set of language “L” already classified as “NP”. L = {L1, L2, L3 ….. } If it is possible to perform the reduction of any one component of L to M, in polynomial time, then “M” is declared as “NP-Hard” L M [In polynomial time] The language “M” or problem “M” need not belong to class of “NP” problem for getting classified as NP-Hard. If the problem “M” is NP, with all above conditions, then it is called as NP- Complete problem.
12
Proof for NP-Completeness
Important concept If L1 L2 [L1 reduces to L2 in polynomial time] and L2 L3, then L1L3.
13
NP Completeness: Proof (Three possibilities)
14
NP Completeness: Problem Tree
15
NP Completeness: Example: Clique & Vertex Cover
From previous discussion, it can be proved that Clique is NP. If it is required to prove Clique is NP Complete, we have to prove: Clique is NP [refer the class discussion and previous slides] Clique is NP Hard To prove Clique is NP-Hard, find a problem L, which is NP and can be reduced to Clique in polynomial time. And If both above claims are proved, then Clique is NP-Complete. In the following proof, Vertex Cover problem is used for proving Clique as NP-Complete Vertex Cover is NP The solution of vertex cover should be reduced in polynomial time to solve Clique For reduction, one of the three possibilities discussed, can be used. Also it is important to formulate a problem between Clique and VC, and use solution of one to derive solution of other problem.
16
Proof: Consider G1 and G2. Let (G,k) be the instance of Vertex Cover problem. For clique, construct a Compliment Graph, which has: Same number of vertices But Compliment edges We define integer parameter for clique as n-k where “k” is integer parameter for Vertex Cover. If G has clique of size (n-k) if and only if its compliment graph has Vertex cover of size “k” Further proof can be carried out using LOCAL REPLACEMENT
17
Some applications of NP problems
18
Reduction Principle
19
NP - Completeness The aim to study this class is not to solve a problem but to see how hard is a problem?
20
NP-Complete Problems The NP-Complete problems are an interesting class of problems whose status is unknown No polynomial-time algorithm has been discovered for an NP-Complete problem No supra-polynomial lower bound has been proved for any NP-Complete problem, either We call this the P = NP question The biggest open problem in CS
21
NP-completeness The theory of NP_completeness restricts its attention to decision problems only.
22
Reduction The crux of NP-Completeness is reducibility
Informally, a problem P can be reduced to another problem Q if any instance of P can be “easily rephrased” as an instance of Q, the solution to which provides a solution to the instance of P What do you suppose “easily” means? This rephrasing is called transformation or reduction Intuitively: If P reduces to Q, then if one can solve Q then one can solve P also, i.e. P is “no harder to solve” than Q or Q is at least as hard as P.
23
Reducibility An example: Another example:
P: Given a set of Booleans, is at least one TRUE? Q: Given a set of integers, is their sum positive? Transformation: (x1, x2, …, xn) = (y1, y2, …, yn) where yi = 1 if xi = TRUE, yi = 0 if xi = FALSE Another example: Solving linear equations is reducible to solving quadratic equations How can we easily use a quadratic-equation solver to solve linear equations?
24
Reducibility Formally, We say a language L1 (say corresponding to problem P) is polynomial time reducible to language L2 (say corresponding to problem Q) denoted by L1 p L2, if there exists a polynomial time computable function f : {0,1}* {0,1}* such that for all x in {0,1}* x is in L1 iff f(x) is in L2. The function f is called the reduction function and a polynomial time algorithm F that computes f is called a reduction algorithm.
25
NP - Complete Problem P is said to be NPC if P NP, and
Q p P Q NP That is, the problem is in NP and every other problem in NP is polynomial time reducible to P so that P is at least as hard as any other problem in NP.
26
NP-Hard and NP-Complete
If P is polynomial-time reducible to Q, we denote this P p Q Definition of NP-Hard and NP-Complete: If all problems R NP are reducible to P, then P is NP- Hard We say P is NP-Complete if P is NP-Hard and P NP If P p Q and P is NP-Complete, Q is also NP- Complete Very Important
27
Why Prove NP-Completeness?
Though nobody has proven that P != NP, if you prove a problem NP- Complete, most people accept that it is probably intractable Therefore it can be important to prove that a problem is NP- Complete Don’t need to come up with an efficient algorithm Can instead work on approximation algorithms
28
Proving NP-Completeness
What steps do we have to take to prove a problem P is NP-Complete? Pick a known NP-Complete problem Q Reduce Q to P Describe a transformation that maps instances of Q to instances of P, s.t. “yes” for P = “yes” for Q Prove the transformation works Prove it runs in polynomial time prove P NP (What if you can’t?)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.