Computational Complexity - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Computational Complexity

Description:

Feasible: is there a very fast algorithm to solve a particular problem? ... 3-coloring. NO! YES!. 19. April 2000. S. Abiteboul -- complexity. More NP-complete problems ... – PowerPoint PPT presentation

Number of Views:392
Avg rating:3.0/5.0
Slides: 23
Provided by: ber9165
Category:

less

Transcript and Presenter's Notes

Title: Computational Complexity


1
ComputationalComplexity
  • Cours Voie C
  • Serge Abiteboul

2
Computability vs. Complexity
  • Decidable is there an algorithm to solve a
    particular problem? No for halting problem
  • Computability
  • Feasible is there a very fast algorithm to solve
    a particular problem? No for traveling salesman
  • Complexity

3
Complexity class, e.g., time(nlog(n))
  • Model of computation, e.g., multitape Turing
    machine
  • Mode of computation, i.e., when is the machine
    accepting deterministic and nondeterministic
  • Resource we wish to bound time, space...
  • The bounding function, e.g., nlog(n)

4
Complexity class
  • A complexity class is the set of all languages
    decided by some multitape TM M in the appropriate
    mode, and such that for each input w, M uses ast
    most f(w) of that particular resource
  • time, ntime, space, nspace

5
More not studied here
  • average case complexity
  • circuit and parallelism
  • Parallel Random Access Machines
  • NC polylogarithmic parallel time with
    polynomially many processors
  • Can we find a good approximation?
  • MAXSNP, e.g. MAX-CUT given a graph G, partition
    nodes between S and V-S with as many edges as
    possible between them

6
Nondeterministic TM
  • It may have choices, ?(a,p) is not unique
  • Many possible behaviors on a given input
  • M accepts w if there exists a computation on
    input w that accepts w
  • NP nondeterministic TM in time polynomial
  • intuition deterministic machine would have to
    try all branches ? exponential time

7
Nondeterministic computation acceptance
Accept
Reject
yes
all no
Accept if some branch leads to an accept state
8
Main classes
  • Inclusion of main classes
  • L ? NL ? P ? NP ? PSPACE ? EXP ? ???
  • More resources means more problems can be solved
  • L space(log(n)) log space NL
  • P time(nk) polynomial time NP
  • PSPACE space(nk) poly space NPSPACE
  • EXP time(2nk) exponential time NEXP

9
Some Results on space
  • Pour tout f, nspace(f(n)) space(f2(n))
  • pspace npspace
  • space hierarchy theorem
  • space(f(n)) proper subset of space(f(n)log(n))
  • ntime(f(n)) ? space(f(n))
  • nspace(f(n)) ? time(klog(n)f(n))

10
Comparing problems Reduction
  • A language L1 is reducible to L2 iff there exists
    a function r from strings to strings computable
    in space O(log(n)) such that for all input x, x ?
    L1 iff r(x) ? L2
  • If I can solve L2, I can solve L1 at about the
    same cost
  • r is a reduction from L1 to L2

11
Comparing problems NP-completeness and others
  • circuit SAT given a circuit (and/or/not) is
    there an input s.t. circuit returns true
  • circuit SAT is in NP
  • circuit SAT is NP-hard
  • any NP problem reducible to circuit SAT
  • circuit-SAT at least as hard as any NP problem
  • 3-SAT is NP-hard
  • 3-SAT is in NP

3-SAT is NP-complete
12
Circuit SAT is NP-complete
  • NP easy
  • NP-complete
  • show how we can simulate the computation of any
    nondeterministic ptime TM using circuits
  • i.e., reduction from an arbitrary TM to circuit
    SAT

13
Example of reductionHamiltonian path to SAT
  • Hamiltonian path
  • input a graph G
  • output is there a path that visits every node
    exactly once?
  • SAT
  • input a boolean formula in CNF a set of
    clauses
  • output is there a satisfying assignment of the
    variables?

14
Hamiltonian path to SAT
  • nodes are 1,2,...,n r(G) has variables xi,j
  • represents that j is the ith node on the path
  • for each j, x1,j or ... or xn,j j is on the
    path
  • for each j, i, k, i ? k, not xi,j or not xk,j j
    is only once on the path
  • for each i, xi,1 or ... or xi,n some node is
    ith
  • for each i, j, k, j ? k, not xi,j or not xi,k
    there is only one ith node
  • for each (i,j) that is not an edge in G, fo each
    k, not xk,i or not x(k1)j

15
Hamiltonian path to SAT
4
x12 or ... or x52 not x12 or not x22 x41 or ...
or x45 not x41 or not x42 not x12 or not x21
(2,1) is not in G
3
5
1
2
try also find a path that visits each edge
exactly once
16
Easy part problem is in NP
  • Hamiltonian path in NP
  • guess a list of n vertices
  • check whether it is an Hamiltonian path
  • SAT is in NP
  • guess a value TRUE/FALSE for each variable
  • check whether the formula evaluates to TRUE
  • Make a polynomial number of guesses
  • For each one, do a polynomial computation

17
Some NP-complete problems
  • Hamiltonian path
  • SAT DNF formulas
  • 3SAT clauses have 3 items
  • Circuit SAT gates with and/or/not
  • Clique G,k, is there a clique of size k
  • 3 coloring of a graph no two adjacent vertices
    have the same color

18
3-coloring
NO!
YES!
19
More NP-complete problems
  • Knapsack items have value vi and weight wi.
    Maximize the value under the constraint that the
    weight must be below W
  • Traveling salesman n cities and di,j between
    cities. Find the shorter tour of the cities
  • Max flow a graph with a source and a sink, a
    capacity for each edge, get the largest possible
    flow on this network

20
Intuition for NP-complete problems
  • It is very simple to test a solution SAT verify
    that it makes indeed the formula true
  • Most useful computational problems are in NP.
    They may be in P or not
  • NP-complete not in P unless P NP

21
Showing that a problem H is NP-complete
  • It is in NP (usually easy)
  • guess a certificate for H
  • check that it is a certificate
  • Show it is NP-hard (a bit more complex)
  • choose a problem H known to be NP-hard
  • construct a reduction from H to H
  • so H is at least as hard as H and thus is NP-hard

22
P, NP, co-NP
  • co-NP complement of a problem NP
  • the formula is satisfiable by a valuation NP
  • the formula is satisfied for all valuations co-NP
  • NP short certificate
  • coNP not the case

co-NP
NP
P
Write a Comment
User Comments (0)
About PowerShow.com