Presentation is loading. Please wait.

Presentation is loading. Please wait.

Space Complexity. Reminder: P, NP classes P NP is the class of problems for which: –Guessing phase: A polynomial time algorithm generates a plausible.

Similar presentations


Presentation on theme: "Space Complexity. Reminder: P, NP classes P NP is the class of problems for which: –Guessing phase: A polynomial time algorithm generates a plausible."— Presentation transcript:

1 Space Complexity

2 Reminder: P, NP classes P NP is the class of problems for which: –Guessing phase: A polynomial time algorithm generates a plausible solution S –Checking phase: A polynomial time algorithm certifies that if S is correct A problem npc is NP-complete if: –npc is in NP –For every other problem np in NP, there is a polynomial time algorithm that transforms np into npc (polynomial reduction)

3 P is a subset of NP If a problem p is in P, there is an algorithm A solving p and A runs in polynomial time How do we show that it is in NP?  Make A the generation phase  Construct an algorithm that always returns “true” as the checking phase: check(P,S) return true

4 A new Problem WIN: Generate a winning strategy for a 2-person, turn- based, perfect information, deterministic game. Example? Suppose that the game is finite. Example? The “n” for making complexity analysis is: –For example: Chess –Winning strategy: “policy” on JuKeCB – Chess, we assume that if it reaches 100 moves then the game ends with a tide The number of moves made during a game

5 A Solution: Minimax Concepts: State: node in search space Operator: valid move Terminal test: game over Utility function: value for outcome of the game MAX: 1 st player, maximizing its own utility MIN: 2 nd player, minimizing Max’s utility

6 Let us examine the complexity Is minimax polynomial? Can we show that it is in NP? (think certification phase) So is WIN not in NP? No. This requires exploring exponential many branches No. The minimax tree itself is exponential. So certifying it by using the minimax tree will require exponential time We do not know. Likely it is not in NP  No one has been able to proof that is in NP (or P)  No one has been able to proof that it is not in NP (or P)

7 PSPACE PSPACE is the class of all problems that can be solved with algorithms that use a polynomial amount of memory (regardless of the time they take to run) Examples:  SAT.  ((x  y)  ¬x)  y  We systematically try every combination:  0010, 0111, 1000, 1101  2 n possible combinations  But only O(n) space used  Same trick is use to show that NP is a subset of PSPACE:  Systematically generate each potential solution (need polynomial space only to keep track)  Check if it is a solution

8 PSPACE-complete A problem psc is PSPACE-complete if:  psc is in PSPACE  For every other problem ps in PSPACE, there is a polynomial time algorithm that transforms ps into psc (polynomial reduction) Example:  QBF: Satisfaction of quantified Boolean formulas:  x  y((x  y)  ¬x)  y

9 QBF: Quantified Boolean Formulas Qx 1 Qx 2 Qx 3 …Qx n f(x 1, x 2, …, x n ) Where –Each x i is a variable –f(x 1, x 2, …, x n ) is a Boolean formula without quantifiers –x 1, x 2, …, x n are the only variables in f –Qx i can be either  x i or  x i (QSAT) Decision problem: Given a QBF, is it true? false? Observation 1: Seems difficult to prove that QSAT is in NP Observation 2: It is easy to prove that QSAT is in PSPACE

10 Transforming WIN into QSAT (Example illustrating QSAT PSPACE-completeness) QBF Formula for indicating if a winning formula exists: –Suppose x 1, x 2, x 3, … x n are variables for 1 st, 2 nd, 3 rd,.. moves by Player 1 –Suppose y 1, y 2, y 3, … y n are variables for 1 st, 2 nd, 3 rd,.. moves by Player 2 –Suppose that winPlayer1(x 1, y 1, x 2, y 2,…, y n ) indicates that Player 1 wins when the game sequence is x 1, y 1, x 2, y 2,…, y n –Under this circumstances a winning strategy for Player 1 can be represented as the QBF Formula :  x 1  y 1  x 2  y 2 …  y n win(x 1, y 1, …, y n )

11 EXP-Classes EXPTIME is the class of problems that can be solved with algorithms that runs in exponential time –Usual definition for EXPTIME-complete –Example: Go EXPSPACE is the class of all problems that can be solved with algorithms that use an exponential amount of memory –Usual definition for ESPSPACE-complete –Example: HTN Planning with “regularity” We know: P  NP  PSPACE  EXPTIME  EXPSPACE


Download ppt "Space Complexity. Reminder: P, NP classes P NP is the class of problems for which: –Guessing phase: A polynomial time algorithm generates a plausible."

Similar presentations


Ads by Google