§4 Computational Complexity

Slides:



Advertisements
Similar presentations
Part VI NP-Hardness. Lecture 23 Whats NP? Hard Problems.
Advertisements

Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
NP and NP Complete. Definitions A problem is in the class P if there is a polynomial time solution to the problem A problem is in the class NP if there.
The Theory of NP-Completeness
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
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.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
CSEP 521 Applied Algorithms Richard Anderson Lecture 10 NP Completeness.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
1 Design and Analysis of Algorithms Yoram Moses Lecture 11 June 3, 2010
Unit 9: Coping with NP-Completeness
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.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
NP-Complete problems.
CSE 589 Part V One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important. Bertrand Russell.
CSCI 2670 Introduction to Theory of Computing November 17, 2005.
CSE 6311 – Spring 2009 ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS Lecture Notes – Feb. 3, 2009 Instructor: Dr. Gautam Das notes by Walter Wilson.
NPC.
CSC 413/513: Intro to Algorithms
Lecture. Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification.
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.
Introduction to NP Instructor: Neelima Gupta 1.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
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-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
More NP-Complete and NP-hard Problems
More NP-complete problems
P & NP.
Richard Anderson Lectures NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
Advanced Algorithms Analysis and Design
Lecture 2-2 NP Class.
Part VI NP-Hardness.
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Richard Anderson Lecture 26 NP-Completeness
Hard Problems Introduction to NP
Umans Complexity Theory Lectures
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
ICS 353: Design and Analysis of Algorithms
Intro to NP Completeness
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP-Completeness
Chapter 34: NP-Completeness
NP-Complete Problems.
CS154, Lecture 13: P vs NP.
CS 3343: Analysis of Algorithms
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness Yin Tat Lee
The Theory of NP-Completeness
Instructor: Aaron Roth
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Hamiltonian Circuit (HC) problem
§5 Structural Complexity: NPc
Presentation transcript:

§4 Computational Complexity Model of computation with (bit) cost: WHILE+ Complexity of Arithmetic Complexity classes P, NP, PSPACE, EXP and their inclusion relations Encoding graphs/non-integer data Example problems: 3COL, EC, HC, VC, ILP, IS, Clique

Model of Computational Cost WHILE takes expon. time to add two n-bit integers Now WHILE+ programs: Input x1N, output x0N xj := 0 | xj := 1 | xj := xi + xk | xj := xi  xk | xj := xi  2 | guess xj | P;P | WHILE xi DO P END Definitions: binary length of xN: ℓ(x) = log2(1+x) time of a WHILE+ program P on input x=(x1,…xk) space (=memory) used: maxt ℓ(x):=ℓ(x1)+…+ℓ(xk) asymptotic time/space t(n)/s(n): worst-case over all inputs x with ℓ(x)<n Recall pairing function x,y := x + (x+y)·(x+y+1)/2

Complexity of Arithmetic WHILE takes expon. time to add two n-bit integers Now WHILE+ programs: Input x1N, output x0N xj := 0 | xj := 1 | xj := xi + xk | xj := xi  xk | xj := xi  2 | guess xj | P;P | WHILE xi DO P END Multiplication by repeated addition: expon. time Long multiplication: linear time Long division: linear time Un-/pairing: linear time ℓ(x,y) = ( ℓ(x) + ℓ(y) ) ℓ(x) = (log x) asymptotic time/space t(n)/s(n): worst-case over all inputs x with ℓ(x)<n Recall pairing function x,y := x + (x+y)·(x+y+1)/2

Preliminaries: Graphs and Coding A directed graph G=(V,E) is a finite set V of vertices and a set EVV of edges Call G undirected if it holds (u,v)E  (v,u)E sometimes c:E→N assigning weights to edges. For input to a WHILE+ program: Represent (G,c) as adjacency matrix ANVV A[u,v] := c(i,j) for (u,v)  E, A[u,v] := "∞" for (u,v)  E Undirected case: only upper triangular matrix. Encoding G,cN has |V| ≤ |G,c| ≤ O(|V|²·log |c|∞)

Some Complexity Classes Definition: a) An ‘algorithm‘ computes the function f:NN if on input x it prints f(x) and terminates A WHILE+ program in time t(n) / space s(n), n:=ℓ(x) Polynom.growth: k t(n)≤O(nk); exponential: 2O(nk) Def: For decision problems L  N or L  {0,1}* Definitions: binary length of xN: ℓ(x) = log2(1+x) time of a WHILE+ program P on input x=(x1,…xk) space (=memory) used: maxt ℓ(x):=ℓ(x1)+…+ℓ(xk) asymptotic time/space t(n)/s(n): worst-case over all inputs x with ℓ(x)<n better pairing function x,y := x + (x+y)·(x+y+1)/2 P = { L decidable in polynomial time } NP = { L verifiable in polynomial time }, i.e. L = { xN : yN, ℓ(y)≤poly(ℓ(x)), x,yV }, VP PSPACE = { L decidable in polynomial space } EXP = { L decidable in exponential time } Theorem: P  NP  PSPACE  EXP L = { xN : yN, ℓ(y)≤poly(ℓ(x)), x,yV }, VP

NP  {xN: y, ℓ(y)≤poly(ℓ(x)), x,yV }, VP Example Problem (0) Def: A 3-coloring of G=(V,E) is a mapping γ:V→{R,G,B} s.t. γ(u)≠γ(v) for every (u,v)E. Examples: a) The Petersen Graph admits a 3-coloring. b) This graph, too. c) This one still. d) But not this one. x = G, y = γ(1),… γ(|V|) 3COL= { G | G admits a 3-coloring } NP NP  {xN: y, ℓ(y)≤poly(ℓ(x)), x,yV }, VP

Example Problems (I) NP NP EC := { G | G has a Eulerian cycle} In an undirected graph G, Eulerian cycle traverses each edge precisely once; Hamiltonian cycle visits each vertex precisely once. save isolated vertices G admitting a Eulerian cycle is connected and has an even number of edges incident to each vertex Theorem: Conversely every connected graph with an even number of edges incident to each vertex admits a Eulerian cycle. EC := { G | G has a Eulerian cycle} NP NP  {xN: y, ℓ(y)≤poly(ℓ(x)), x,yV }, VP HC := { G | G has Hamiltonian cycle} NP

Example Problems (II) NP NP NP NP ? Eulerian (EC) vs. Hamiltonian Cycle (HC) (Minimum) Edge Cover "To graph G, find a smallest subset Fof edges s.t. any vertex v is adjacent to at least one eF." vs. Vertex Cover (VC) CLIQUE = { G,k | G contains a k-clique } IS={G,k : G has k pairwise non-adjacent vertices} Integer Linear Programming ILP = { A,b : AZnm, bZm, xZn: A·x = b } NP NP Greedily extend a maximum matching NP NP ? {V,E,k: FE, |F|=k, xV yV: (x,y)F } VC = {V,E,k: UV, |U|=k, (x,y)E: xU  yU } NP  {xN: y, ℓ(y)≤poly(ℓ(x)), x,yV }, VP

Example Problems (III) Def: A Boolean term Φ(Y1,…Yn) is composed from variables Y1,…Yn, constants 0 and 1, and operations , , . Examples: • 0 (x  y )  ( x  y ) (x  y)  (x  y)  y (x  y)  (x  z )  (z  y)  x  (y) clause literals Φ in 3-CNF if Φ = (()yi  ()yj  ()yℓ ) EVAL: Given Φ(Y1,…Yn) and y1,…yn{0,1}, does Φ(y1,…yn) evaluate to 1 ? [k-] SAT: Given Φ(Y1,…Yn) [in k-CNF], does it hold y1,…yn{0,1}: Φ(y1,…yn)=1 ? P

Non-Deterministic WHILE+ Theorem: LN is accepted by a non-deterministic polynomial-time WHILE+ program iff LNP. Now LOOP+ programs: Input x1N, output x0N xj := 0 | xj := 1 | xj := xi + xk | xj := xi  xk | xj := xi  2 | guess xj | P;P | WHILE xi DO P END guess xj | Definition: A non-deterministic WHILE+ program may (repeatedly) guess a bit (0/1). Its runtime is ≤t(n) if it makes no more than t(ℓ(x1)) steps, regardless of the guesses. It accepts input x1 if there exists some choice of guessed values such as to return x0=1. It rejects x1 if no choice of guesses returns x0=1.