Chapter 9 PSPACE: A Class of Problems Beyond NP

Slides:



Advertisements
Similar presentations
Complexity Classes: P and NP
Advertisements

NP-Hard Nattee Niparnan.
Cook’s Theorem The Foundation of NP-Completeness.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
Complexity 12-1 Complexity Andrei Bulatov Non-Deterministic Space.
Complexity 11-1 Complexity Andrei Bulatov Space Complexity.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
PSPACE-Completeness Section 8.3 Giorgi Japaridze Theory of Computability.
Definition: Let M be a deterministic Turing Machine that halts on all inputs. Space Complexity of M is the function f:N  N, where f(n) is the maximum.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
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.
1 Chapter 9 PSPACE: A Class of Problems Beyond NP Slides by Kevin Wayne Pearson-Addison Wesley. All rights reserved.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Space Complexity. Reminder: P, NP classes P NP is the class of problems for which: –Guessing phase: A polynomial time algorithm generates a plausible.
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 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 29.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
28.
NPC.
CSC 413/513: Intro to Algorithms
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
TU/e Algorithms (2IL15) – Lecture 9 1 NP-Completeness NOT AND OR AND NOT AND.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
Theory of Computational Complexity Yuji Ishikawa Avis lab. M1.
Construction We constructed the following graph: This graph has several nice properties: Diameter Two Graph Pebbling Tim Lewis 1, Dan Simpson 1, Sam Taggart.
The NP class. NP-completeness
Data Structures and Algorithm Analysis Lecture 24
P & NP.
Richard Anderson Lecture 26 NP-Completeness
Advanced Algorithms Analysis and Design
Polynomial-Time Reduction
More NP-complete Problems
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness Yin Tat Lee
Intro to Theory of Computation
Intro to Theory of Computation
Geography Game Geography. Amy names capital city c of country she is in. Bob names a capital city c' that starts with the letter on which c ends. Amy.
CS154, Lecture 16: More NP-Complete Problems; PCPs
ICS 353: Design and Analysis of Algorithms
More NP-complete Problems
Richard Anderson Lecture 25 NP-Completeness
Coping With NP-Completeness
The Satisfiability Problem
CSC 4170 Theory of Computation Space complexity Chapter 8.
Chapter 8 NP and Computational Intractability
Chapter 11 Limitations of Algorithm Power
NP-Complete Problems.
NP-Completeness Yin Tat Lee
CSE 6408 Advanced Algorithms.
CS21 Decidability and Tractability
CS154, Lecture 16: More NP-Complete Problems; PCPs
Theory of Computability
Trevor Brown DC 2338, Office hour M3-4pm
Instructor: Aaron Roth
Coping With NP-Completeness
Instructor: Aaron Roth
CS151 Complexity Theory Lecture 4 April 12, 2019.
Intro to Theory of Computation
CS151 Complexity Theory Lecture 4 April 8, 2004.
Lecture 23 NP-Hard Problems
Presentation transcript:

Chapter 9 PSPACE: A Class of Problems Beyond NP Slides by Kevin Wayne. Copyright @ 2005 Pearson-Addison Wesley. All rights reserved.

Geography Game Geography. Amy names capital city c of country she is in. Bob names a capital city c' that starts with the letter on which c ends. Amy and Bob repeat this game until one player is unable to continue. Does Alice have a forced win? Ex. Budapest  Tokyo  Ottawa  Ankara  Amsterdam  Moscow  Washington  Nairobi  … Geography on graphs. Given a directed graph G = (V, E) and a start node s, two players alternate turns by following, if possible, an edge out of the current node to an unvisited node. Can first player guarantee to make the last legal move? Remark. Some problems (especially involving 2-player games and AI) defy classification according to P, EXPTIME, NP, and NP-complete.

9.1 PSPACE

PSPACE P. Decision problems solvable in polynomial time. PSPACE. Decision problems solvable in polynomial space. Observation. P  PSPACE. poly-time algorithm can consume only polynomial space

PSPACE Binary counter. Count from 0 to 2n - 1 in binary. Algorithm. Use n bit odometer. Claim. 3-SAT is in PSPACE. Pf. Enumerate all 2n possible truth assignments using counter. Check each assignment to see if it satisfies all clauses. ▪ Theorem. NP  PSPACE. Pf. Consider arbitrary problem Y in NP. Since Y P 3-SAT, there exists algorithm that solves Y in poly-time plus polynomial number of calls to 3-SAT black box. Can implement black box in poly-space. ▪

9.3 Quantified Satisfiability

Quantified Satisfiability QSAT. Let (x1, …, xn) be a Boolean CNF formula. Is the following propositional formula true? Intuition. Amy picks truth value for x1, then Bob for x2, then Amy for x3, and so on. Can Amy satisfy  no matter what Bob does? Ex. Yes. Amy sets x1 true; Bob sets x2; Amy sets x3 to be same as x2. No. If Amy sets x1 false; Bob sets x2 false; Amy loses; No. if Amy sets x1 true; Bob sets x2 true; Amy loses. x1 x2 x3 x4 … xn-1 xn (x1, …, xn) assume n is odd Any logical formula can be expressed in CNF.

Another Example (x1, x2 , x3) =(x1 v x2 v x3) . (x1 v x2 v x3’).(x1’ v x2 v x3). (x1’ v x2’ v x3) QSAT ?? For x1 = 1, then if x2=1 set x3 =0 if x2=0 set x3=1 Arises in Planning and Games

QSAT is in PSPACE Theorem. QSAT  PSPACE. Pf. Recursively try all possibilities. Only need one bit of information from each subproblem. Amount of space is proportional to depth of function call stack.  x1 = 0 x1 = 1 return true iff both subproblems are true   x2 = 0 x2 = 1 return true iff either subproblem is true     x3 = 0 x3 = 1 (0, 0, 0) (0, 0, 1) (0, 1, 0) (0, 1, 1) (1, 0, 0) (1, 0, 1) (1, 1, 0) (1, 1, 1)

QSAT QSAT lets you ask, for example, whether ( a) ( b) ( c) ( d) F(a,b,c,d) a,b,c,d are assignments to non-overlapping subsets of the vars Harder! Worse than NP-complete (outside both NP and co-NP). QSAT problems are the standard complete problems for the problem classes higher up in the polynomial hierarchy. Example: Can White force a win in 4 moves? That is: Is there an opening move for you ( a) such that for whatever response Kasparov makes ( b), you will have some reply ( c) so that however Kasparov moves next ( d), you’ve checkmated him in a legal game (F(a,b,c,d))?

QSAT is in PSPACE

S(n) <= p(n) + p(n-1) + p(n-2) +...+p(1) <= n . p(n) Analyze the Algorithm Recursive calls for xi=0 and xi=1 overwrite the same space Space Requirement for n variable problem : S(n) <= S(n-1) +p(n) S(n) <= p(n) + p(n-1) + p(n-2) +...+p(1) <= n . p(n) which is polynomial since p(n) is polynomial Proved : QSAT can be solved in polynomial space

9.4 Planning Problem

15-Puzzle 8-puzzle, 15-puzzle. [Sam Loyd 1870s] Board: 3-by-3 grid of tiles labeled 1-8. Legal move: slide neighboring tile into blank (white) square. Find sequence of legal moves to transform initial configuration into goal configuration. back in 1878, that was a lot of money! 1 2 3 1 2 3 1 2 3 ? move 12 4 5 6 4 5 . . . 4 5 6 8 7 8 7 6 7 8 initial configuration goal configuration

Planning Problem Conditions. Set C = { C1, …, Cn }. Initial configuration. Subset c0  C of conditions initially satisfied. Goal configuration. Subset c*  C of conditions we seek to satisfy. Operators. Set O = { O1, …, Ok }. To invoke operator Oi, must satisfy certain prereq conditions. After invoking Oi certain conditions become true, and certain conditions become false. PLANNING. Is it possible to apply sequence of operators to get from initial configuration to goal configuration? Examples. 15-puzzle. Rubik's cube. Logistical operations to move people, equipment, and materials.

Planning Problem: 8-Puzzle Planning example. Can we solve the 8-puzzle? Conditions. Cij, 1  i, j  9. Initial state. c0 = {C11, C22, …, C66, C78, C87, C99}. Goal state. c* = {C11, C22, …, C66, C77, C88, C99}. Operators. Precondition to apply Oi = {C11, C22, …, C66, C78, C87, C99}. After invoking Oi, conditions C79 and C97 become true. After invoking Oi, conditions C78 and C99 become false. Solution. No solution to 8-puzzle or 15-puzzle! Cij means tile i is in square j 1 2 3 4 5 6 8 7 9 Oi 1 2 3 4 5 6 8 9 7

Diversion: Why is 8-Puzzle Unsolvable? 8-puzzle invariant. Any legal move preserves the parity of the number of pairs of pieces in reverse order (inversions). 3 1 2 3 1 2 3 1 2 4 5 6 4 5 6 4 6 8 7 8 7 8 5 7 not really algorithms or data structures, put puzzles are fun Note: invariant for 15 slider puzzle is number of pairs of pieces in reverse order PLUS row of blank square 3 inversions 1-3, 2-3, 7-8 3 inversions 1-3, 2-3, 7-8 5 inversions 1-3, 2-3, 7-8, 5-8, 5-6 1 2 3 1 2 3 4 5 6 4 5 6 7 8 8 7 0 inversions 1 inversion: 7-8

Planning Problem: Binary Counter Planning example. Can we increment an n-bit counter from the all-zeroes state to the all-ones state? Conditions. C1, …, Cn. Initial state. c0 = . Goal state. c* = {C1, …, Cn }. Operators. O1, …, On. To invoke operator Oi, must satisfy C1, …, Ci-1. After invoking Oi, condition Ci becomes true. After invoking Oi, conditions C1, …, Ci-1 become false. Solution. {C1}  {C2}  {C1, C2}  {C3}  {C3, C1}  … Observation. Any solution requires at least 2n - 1 steps. Ci corresponds to bit i = 1 all 0s all 1s i-1 least significant bits are 1 set bit i to 1 set i-1 least significant bits to 0

Planning Problem: In Exponential Space Configuration graph G. Include node for each of 2n possible configurations. Include an edge from configuration c' to configuration c'' if one of the operators can convert from c' to c''. PLANNING. Is there a path from c0 to c* in configuration graph? Claim. PLANNING is in EXPTIME. Pf. Run BFS to find path from c0 to c* in configuration graph. ▪ Note. Configuration graph can have 2n nodes, and shortest path can be of length = 2n - 1. binary counter

Planning Problem: In Polynomial Space Theorem. PLANNING is in PSPACE. Pf. Suppose there is a path from c1 to c2 of length L. Path from c1 to midpoint and from c2 to midpoint are each  L/2. Enumerate all possible midpoints. Apply recursively. Depth of recursion = log2 L. ▪ same idea as linear space sequence alignment algorithm for edit distance boolean hasPath(c1, c2, L) { if (L  1) return correct answer foreach configuration c' { boolean x = hasPath(c1, c', L/2) boolean y = hasPath(c2, c', L/2) if (x and y) return true } return false enumerate using binary counter

9.5 PSPACE-Complete

PSPACE-Complete PSPACE. Decision problems solvable in polynomial space. PSPACE-Complete. Problem Y is PSPACE-complete if (i) Y is in PSPACE and (ii) for every problem X in PSPACE, X P Y. Theorem. [Stockmeyer-Meyer 1973] QSAT is PSPACE-complete. Theorem. PSPACE  EXPTIME. Pf. Previous algorithm solves QSAT in exponential time, and QSAT is PSPACE-complete. ▪ Summary. P  NP  PSPACE  EXPTIME. P  EXPTIME follows from time hierarchy theorem PSPACE = NPSPACE is Savitch's theorem it is known that P  EXPTIME, but unknown which inclusion is strict; conjectured that all are

PSPACE-Complete Problems More PSPACE-complete problems. Competitive facility location. Natural generalizations of games. Othello, Hex, Geography, Rush-Hour, Instant Insanity Shanghai, go-moku, Sokoban Given a memory restricted Turing machine, does it terminate in at most k steps? Do two regular expressions describe different languages? Is it possible to move and rotate complicated object with attachments through an irregularly shaped corridor? Is a deadlock state possible within a system of communicating processors? memory restricted Turing machine = n tape cells, where n is part of the input, encoded in unary

Competitive Facility Location Input. Graph with positive edge weights, and target B. Game. Two competing players alternate in selecting nodes. Not allowed to select a node if any of its neighbors has been selected. Competitive facility location. Can second player guarantee at least B units of profit? subset of selected nodes must form an independent set 10 1 5 15 5 1 5 1 15 10 Yes if B = 20; no if B = 25.

Competitive Facility Location Claim. COMPETITIVE-FACILITY is PSPACE-complete. Pf. To solve in poly-space, use recursion like QSAT, but at each step there are up to n choices instead of 2. To show that it's complete, we show that QSAT polynomial reduces to it. Given an instance of QSAT, we construct an instance of COMPETITIVE-FACILITY such that player 2 can force a win iff QSAT formula is true.

Competitive Facility Location assume n is odd Construction. Given instance (x1, …, xn) = C1  C1  … Ck of QSAT. Include a node for each literal and its negation and connect them. at most one of xi and its negation can be chosen Choose c  k+2, and put weight ci on literal xi and its negation; set B = cn-1 + cn-3 + … + c4 + c2 + 1. ensures variables are selected in order xn, xn-1, …, x1. As is, player 2 will lose by 1 unit: cn-1 + cn-3 + … + c4 + c2. 10n 10n . .. 100 100 10 10

Competitive Facility Location Construction. Given instance (x1, …, xn) = C1  C1  … Ck of QSAT. Give player 2 one last move on which she can try to win. For each clause Cj, add node with value 1 and an edge to each of its literals. Player 2 can make last move iff truth assignment defined alternately by the players failed to satisfy some clause. ▪ 10n 10n 1 . .. 100 100 10 10