1 / 9

NP-Completeness (36.4-5/34.4-5)

NP-Completeness (36.4-5/34.4-5). P: yes and no in pt NP: yes in pt NPH  NPC. NP-hard. NPC. P. NP. Satisfiability. Boolean formulas: x, (x  y) (x  y) (xy) (xy) Satisfiability Problem (SP): given a Boolean formula

twyla
Download Presentation

NP-Completeness (36.4-5/34.4-5)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. NP-Completeness (36.4-5/34.4-5) • P: yes and no in pt • NP: yes in pt • NPH  NPC NP-hard NPC P NP

  2. Satisfiability • Boolean formulas: x, (x  y) (x  y) (xy) (xy) • Satisfiability Problem (SP): • given a Boolean formula • is there any 0-1 input (0-1 assignment to variables) s.t. formula is true (=1)? • Cook’s Theorem: SP is NP-complete. • SP is an NP-problem (why?) • SP is NP-hard (w/o proof)

  3. 3-CNF • Conjunctive normal form (CNF) = (l11  l12 ... l1s1) ...  (ln1  ln2 ... lnsn) • each literal l is either variable or negation • 3-CNF: each si=3 • 3-CNF Satisfiability is NPC (x1 x2)  (x1   x4 ) • Corresponding tree y3(y1  (x1  x2)) (y2  ( x1   x4 )) • Truth assignment for each clause using tables. y3 y1 y2  x1 x2 x1  x4

  4. x x’ a’ z z’ x y’ a y Independent Set • Independent set in a graph G: pairwise nonadjacent vertices • Max Independent Set is NPC • Is there independent set of size k? • Construct a graph G: • literal -> vertex • two vertices are adjacent iff • they are in the same clause • they are negations of each other • 3-CNF with k clauses is satisfiable iff G has independent k-set • assign 1’s to literals-vertices of independent set • Example: f = (x+z+y’) & (x’+z’+a) & (a’+x+y) x, z’, y independent F is satisfiable: f = 1 if x = z’ = y = 1

  5. red independent set MAX Clique • Max Clique (MC): • Find the maximum number of pairwise adjacent vertices • MC is in NP • for the answer yes there is certificate of polynomial length = clique which can be checked in polynomial time • MC is in NPC • Polynomial time reduction from MIS: • For any graph G any independent set in G 1-1 corresponds to clique in the complement graph G’ red clique noedge  edge edge  noedge G Complement G’

  6. Minimum Vertex Cover • Vertex Cover: • the set of vertices which has at least one endpoint in each edge • Minimum Vertex Cover (MVC): • the set of vertices which has at least one endpoint in each edge • MIN Vertex Cover is NPC • If C is vertex cover, then V - C is an independent set red independent set blue vertex cover

  7. Set Cover • Given: a set X and a family F of subsets of X, F  2X, s.t. X covered by F • Find : subfamily G of F such that G covers X and |G| is minimize • Set Cover is NPC • reduction from Vertex Covert • Graph representation: edge between set A F and element x  X means x  A d a b c red elements of ground set X blue subsets in family F A B A = {a,b,c}, B = {c,d}

  8. NP-hard NPC P  NP  Intermediate Classes Dense Set Cover is NP but not in P neither in NPC Dense Set Cover: Each element of X belongs to at least half of all sets in F

  9. 2 . . . 2 2 n times Runtime Complexity Classes • Example • adding an element in a queue/stack • inverse Ackerman function = O(loglog…log n) n times • extracting minimum from binary heap • n1/2 • traversing binary search tree, list • O(n log n) sorting n numbers, closest pair, MST, Dijkstra shortest paths • adding two nn matrices • en ^ (1/2) • en, , n! • Ackerman function • Runtime order: • constant • almost constant • logarithmic • sublinear • linear • pseudolinear • quadratic • polynomial • subexponential • exponential • superexponential

More Related