Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computational Complexity

Similar presentations


Presentation on theme: "Computational Complexity"— Presentation transcript:

1 Computational Complexity

2 Computational Complexity
Problem complexity vs. algorithmic complexity Upper bounds vs. lower bounds Exact solutions vs. approximate solutions Deterministic vs. randomized algorithms Time vs. space

3 Problem complexity vs. Algorithmic complexity
The computational complexity of an algorithm addresses the resources needed to run the algorithm. The computational complexity of a problem addresses the resources needed to solve the problem. These are not the same!

4 Upper vs. Lower bounds Upper Bounds (Algorithmic Theory) Lower bounds
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?

5 Exact vs. Approximate Algorithms
Finding the best Maximum Parsimony tree is NP-hard, but we can find a tree whose maximum parsimony score is no more than twice that of the optimal – and we can do that in polynomial time. So approximating the optimal solution is polynomial time, but an exact solution is NP-hard. However, for some problems, even finding approximate solutions is NP-hard!

6 Deterministic vs. Randomized
Sometimes using randomization allows you to obtain polynomial time algorithms to “solve” the problem. But “solving” the problem using randomness is a little subtle! (You solve the problem exactly with high probability, but not with probability 1.)

7 Time vs. Space We have mostly focused on time needed to solve a problem. What if we allowed exponential time but only polynomial space? Does this change what we can solve?

8 The class P Decision/Optimization/Construction problems Reductions between problems (Karp and Cook) NP-hard NP-complete The class NP The class Co-NP

9 The class P The class “P” refers to decision problems that can be solved exactly in time that is at most polynomial in the length of the input. So you have to think carefully about how much space you need to represent the input. Sometimes this is tricky.

10 Representing the input
Maximum Clique: the input is just a graph, so the representation uses O(n2) space, where the graph has n nodes. Primality: the input is an integer B, so the representation uses O(log B) space. Subset Sum: the input is a list of N integers, each at most B. The representation uses O(N log B) space.

11 Relationships between problems
We focus on how to use algorithms for one problem to solve another problem. (Think of this as designing an algorithm by calling external subroutines or functions.) Key idea: polynomial reducibility

12 Independent Set For graph G = (V, E), a subset S of the vertices is an independent set if there are no edges between vertices in S. S={1,4,6} is an independent set. S={1,4,6,7} is not an independent set. 1 2 3 5 4 6 7

13 Clique For graph G = (V, E), a subset S of the vertices is a clique if every pair of vertices in S are adjacent. S={2,3} is a clique. S={1,2,3,4} is not a clique. 1 2 3 5 4 6 7

14 Cliques and Independent Sets
Consider the following two problems: Clique(G,k): Does G have a clique of size k? IndependentSet(G,k): Does G have an independent set of size k? Can we solve Clique(G,k) using an oracle for IndependentSet(G,k)? Can we solve IndependentSet(G,k) using an oracle for Clique(G,k)?

15 Complement of a Graph Def: Gc= (V,Ec) is the complement of G=(V,E) if Ec has exactly the edges that E does not have. 1 2 1 2 3 5 3 5 4 4 6 6 7 7

16 Complement of a Graph Def: Gc= (V,Ec) is the complement of G=(V,E) if Ec has exactly the edges that E does not have. 1 2 1 2 3 5 3 5 4 4 6 6 7 7

17 Cliques and Independent Sets
Lemma: Let G=(V,E) be a graph. Then S is a clique in G if and only if S is an independent set in Gc. Proof: If S is a clique in G, then for all vertices u and v in S, (u,v) is an edge in G. Hence for all vertices u,v in S, (u,v) is not an edge in Gc. Therefore if S is a clique in G, then S is an independent set in Gc. (The other direction is also easy.)

18 Cliques and Independent Sets
Consider the following two problems: Clique(G,k): Does G have a clique of size k? IndependentSet(G,k): Does G have an independent set of size k? Can we solve Clique(G,k) using an oracle for IndependentSet(G,k)? Can we solve IndependentSet(G,k) using an oracle for Clique(G,k)?

19 Algorithm to solve Clique(G,k)
Assume we have an oracle for IndependentSet(G,k), for arbitrary graphs G and integers k: IndependentSet(G,k) = “Yes” if G has an independent set of size k, and “No” otherwise

20 Algorithm to solve Clique(G,k)
Assume we have an oracle for IndependentSet(G,k), for arbitrary graphs G and integers k. Given graph G=(V,E) and integer k Step 1: Construct Gc Step 2: If IndependentSet(Gc,k) = “Yes”, then return “Yes”, else return “No”

21 And vice-versa Suppose we have an oracle for Clique(G,k). To solve IndependentSet(G,k), we do essentially the same algorithm: Input: G=(V,E), integer k Step 1: Construct Gc. Step 2: If Clique(Gc,k) = “Yes”, then return “Yes”, otherwise return “No”

22 Cliques and Independent Sets
Consider the following two problems: Clique(G,k): Does G have a clique of size k? IndependentSet(G,k): Does G have an independent set of size k? Can we solve Clique(G,k) using an oracle for IndependentSet(G,k)? YES Can we solve IndependentSet(G,k) using an oracle for Clique(G,k)? YES

23 What we showed We showed that if IndependentSet(G,k) can be solved in polynomial time, then so can Clique(G,k). We also did this using a particular technique: we defined a function F that maps “instances” of Clique(G,k) into “instances” of IndependentSet(G,k), so that yes-instances map to yes-instances, and no-instances map to no-instances F can be implemented in polynomial time This is called a “Karp” reduction, after Richard Karp

24 Karp Reductions Instances of X Instances of Y
Function F maps Instances of Y to instances of X. Yes-instances are mapped to yes-instances, and no-instances are mapped to no-instances. F is polynomial time. Instances of Y Instances of X F(Instances(Y)) F

25 Karp Reductions Instances of X Instances of Y
Function F maps Instances of Y to instances of X. Yes-instances are mapped to yes-instances, and no-instances are mapped to no-instances. F is polynomial time. If X can be solved in polynomial time, then so can Y. Instances of Y Instances of X F(Instances(Y)) F

26 What we showed Clique(G,k) reduces to Independent Set(G,k)
Independent Set (G,k) reduces to Clique(G,k) Therefore, the two problems are polynomially equivalent

27 Cook 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 Notation: Y <P X

28 Another kind of reduction
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 Therefore, if X can be solved in polynomial time, then so can Y. This is called a “Cook”-reduction, after Steven Cook.

29 Cook reduction vs. Karp reduction
In a Karp reduction, you are only allowed one call to the oracle. Also, yes-instances must map to yes-instances, and no-instances must map to no-instances. In a Cook reduction, you can do whatever you like – as long as you only call the oracle a polynomial number of times. In both cases, you are only allowed a polynomial amount of work.

30 Notation: Y <P X While Cook and Karp reductions are a bit different from each other, we will use the same notation for both. If Y reduces to X (whether by a Karp or a Cook reduction), we write: Y <P X

31 Solving 2-colorability
Suppose you have an oracle to determine if a graph has a proper 3-coloring 3color(G) = “Yes” if G had a proper 3-coloring, “No” otherwise Can you use this oracle to determine if a graph has a proper 2-coloring?

32 2-color(G)<P 3-color(G)
Let G =(V,E). Construct graph G’ = (V’,E’) by Add one vertex v* Make v* adjacent to every vertex in V Lemma: G can be 2-colored if and only if G’ can be 3-colored. Hence, 2-color(G)<P 3-color(G)

33 Vertex Cover For 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. S = {2,3,7} is a vertex cover S = {1,2,3,4,5} is not a vertex cover 1 2 3 5 4 6 7

34 Independent Sets and Vertex Covers
Find an independent set S Confirm that V-S is a vertex cover 1 2 1 2 3 5 3 5 4 4 6 6 7 7

35 Independent Set <P Vertex Cover
Lemma: Let G = (V,E) be a graph. Then a set S is independent iff V-S is a vertex cover. Proof (by contradiction). (1) Suppose S is an independent set but V-S is not a vertex cover. Since V-S is not a vertex cover, there is an edge (u,v) in E with neither endpoint in V-S. Hence both u and v are in S. But then S is not an independent set. (2) The converse is just as easy to prove.

36 Independent Set <P Vertex Cover
Suppose we have an oracle for VertexCover(G,k): VertexCover(G,k) = “YES” if G has a vertex cover of size k How can we use this oracle to solve IndependentSet(G,k)? Answer: Given graph G =(V,E) and integer k, where G has n vertices, we set: IndependentSet(G,k) = VertexCover(G,n-k) (Note: This is a Karp Reduction, where F maps (G,k) to (G,n-k).)

37 Independent Set <P Vertex Cover
Suppose we have an oracle for VertexCover(G,k): VertexCover(G,k) = “YES” if G has a vertex cover of size k How can we use this oracle to solve IndependentSet(G,k)? Answer: Given graph G =(V,E) and integer k, where G has n vertices, we set: IndependentSet(G,k) = VertexCover(G,n-k) (Note: This is a Karp Reduction, where F maps (G,k) to (G,n-k).)

38 Independent Set <P Vertex Cover
Suppose we have an oracle for VertexCover(G,k): VertexCover(G,k) = “YES” if G has a vertex cover of size k How can we use this oracle to solve IndependentSet(G,k)? Answer: Given graph G =(V,E) and integer k, where G has n vertices, we set: IndependentSet(G,k) = VertexCover(G,n-k) (Note: This is a Karp Reduction, where F maps (G,k) to (G,n-k).)

39 Y <P X We have provided Karp reductions to prove
2-colorability <P 3-colorability Clique <P Independent Set Independent Set <P VertexCover

40 Cook reduction vs. Karp reduction
In a Karp reduction, you are only allowed one call to the oracle. Also, yes-instances must map to yes-instances, and no-instances must map to no-instances. In a Cook reduction, you can do whatever you like – as long as you only call the oracle a polynomial number of times. In both cases, you are only allowed a polynomial amount of work.

41 Three types of problems
Consider the following three problems Does graph G have a clique of size k? (Decision problem) What is the largest k so that graph G has a clique of size k? (Optimization problem) Find the largest clique in G. (Construction problem) Are they polynomially equivalent?

42 Three types of problems
Consider the following three problems Does graph G have a clique of size k? (Decision problem) What is the largest k so that graph G has a clique of size k? (Optimization problem) Find the largest clique in G. (Construction problem) Are they polynomially equivalent?

43 Three types of problems
Consider the following three problems Does graph G have a clique of size k? (Decision problem) What is the largest k so that graph G has a clique of size k? (Optimization problem) Find the largest clique in G. (Construction problem) Are they polynomially equivalent??

44 Decision Problem Clique(G,k): Does graph G have a clique of size k? 1
2 3 4 5 6 7

45 Optimization Problem Max-Clique(G):
What is the largest size of any clique in G? 1 2 3 4 5 6 7

46 Construction Problem Construct-Max-Clique(G):
Given G, output the largest clique in G. 1 2 3 4 5 6 7

47 Using oracles (again) Suppose you have an oracle which can answer Yes/No questions like this: Does graph G=(V,E) have a clique of size k? How could you use this oracle to Find the size of a maximum clique? Construct a maximum clique?

48 Using Oracles To find the largest clique size, do:
For k=n down to 1, DO If Clique(G,k) = “Yes”, then Return(k) So oracles for decision (Yes/No) problems can be used to solve the optimization problem. What about constructing the maximum clique?

49 Constructing a maximum clique
Given G=(V,E), and V={v1,v2,…,vn}, DO: Let S be the size of the maximum clique. For i=1 up to n DO If Clique(G-{vi},S) = “Yes”, then G:=G-{vi} Return vertex set of G Note that the graph G is changing during the algorithm, with vertices removed if they are not needed in the maximum clique.

50 Constructing a maximum clique
Note that we used the oracle O(n) times – at most n times to find the size S of the maximum clique, and n times to construct it after knowing S. Hence, the maximum clique construction problem can be solved with O(n) calls to an oracle that solves the decision problem.

51 Vertex Cover For 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. S = {2,3,7} is a vertex cover S = {1,2,3,4,5} is not a vertex cover 1 2 3 5 4 6 7

52 Decision Problem VertexCover(G,k):
Does graph G have a vertex cover of size k? 1 2 3 5 4 6 7

53 Optimization Problem Min-VertexCover(G):
What is the smallest size of any vertex cover in G? 1 2 3 5 4 6 7

54 Construction Problem Construct-Min-VertexCover(G):
Given G, output the minimum size vertex cover. 1 2 3 5 4 6 7

55 Construction Problem Suppose we have an oracle for VertexCover(G,k). Can we use it to construct a smallest vertex cover? 1 2 3 5 4 6 7

56 Constructing the minimum vertex cover
Input: Graph G=(V,E), with V={v1,v2,…,vn} Step 1: Use the oracle to find S, the size of the minimum vertex cover. Set VC = {}. Step 2: For i=1…n DO If G has no edges, return(VC) If VertexCover(G-{vi},S-1) = “YES”, then add vi to VC, set S=S-1, and set G=G-{vi} Return(VC)

57 Vertex-Coloring A (proper) vertex-coloring of the graph G = (V, E) is an assignment of colors (or integers) to the vertices of G so that no two adjacent nodes get the same color. The following is a proper vertex coloring with 3 colors: c(1)=c(4)=c(5)=c(6) = RED, c(2)=c(7) = GREEN, and c(3) = BLUE. The following is not a proper vertex-coloring: all vertices colored RED 1 2 3 5 4 6 7

58 Decision Problem VertexColor(G,k):
Does graph G have a vertex coloring with k colors? 1 2 3 5 4 6 7

59 Optimization Problem Min-VertexColor(G):
Given G, find the smallest number k so that G has a k-coloring of the vertices. 1 2 3 5 4 6 7

60 Construction Problem Construct-Min-VertexColor(G):
Given G, find a k-coloring, where G does not have a (k-1)-coloring 1 2 3 5 4 6 7

61 Constructing the minimum coloring using the oracle
Algorithm Step 1: Use the oracle to find S, the minimum number of colors needed to vertex-color G. Put every node in G into its own equivalence class. Step 2: List all pairs of vertices in G that are not adjacent, p1,p2,…,pk. For i=1 up to k do Let pi =(x,y), and let Gi = G + (x,y) If VertexColor(Gi,S) = “Yes”, then set G = Gi, Gc (the complement of G) has S components, and each component is a clique. Number these components 1…S. Color each vertex in G by the number of its component in Gc .

62 Using Oracles In each case, we showed how to solve some problem X by using a polynomial number of calls to an oracle, and a polynomial amount of other work. Therefore, if the oracle can be implemented to run in polynomial time, then X is in P.

63 Using Karp or Cook Reductions
When we show that problem Y can be solved using an oracle for problem X, it means that if X can be solved in polynomial time, then so can Y. Therefore, if Y <P X and X is solvable in polynomial time, then so is Y.

64 Part II: NP, Co-NP, NP-hard, NP-Complete, etc.

65 we’ll talk about P Reductions between problems The class NP NP-hard
NP-complete The class Co-NP

66 Why focus on decision problems?
We have shown that if a decision problem can be solved in polynomial time, then so can: the optimization problem The construction problem Also, easier mathematics

67 Polynomial time decision problems
These decision problems are solvable in polynomial time: 2-colorability Does G have a clique of size 5? Does G have a vertex cover of size 5? Does G have an independent set of size k? But what about these? 3-colorability Does G has a clique of size k (where k is part of the input)? Does G have an independent set of size k (where k is part of the input)? Does G have a vertex cover of size k (where k is part of the input)?

68 Maybe some problems cannot be solved in polynomial time?
3-colorability Max Clique Max Independent Set Minimum Vertex Cover Travelling Salesman

69 How to answer this? Fascinating mathematical theory to address what can and cannot be solved using polynomial time Basic concepts: NP (non-deterministic polynomial time) NP-hard and NP-complete problems Polynomial reductions between problems: show that if a problem X can be solved in polynomial time, then so can problem Y

70 Cook 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 Notation: Y <P X Therefore, if X can be solved in polynomial time, then so can Y

71 Karp Reductions Instances of X Instances of Y
Function F maps Instances of Y to instances of X. Yes-instances are mapped to yes-instances, and no-instances are mapped to no-instances. F is polynomial time. If X can be solved in polynomial time, then so can Y. Instances of Y Instances of X F(Instances(Y)) F

72 Cook reduction vs. Karp reduction
In a Karp reduction, you are only allowed one call to the oracle. Also, yes-instances must map to yes-instances, and no-instances must map to no-instances. In a Cook reduction, you can do whatever you like – as long as you only call the oracle a polynomial number of times. In both cases, you are only allowed a polynomial amount of work, and if Y reduces to X and X is in P, then Y is in P.

73 Cook reduction vs. Karp reduction
In a Karp reduction, you are only allowed one call to the oracle. Also, yes-instances must map to yes-instances, and no-instances must map to no-instances. In a Cook reduction, you can do whatever you like – as long as you only call the oracle a polynomial number of times. In both cases, you are only allowed a polynomial amount of work, and if Y reduces to X and Y is not in P, then X not in P.

74 we’ll talk about P Reductions between problems The class NP NP-hard
NP-complete The class Co-NP

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

76 Certificate examples Independent set of size k
The independent set of size k Hamiltonian Circuit Problem A cycle including all of the vertices k-coloring a graph Assignment of k colors to the vertices Composite number A factor of the input integer

77 What is NP? Problems where “yes-instances” can be efficiently verified
Hamiltonian Circuit, Eulerian graph, 3-colorability, colorability Succinct certificate property (so “proof” is short) Notes a problem in NP may or may not be easy to solve being in NP says nothing about having a short proof for the “no-instances”.

78 What does “X is NP-Complete” mean?
Hand-waving: X is one of the hardest problems in NP More precise definition: X is in NP and every problem in NP reduces to X. “X is NP-hard” means that every problem in NP reduces to X. (In other words, X can be NP-hard but not in NP.)

79 NP-Completeness A problem X is NP-complete if
X is in NP For every Y in NP, Y <P X (i.e., X is NP-hard) In other words, X is a “hardest” problem in NP

80 NP-Completeness A problem X is NP-complete if
X is in NP For every Y in NP, Y <P X (i.e., X is NP-hard) Lemma 1: If X is NP-hard and X <P Z, then Z is NP-hard Lemma 2: If X is NP-Complete, Z is in NP and X <P Z, then Z is NP-Complete

81 NP-Completeness A problem X is NP-complete if
X is in NP For every Y in NP, Y <P X (i.e., X is NP-hard) Lemma 1: If X is NP-hard and X <P Z, then Z is NP-hard Lemma 2: If X is NP-Complete, Z is in NP and X <P Z, then Z is NP-Complete

82 Karp Reductions Instances of X Instances of Y
Function F maps Instances of Y to instances of X. Yes-instances are mapped to yes-instances, and no-instances are mapped to no-instances. F is polynomial time. If Y is NP-Complete and X is in NP, then X is NP-Complete. Instances of Y Instances of X F(Instances(Y)) F

83 Can an NP-hard problem be solved in polynomial time?
If X is NP-hard but also in P, then every problem in NP can be solved in polynomial time. This would mean that NP=P. Very few people believe this. Therefore, don’t try to find a polynomial time algorithm for an NP-hard problem.

84 History Jack Edmonds Steve Cook Dick Karp Leonid Levin Identified NP
Cook’s Theorem – the definition of NP-Completeness, and existence of NP-Complete problems Dick Karp Identified “standard” collection of NP-Complete Problems and defined “Karp reductions” Leonid Levin Independent discovery of NP-Completeness in USSR

85 Cook’s Theorem Theorem: The Circuit Satisfiability Problem is NP-Complete (i.e., every problem in NP reduces to Circuit SAT).

86 Circuit SAT Satisfying assignment x1 = T, x2 = F, x3 = F
x4 = T, x5 = T AND Circuit SAT OR OR Find a satisfying assignment AND AND AND AND NOT OR NOT OR AND OR AND NOT AND NOT OR NOT AND x3 x4 x5 x1 x2

87 Circuit SAT Circuit Satisfiability
Given a boolean circuit, determine if there is an assignment of boolean values to the input to make the output true

88 Cook’s Theorem Theorem: The Circuit Satisfiability Problem is NP-Complete (Circuit SAT is in NP and every problem in NP reduces to Circuit SAT). Since there are an infinite number of problems in NP, this cannot be proven individually for each problem in NP. Instead, Cook found a general construction, for any problem in NP.

89 NP-Completeness Observation. All problems below are NP-complete and polynomial reduce to one another! by definition of NP-completeness CIRCUIT-SAT 3-SAT 3-SAT reduces to INDEPENDENT SET INDEPENDENT SET DIR-HAM-CYCLE GRAPH 3-COLOR SUBSET-SUM Karp analyzed most juicy open problem in discrete math – showed most were NP-complete x -> y means x reduces to y (if you can solve y, then you can solve x) Then to join the NP complete club, you need a reduction from SAT (or any other current member) to you VERTEX COVER HAM-CYCLE PLANAR 3-COLOR SCHEDULING SET COVER TSP

90 Satisfiability Given a boolean formula, does there exist a truth assignment to the variables to make the expression true? Examples: (If A then B) and !B (A or B or !C) and !A and !B and C (A iff B) and (If A then !B) If A then !A

91 Conjunctive Normal Form (CNF)
Boolean variables: x1, …, xn Term: xi or its negation !xi Clause: disjunction of terms t1 or t2 or … tj Problem: Given a collection of clauses C1, . . ., Ck, does there exist a truth assignment that makes all the clauses true (x1 or !x2), (!x1 or !x3), (x2 or !x3)

92 3-SAT Each clause has exactly 3 terms Variables x1, . . ., xn
Clauses C1, . . ., Ck Cj = (tj1 or tj2 or tj3) All clauses must be satisfied Fact: Every instance of SAT can be converted in polynomial time to an equivalent instance of 3-SAT

93 Populating the NP-Completeness Universe
Circuit Sat <P 3-SAT 3-SAT <P Independent Set Independent Set <P Vertex Cover 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

94 Some NP-Complete Problems
Six basic genres of NP-complete problems and paradigmatic examples. Packing problems: SET-PACKING, INDEPENDENT SET. Covering problems: SET-COVER, VERTEX-COVER. Constraint satisfaction problems: SAT, 3-SAT. Sequencing problems: HAMILTONIAN-CYCLE, TSP. Partitioning problems: 3D-MATCHING 3-COLOR. Numerical problems: SUBSET-SUM, KNAPSACK. Practice. Most NP problems are either known to be in P or NP-complete. Notable exceptions. Factoring, graph isomorphism, Nash equilibrium. Nash equilibria in two-person non-zero-sum game always exist, but major open question to *find* such a solution in poly-time. [Is there a corresponding decision problem or is only the search problem interesting from a computational complexity viewpoint?]

95 More Hard Computational Problems
Aerospace engineering: optimal mesh partitioning for finite elements. Biology: protein folding. Chemical engineering: heat exchanger network synthesis. Civil engineering: equilibrium of urban traffic flow. Economics: computation of arbitrage in financial markets with friction. Electrical engineering: VLSI layout. Environmental engineering: optimal placement of contaminant sensors. Financial engineering: find minimum risk portfolio of given return. Game theory: find Nash equilibrium that maximizes social welfare. Genomics: phylogeny reconstruction. Mechanical engineering: structure of turbulence in sheared flows. Medicine: reconstructing 3-D shape from biplane angiocardiogram. Operations research: optimal resource allocation. Physics: partition function of 3-D Ising model in statistical mechanics. Politics: Shapley-Shubik voting power. Pop culture: Minesweeper consistency. Statistics: optimal experimental design.

96 we’ll talk about P Reductions between problems The class NP NP-hard
NP-complete The class Co-NP

97 Asymmetry of NP .Ex 3. 3-colorable vs. not 3-colorable
Asymmetry of NP. We only need to have short proofs of yes-instances. Ex 1. SAT vs. TAUTOLOGY. Can prove a CNF formula is satisfiable by giving such an assignment. How could we prove that a formula is not satisfiable? Ex 2. HAM-CYCLE vs. NO-HAM-CYCLE. Can prove a graph is Hamiltonian by giving a Hamiltonian cycle. How could we prove that a graph is not Hamiltonian? .Ex 3. 3-colorable vs. not 3-colorable Can prove that a graph has a 3-coloring by providing it How could we prove that a graph doesn’t have a 3-coloring?

98 NP and co-NP NP. Decision problems for which there is a poly-time certifier. Ex. SAT, HAM-CYCLE, COMPOSITES. Def. Given a decision problem X, its complement X is the same problem with the yes and no answers reversed. Ex. X = { 0, 1, 4, 6, 8, 9, 10, 12, 14, 15, … } Ex. X = { 2, 3, 5, 7, 11, 13, 17, 23, 29, … } co-NP. Complements of decision problems in NP. Ex. TAUTOLOGY, NO-HAM-CYCLE, PRIMES.

99 NP = co-NP ? Fundamental question. Does NP = co-NP?
Do yes instances have succinct certificates iff no instances do? Consensus opinion: no. Theorem. If NP  co-NP, then P  NP. Pf idea. P is closed under complementation. If P = NP, then NP is closed under complementation. In other words, NP = co-NP. This is the contrapositive of the theorem. Basically a proof by contradiction

100 Good Characterizations
Observation. P  NP  co-NP. Fundamental open question: Does P = NP  co-NP? Mixed opinions. Fact. Factoring is in NP  co-NP, but not known to be in P. if poly-time algorithm for factoring, can break RSA cryptosystem

101 we’ll talk about P Reductions between problems The class NP NP-hard
NP-complete The class Co-NP

102 Can we … Can we find a max clique in polynomial time?
Can we solve 3-SAT in polynomial time? Can we solve Travelling Salesman in Polynomial time? All of these are NP-hard problems. If we could solve any of these in polynomial time, then all can be solved in polynomial time.

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

104 If P != NP, then Nothing NP-Complete could be
Solved in polynomial time! And there are even some problems that are “NP-intermediate” (e.g., graph-isomorphism) Most people believe this. NP-Complete NP P

105 What we don’t know Does P = NP? NP-Complete NP = P NP P

106 The Simpson's: P = NP? Copyright © 1990, Matt Groening

107 Futurama: P = NP? Copyright © 2000, Twentieth Century Fox

108 Extent and Impact of NP-Completeness
Extent of NP-completeness. [Papadimitriou 1995] Prime intellectual export of CS to other disciplines. 6,000 citations per year (title, abstract, keywords). more than "compiler", "operating system", "database" Broad applicability and classification power. "Captures vast domains of computational, scientific, mathematical endeavors, and seems to roughly delimit what mathematicians and scientists had been aspiring to compute feasibly." Ernst Ising proposed simple model for phase transitions that is of fundamental importance in physics. One of most exciting periods in statistical mechanics when Norwegian chemist Lars Onsager (and Nobel laureate) discovered solution to Ising model of ferromagnetism on 2D lattice. Result energized many of the most brilliant physicist and mathematicians for solution to more realistic 3D model. Spin glass Ising model from statistical mechanics (2d version unrealistic, 3d is the one everyone wanted to sovle)

109 Summary Decision Problems P and NP Certificates
Polynomial time reduction Y <P X NP-Completeness Definition Z in NP, for all Y in NP, Y <P Z NP-Completeness Proof: A is NPC, B in NP, A <PB, then B is NPC NP-Complete NP P


Download ppt "Computational Complexity"

Similar presentations


Ads by Google