1 / 31

Complexity

Complexity. 15-1. Hierarchy Theorem. Complexity Andrei Bulatov. Complexity. For a language L over an alphabet , we denote the complement of L , the language * - L. Definition The class of languages L such that can be solved by a

waldo
Télécharger la présentation

Complexity

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. Complexity 15-1 Hierarchy Theorem Complexity Andrei Bulatov

  2. Complexity For a language L over an alphabet , we denote the complement of L, the language * -L Definition The class of languages L such that can be solved by a non-deterministic log-space Turing machine verifier is called coNL 15-2 NL and coNL Theorem NL=coNL

  3. Complexity • if L is NL-complete then is coNL-complete 15-3 Proof The properties of NL and coNL are similar to those of NP and coNP: • if a coNL-complete problem belongs to NL then NL = coNL Reachability is NL-complete. Therefore it is enough to show that No-Reachability is in NL. In order to do this, we have to find a non-deterministic algorithm that proves in log-space that there is a path between two specified vertices in a graph

  4. Complexity Let be the set of all vertices connected to s with a path of length at most i, and Clearly, , and We compute the numbers inductively 15-4 Counting the number of reachable vertices Given a graph G andtwo its vertices s and t; let n be the number of vertices of G First, we count the number c of vertices reachable from s

  5. Complexity Suppose is known. The following algorithm non-deterministically either compute or reject • set • set - check whether or not using random walk - if there is the edge (w,v) then set • output 15-5 • for every vertex v from G do • for every vertex w from G non-deterministically do or not do - if not then reject - if yes then set m = m – 1 • if m 0reject

  6. Complexity • set 6-16 Checking Reachability Given G, s, t and c • for every vertex v from G non-deterministically do or not do - check whether or not v is reachable from s using random walk - if not then reject - if yes then set m = m – 1 - if v = t then reject • if m 0reject • accept

  7. Complexity 15-7 Complexity Classes We know a number of complexity classes and we how they relate each other L NL  P  NP , coNP  PSPACE However, we do not know if any of them are different Questions P NP and L  NL concern the (possible) difference between determinism and nondeterminism and known to be extremely difficult Complexity classes can be distinguished using another parameter: The amount of time/space available

  8. Complexity Definition A function f:N N, where f(n)  log n, is called space constructable, if the function that maps to the binary representation of f(n) is computable in space O(f(n)). • polynomials • n log n •  15-8 Space Constructable Functions Examples

  9. Complexity 15-9 Hierarchy Theorem Theorem For any space constructable function f:N N, there exists a language L that is decidable in space O(f(n)), but not in space o(f(n)). Corollary If f(n) and g(n) are space constructable functions, and f(n) = o(g(n)), then SPACE[f] SPACE[g] Corollary LPSPACE Corollary NLPSPACE

  10. Complexity 15-10 Proof Idea Diagonalization Method: • apply a Turing Machine to its own description • revert the answer • get a contradiction In our case, a contradiction can be with the claim that something is computable within o(f(n)) Let L = {“M” | M does not accept “M” in f(n) space}

  11. Computability and Complexity • what we can assume about a decider for L is that it works in • O(f(n)); but this means the decider uses fewer than cf(n) cells • for inputs longer than some . What if “M” is shorter than that? 15-11 If M decides L in space f(n) then what can we say about M(“M”)? • if M(“M”) accepts then “M does not accept M in space f(n)” • if M(“M”) rejects then “M accepts M in space f(n)” There are problems • we showed that L cannot be decided in space f(n), while what • need is to show that it is not decidable in space o(f(n))

  12. Complexity L = {“M ” | simulation ofM on a UTM does not accept “M ” in f(n) space} • If x is not of the form M for some M, reject • Simulate M on x while counting the number of steps used in the • simulation. If the count ever exceeds , accept 15-12 Proof In order to kick in asymptotics, change the language The following algorithm decides L in O(f(n)) On input x • Let n be the length of x • Compute f(n) and mark off this much tape. If later stages ever • attempt to use more space, reject • If M accepts, reject. If M rejects, accept

  13. Complexity 15-13 Clearly, this algorithm works in O(f(n)) space The key stage is the simulation of M Our algorithm simulates M with some loss of efficiency, because the alphabet of M can be arbitrary. If M works in g(n) space then our algorithm simulates M using bg(n) space, where b is a constant factor depending on M Thus, bg(n) f(n)

  14. Complexity There is such that for all inputs x with we have Consider Since , the simulation of M either accepts or rejects on this input in space f(n) • If the simulation accepts then does not accept • If the simulation rejects then accepts 15-14 Suppose that there exists a TM M deciding L in space g(n) =o(f(n)) We can simulate M using bg(n) space

  15. Complexity Theorem For any time constructable function f:N N, there exists a language L that is decidable in time O(f(n)), but not in time . Corollary If f(n) and g(n) are space constructable functions, and , then TIME[f] TIME[g] 15-15 Time Hierarchy Theorem

  16. Complexity Definition 16-16 The Class EXPTIME Corollary PEXPTIME

  17. Complexity 15-17 Search and Optimization Complexity Andrei Bulatov

  18. Complexity 15-18 Search Problems Often we needto find a solution to some problem, rather than to show that a solution exists In this case the problem is said to be a search problem Hamilton Circuit(S) Instance: A finite graph G. Objective: Find a Hamilton Circuit in G, or report it does not exist

  19. Complexity 15-19 More Examples Colouring(S) Instance: A finite graph G and an integer K. Objective: Find a colouring of G with K colours or report it does not exist Satisfiability(S) Instance: A conjunctive normal form . Objective: Find a satisfying assignment for  or report it does not exist

  20. Complexity 15-20 Reduction to Decision Versions Search problems look much more practical than decision problems, but we have studied mostly decision problems because: • there always is the decision version of a search problem • complexity classes, reducibility, etc. for decision problems • are simpler than those for search problems • normally, if we know how to solve a decision problem, we can • also solve its search version

  21. Complexity 15-21 Reduction for Satisfiability We use an algorithm for the decision version as an oracle Given a formula  with the set of variables V • For every X V do • If has a satisfying assignment set X = 0 - otherwise, if has a satisfying assignment set X = 1 report “there is no solution” • output the obtained assignment

  22. Complexity 15-22 Reduction for HamCircuit G: Observation: v A graph G has a Hamilton Path from u to v if and only if the following graph has a Hamilton Circuit u v u

  23. Complexity 15-23 Given a graph G with vertex set V • take a vertex • set H := G • for i= 1 to |V| –1 do • for every neighbour v of do - if there is a Hamiltonian path in H from to v then set remove and all adjacent edges from H • until is defined • if is not defined then output “there is no Hamiltonian Circuit” • output the Hamiltonian Circuit

  24. Complexity 15-24 Optimization Problems In some problems we seek to find the best solution among a collection of possible solutions Problems of this type are called optimization problems Definition An optimization problem is a 4-tuple (I,S,m,opt), where • I is a set of possible instances (encoded by strings over • some alphabet  • S is a function mapping each instance to a set of • feasible solutions • m is a function mapping pairs of instances and • solutions to a positive measure of goodness • opt is either max or min, and indicates whether we • seek maximum or minimum goodness

  25. Complexity 15-25 To solve an optimization problem we must find for any given x I, a solution y  S(x) such that The optimal value will be denoted OPT(x)

  26. Complexity 15-26 Example Travelling Salesperson(O) Instance: A finite set of cities , and a positive integer distance , between each pair . Objective: Find a permutation  of that minimizes • I contains sets of cities and distances • S gives the set of all possible orderings for each instance • m gives the length of the tour for each instance and choice of ordering • opt is min, because we seek for a shortest tour

  27. Complexity 15-27 Example Minimal Vertex Cover¹ Instance: A graph G = (V,E). Objective: Find a smallest set M N such that for each edge (u,v)  E we have u,v  M   ¹Sometimes called Min Node Cover or just Minimum Cover • I contains all graphs • S gives the set of all vertex covers for each graph • m gives the size of the vertex cover (the number of vertices) • opt is min, because we seek for a smallest vertex cover

  28. Complexity 15-28 NP-Hard By extending the notion of reduction, we can show that many optimization problems are hard to solve Algorithms for the examples above would allow us to solve the corresponding decision problems, which are all NP-complete We will call a problem NP-hard if all problems in NP are reducible to it in polynomial time

  29. Complexity 15-29 Reduction for TSP Given a set of cities and distances First, we find the length of the shortest tour • set L := 0 and • do - set - if there is a tour of length  M then set U := M - otherwise set L := M • until L = U • return L

  30. Complexity 15-30 Now we can find a shortest tour. Let its length be denoted L and let B = 2L • set • for i = 1 to n –1 do • for every do - let - set and otherwise • if there is a tour for and • of length then set set and • until is defined • output the shortest tour

  31. Complexity 15-31 Both, search and optimization problems can be reduced to decision problems Why optimization problems are more interesting? Because we can approximate…

More Related