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

Similar documents
9. PSPACE. PSPACE complexity class quantified satisfiability planning problem PSPACE-complete

9. PSPACE 9. PSPACE. PSPACE complexity class quantified satisfiability planning problem PSPACE-complete

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

Computational Complexity IV: PSPACE

Lecture 20: PSPACE. November 15, 2016 CS 1010 Theory of Computation

8. INTRACTABILITY I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 2/6/18 2:16 AM

Polynomial-Time Reductions

POLYNOMIAL SPACE QSAT. Games. Polynomial space cont d

Algorithm Design and Analysis

NP and Computational Intractability

SOLUTION: SOLUTION: SOLUTION:

Lecture 23: More PSPACE-Complete, Randomized Complexity

Umans Complexity Theory Lectures

Intro to Theory of Computation

COP 4531 Complexity & Analysis of Data Structures & Algorithms

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

SAT, NP, NP-Completeness

Space Complexity. Huan Long. Shanghai Jiao Tong University

Answers to the CSCE 551 Final Exam, April 30, 2008

Circuits. Lecture 11 Uniform Circuit Complexity

NP-Completeness. Sections 28.5, 28.6

Algorithms Design & Analysis. Approximation Algorithm

Computational Intractability 2010/4/15. Lecture 2

Database Theory VU , SS Complexity of Query Evaluation. Reinhard Pichler

INAPPROX APPROX PTAS. FPTAS Knapsack P

Definition: Alternating time and space Game Semantics: State of machine determines who

COMPLEXITY THEORY. PSPACE = SPACE(n k ) k N. NPSPACE = NSPACE(n k ) 10/30/2012. Space Complexity: Savitch's Theorem and PSPACE- Completeness

Comp487/587 - Boolean Formulas

6.841/18.405J: Advanced Complexity Wednesday, February 12, Lecture Lecture 3

8.1 Polynomial-Time Reductions. Chapter 8. NP and Computational Intractability. Classify Problems

NP-Complete Problems. More reductions

A An Overview of Complexity Theory for the Algorithm Designer

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Notes on Complexity Theory Last updated: October, Lecture 6

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Lecture 11: Proofs, Games, and Alternation

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lecture 2 : Regular Expressions & DFAs

CS151 Complexity Theory. Lecture 13 May 15, 2017

Non-Deterministic Time

Introduction to Computational Complexity

Theory of Computation Space Complexity. (NTU EE) Space Complexity Fall / 1

Lecture 8. MINDNF = {(φ, k) φ is a CNF expression and DNF expression ψ s.t. ψ k and ψ is equivalent to φ}

A brief introduction to Logic. (slides from

4/30/14. Chapter Sequencing Problems. NP and Computational Intractability. Hamiltonian Cycle

More on NP and Reductions

Complete problems for classes in PH, The Polynomial-Time Hierarchy (PH) oracle is like a subroutine, or function in

Space is a computation resource. Unlike time it can be reused. Computational Complexity, by Fu Yuxi Space Complexity 1 / 44

Computability and Complexity Theory: An Introduction

NP and NP Completeness

Chapter 8. NP and Computational Intractability

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine.

NP and Computational Intractability

MTAT Complexity Theory October 20th-21st, Lecture 7

6.840 Language Membership

P, NP, NP-Complete, and NPhard

NP Completeness and Approximation Algorithms

Algorithms: COMP3121/3821/9101/9801

Limits to Approximability: When Algorithms Won't Help You. Note: Contents of today s lecture won t be on the exam

Theory of Computation. Ch.8 Space Complexity. wherein all branches of its computation halt on all

Computability and Complexity CISC462, Fall 2018, Space complexity 1

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

CSE200: Computability and complexity Space Complexity

Maximum 3-SAT as QUBO

CSCI3390-Second Test with Solutions

Artificial Intelligence. 3 Problem Complexity. Prof. Dr. Jana Koehler Fall 2016 HSLU - JK

More NP-Complete Problems

8.5 Sequencing Problems. Chapter 8. NP and Computational Intractability. Hamiltonian Cycle. Hamiltonian Cycle

PSPACE COMPLETENESS TBQF. THURSDAY April 17

Shamir s Theorem. Johannes Mittmann. Technische Universität München (TUM)

CS 583: Algorithms. NP Completeness Ch 34. Intractability

Switches are PSPACE-Complete

Space and Nondeterminism

Design and Analysis of Algorithms

P and NP. Warm Up: Super Hard Problems. Overview. Problem Classification. Tools for classifying problems according to relative hardness.

CS21 Decidability and Tractability

NP-Hardness reductions

CSE 135: Introduction to Theory of Computation NP-completeness

Intelligent Agents. Formal Characteristics of Planning. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University

Lecture 22: PSPACE

Correctness of Dijkstra s algorithm

} } } Lecture 23: Computational Complexity. Lecture Overview. Definitions: EXP R. uncomputable/ undecidable P C EXP C R = = Examples

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

Foundations of Query Languages

NP-Completeness. Subhash Suri. May 15, 2018

Computational Complexity

Definition: Alternating time and space Game Semantics: State of machine determines who

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

A Collection of Problems in Propositional Logic

Space Complexity. Master Informatique. Université Paris 5 René Descartes. Master Info. Complexity Space 1/26

CS 6783 (Applied Algorithms) Lecture 3

4/12/2011. Chapter 8. NP and Computational Intractability. Directed Hamiltonian Cycle. Traveling Salesman Problem. Directed Hamiltonian Cycle

Automata Theory CS Complexity Theory I: Polynomial Time

Descriptive Complexity and Some Unusual Quantifiers

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

CSCI3390-Lecture 14: The class NP

Transcription:

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

Geography Game Geography. Alice names capital city c of country she is in. Bob names a capital city c' that starts with the letter on which c ends. Alice 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. 2

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 4

PSPACE Binary counter. Count from 0 to 2 n - 1 in binary. Algorithm. Use n bit odometer. Claim. 3-SAT is in PSPACE. Pf. Enumerate all 2 n 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. 5

9.3 Quantified Satisfiability

Quantified Satisfiability QSAT. Let Φ(x 1,, x n ) be a Boolean CNF formula. Is the following propositional formula true? x 1 x 2 x 3 x 4 x n-1 x n Φ(x 1,, x n ) assume n is odd Intuition. Amy picks truth value for x 1, then Bob for x 2, then Amy for x 3, and so on. Can Amy satisfy Φ no matter what Bob does? Ex. (x 1 " x 2 ) # (x 2 " x 3 ) # (x 1 " x 2 " x 3 ) Yes. Amy sets x 1 true; Bob sets x 2 ; Amy sets x 3 to be same as x 2. Ex. (x 1 " x 2 ) # (x 2 " x 3 ) # (x 1 " x 2 " x 3 ) No. If Amy sets x 1 false; Bob sets x 2 false; Amy loses; No. if Amy sets x 1 true; Bob sets x 2 true; Amy loses. 7

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. x 1 = 0 x 1 = 1 return true iff both subproblems are true x 2 = 0 x 2 = 1 return true iff either subproblem is true x 3 = 0 x 3 = 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) 8

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. 1 2 4 5 3 6 move 12 1 2 4 5 3?... 1 2 4 5 3 6 8 7 8 7 6 7 8 initial configuration goal configuration 10

Planning Problem Conditions. Set C = { C 1,, C n }. Initial configuration. Subset c 0 C of conditions initially satisfied. Goal configuration. Subset c* C of conditions we seek to satisfy. Operators. Set O = { O 1,, O k }. To invoke operator O i, must satisfy certain prereq conditions. After invoking O i 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. 11

Planning Problem: 8-Puzzle Planning example. Can we solve the 8-puzzle? Conditions. C ij, 1 i, j 9. C ij means tile i is in square j 1 2 3 Initial state. c 0 = {C 11, C 22,, C 66, C 78, C 87, C 99 }. 4 5 6 8 7 9 Goal state. c* = {C 11, C 22,, C 66, C 77, C 88, C 99 }. O i Operators. Precondition to apply O i = {C 11, C 22,, C 66, C 78, C 87, C 99 }. After invoking O i, conditions C 79 and C 97 become true. After invoking O i, conditions C 78 and C 99 become false. 1 2 3 4 5 6 8 9 7 Solution. No solution to 8-puzzle or 15-puzzle! 12

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 4 5 6 8 7 3 inversions 1-3, 2-3, 7-8 3 1 2 4 5 6 8 7 3 inversions 1-3, 2-3, 7-8 3 1 2 4 6 8 5 7 5 inversions 1-3, 2-3, 7-8, 5-8, 5-6 1 2 3 4 5 6 7 8 0 inversions 1 2 3 4 5 6 8 7 1 inversion: 7-8 13

Planning Problem: Binary Counter Planning example. Can we increment an n-bit counter from the allzeroes state to the all-ones state? Conditions. C 1,, C n. Initial state. c 0 = φ. Goal state. c* = {C 1,, C n }. Operators. O 1,, O n. To invoke operator O i, must satisfy C 1,, C i-1. C i corresponds to bit i = 1 all 0s all 1s After invoking O i, condition C i becomes true. After invoking O i, conditions C 1,, C i-1 become false. i-1 least significant bits are 1 set bit i to 1 set i-1 least significant bits to 0 Solution. { } {C 1 } {C 2 } {C 1, C 2 } {C 3 } {C 3, C 1 } Observation. Any solution requires at least 2 n - 1 steps. 14

Planning Problem: In Exponential Space Configuration graph G. Include node for each of 2 n 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 c 0 to c* in configuration graph? Claim. PLANNING is in EXPTIME. Pf. Run BFS to find path from c 0 to c* in configuration graph. Note. Configuration graph can have 2 n nodes, and shortest path can be of length = 2 n - 1. binary counter 15

Planning Problem: In Polynomial Space Theorem. PLANNING is in PSPACE. Pf. Suppose there is a path from c 1 to c 2 of length L. Path from c 1 to midpoint and from c 2 to midpoint are each L/2. Enumerate all possible midpoints. Apply recursively. Depth of recursion = log 2 L. boolean haspath(c 1, c 2, L) { if (L 1) return correct answer enumerate using binary counter } foreach configuration c' { boolean x = haspath(c 1, c', L/2) boolean y = haspath(c 2, c', L/2) if (x and y) return true } return false 16

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. it is known that P EXPTIME, but unknown which inclusion is strict; conjectured that all are 18

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? 19

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? 10 1 5 15 5 1 5 1 15 10 Yes if B = 20; no if B = 25. 20

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. 21

Competitive Facility Location Construction. Given instance Φ(x 1,, x n ) = C 1 C 1 C k of QSAT. assume n is odd Include a node for each literal and its negation and connect them. at most one of x i and its negation can be chosen Choose c k+2, and put weight c i on literal x i and its negation; set B = c n-1 + c n-3 + + c 4 + c 2 + 1. ensures variables are selected in order x n, x n-1,, x 1. As is, player 2 will lose by 1 unit: c n-1 + c n-3 + + c 4 + c 2. 10 n 10 n x n x n 100. 100 x 2 x 2 10 10 x 1 x 1 22

Competitive Facility Location Construction. Given instance Φ(x 1,, x n ) = C 1 C 1 C k of QSAT. Give player 2 one last move on which she can try to win. For each clause C j, 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. 10 n 10 n 1 x 1 " x 2 " x n. 100 x n x n 100 x 2 x 2 10 10 x 1 x 1 23