complexity theory
play

Complexity theory Algorithms Algorithms Week 10 Oliver Oliver - PowerPoint PPT Presentation

CS 270 CS 270 Complexity theory Algorithms Algorithms Week 10 Oliver Oliver Kullmann Kullmann In this last week we consider the following fundamental Introduction Introduction question: Logical Logical Complexity Theory puzzles and


  1. CS 270 CS 270 Complexity theory Algorithms Algorithms Week 10 Oliver Oliver Kullmann Kullmann In this last week we consider the following fundamental Introduction Introduction question: Logical Logical Complexity Theory puzzles and puzzles and SAT SAT We have seen that some problems have “clever” algorithms, The The complexity complexity like the general change-making algorithm, which avoid the Introduction 1 classes P classes P and NP and NP exponential running time caused by trying all combinations. Beyond NP Beyond NP Logical puzzles and SAT 2 While other problems (like graph colouring) don’t seem to NP- NP- have such “clever” algorithms. completeness completeness The complexity classes P and NP 3 Backtracking Backtracking What is the reason for this? Beyond NP 4 And, as important as that — what can be done when actually NP-completeness 5 we seem to need to try all possible combinations?! Backtracking 6 CS 270 CS 270 P versus NP “Separating Insolvable and Difficult” Algorithms Algorithms Oliver Oliver Kullmann Kullmann The background reading for this week is Introduction In the NYT (July 13, 1999, by George Johnson): Introduction Chapter 34 — “NP-Completeness” Logical Logical puzzles and puzzles and Anyone trying to cast a play or plan a social event has SAT SAT come face-to-face with what scientists call a The The from CLRS . complexity complexity satisfiability problem . Suppose that a theatrical classes P classes P and NP and NP However we will only cover the intuitive notions. director feels obligated to cast either his ing´ enue, Beyond NP Beyond NP Actress Alvarez, or his nephew, Actor Cohen, in a That is, for the fundamental notions P , NP and NP- NP- production. But Miss Alvarez won’t be in a play with completeness completeness NP-completeness we will consider only the basic ideas. Backtracking Cohen (her former lover), and she demands that the Backtracking Though, in one aspect we will go beyond the book: cast include her new flame, Actor Davenport. The producer, with her own favors to repay, insists that Actor Branislavsky have a part. But Branislavsky In the last 10 years a revolution in “SAT solving” took place, won’t be in any play with Miss Alvarez or Davenport. making problems “feasible” which were considered “infeasible”. So we will touch on this aspects.

  2. CS 270 CS 270 A systematic solution Formulation corrected Algorithms Algorithms The actors become boolean variables (when assigned true they Oliver Oliver Kullmann Kullmann If Actress Alvarez won’t play, then she will be mad anyway, and play, when false they don’t): so her demands don’t need to be satisfied. So Condition 3 Introduction Introduction Actress Alvarez: a Logical Logical should be weakened, and we get: puzzles and puzzles and Actor Cohen: c SAT SAT 1 a ∨ c Actor Davenport: d The The complexity complexity 2 a → ¬ c Actor Branislavsky: b classes P classes P and NP and NP 3 a → d Beyond NP Beyond NP The conditions become logical formula: 4 b NP- NP- 1 a ∨ c completeness completeness 5 b → ( ¬ a ∧ ¬ d ) Backtracking Backtracking 2 a → ¬ c 3 d Again condition 4 implies b , again condition 5 then implies ¬ a , ¬ d , now conditions 2, 3 are satisfied (recall “false implies 4 b everything”), while condition 1 implies c . 5 b → ( ¬ a ∧ ¬ d ) So the unique solution is that Branislavsky and Cohen play, Condition 4 implies b , condition 5 then implies ¬ a , ¬ d , while Alvarez and Davenport don’t. contradicting condition 3. This problem instance is unsatisfiable . CS 270 CS 270 NYT continued (SAT and complexity) A new field of applications: verification Algorithms Algorithms Oliver Oliver Kullmann Kullmann As more roles need to be filled, the problem becomes harder and harder to solve. Is it possible to satisfy the Introduction Introduction After that article has been written, in the last decade, SAT tangled web of conflicting demands? These Logical Logical solving developed strong industrial tools: puzzles and puzzles and satisfiability problems, called SAT problems for short, SAT SAT arise in thousands of situations, from staffing The The Large parts of hardware verification nowadays depend on complexity complexity companies and scheduling airline flights to planning a classes P SAT solving. classes P and NP and NP wedding dinner that won’t devolve into a food fight. This shouldn’t be a surprise: Recall from your hardware Beyond NP Beyond NP lecture, that inside a computer we have (just) boolean logic! And, reaching beyond such practical considerations, NP- NP- completeness completeness researchers embrace satisfiability problems as a tool for Backtracking Backtracking Remark: Unfortunately, this is basically invisible, since in the studying a phenomenon called computational existing societies the labour process is hidden — programming complexity: some problems are and (really) applied sciences only show up (sort of) in a James inherently easy to solve, Bond movie, when we have a glimpse at the laboratory of the some difficult villain. and some impossible, but scientists are only beginning to understand why.

  3. CS 270 CS 270 NYT continued (brute force) The simplest brute-force method Algorithms Algorithms Oliver Oliver In general, if we have a SAT problems consisting of Kullmann Kullmann m boolean formulas C 1 , . . . , C m Introduction Introduction Logical Logical with n boolean variables v 1 , . . . , v n , In computer science, problems can be rated in puzzles and puzzles and SAT SAT difficulty by how much time it takes to search for we can list all 2 n assignments of true , false to the variables, The The solutions. If there are just a few actors to cast in a complexity complexity and check whether they fulfil all conditions C 1 , . . . , C m : classes P classes P play, the answer can be found simply by trial and error. and NP and NP if we find a solution, the problem (instance) is satisfiable , Beyond NP Beyond NP For five actors, there are only 2 to the 5th possibilities, NP- NP- otherwise it is unsatisfiable . a mere 32 combinations: A is in, B is out, C is out, D completeness completeness is in, E is out. Backtracking Backtracking Even for a large organisation, n = 60 would be very difficult, and The director can try every combination and see if any definitely n = 80 is out of reach (within the next 10 years, say). are consistent with everyone’s demands. However, interesting problem instances typically have at least 1000 variables, sometimes even going into the millions, and 2 1000 ≈ 10 301 will forever stay outside the reach of such a method. CS 270 CS 270 Exploiting special structure 2-SAT and P Algorithms Algorithms Oliver Oliver Kullmann Kullmann Introduction Introduction Viewed more abstractly, the casting example belongs Logical Logical to a class called 2-SAT problems. If parsed into a puzzles and puzzles and In practice, it is usually not necessary to “exhaustively SAT SAT logical formula (a kind of mathematical syntax called search the problem space,” as mathematicians say. It The The “conjunctive normal form”), they contain so-called complexity complexity is quickly evident that there is no way to cast Miss classes P classes P clauses like “Alvarez or Cohen,” which each involve no and NP and NP Alvarez, but that the play can go forward with Cohen. more than two of the potential actors. If one tries to Beyond NP Beyond NP For enormous problems involving many variables, NP- cast a play with 10 or 100 actors, the problem becomes NP- pursuing such shortcuts can often save valuable completeness completeness harder. But as long as there are no more than two computer time. Backtracking Backtracking variables, or actors, in each of the many clauses, the solution time increases relatively slowly, in what is Is this just because the problem is so small? called polynomial time . Thus 2-SAT problems are said belong to a class of “solvable problems” called P .

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend