Complexity of Classical Planning Megan Smith Lehigh University CSE 497, Spring 2007.

33
Complexity of Classical Planning Megan Smith Lehigh University CSE 497, Spring 2007

Transcript of Complexity of Classical Planning Megan Smith Lehigh University CSE 497, Spring 2007.

Complexity of Classical Planning

Megan SmithLehigh UniversityCSE 497, Spring 2007

Outline

Review Classical Planning Complexity Background Computational Complexity Main Results

Review: Classical Representation

Function-free first-order language L Statement of a classical planning problem: P = (s0, g, O) s0: initial state - a set of ground atoms of L g: goal formula - a set of literals Operator: (name, preconditions, effects)

Classical planning problem: P = (,s0,Sg)

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

Review: Set-Theoretic Representation

Like classical representation, but restricted to propositional logic

State: a set of propositions - these correspond to ground atoms

{on-c1-pallet, on-c1-r1, on-c1-c2, …, at-r1-l1, at-r1-l2, …} No operators, just actions

take-crane1-loc1-c3-c1-p1precond: belong-crane1-loc1, attached-p1-loc1,

empty-crane1, top-c3-p1, on-c3-c1delete: empty-crane1, in-c3-p1, top-c3-p1, on-c3-p1add: holding-crane1-c3, top-c1-p1

Weaker representational power than classical representation Problem statement can be exponentially larger

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

Review: State-Variable Representation

A state variable is like a record structure in a computer program Instead of on(c1,c2) we might write cpos(c1)=c2

Equivalent power to classical representation Each representation requires a similar amount of

space Each can be translated into the other in low-order

polynomial time Classical representation is more popular, mainly

for historical reasons In many cases, state-variable representation is more

convenient

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

Review: State-Variable Representation (cont…)

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

Load and unload operators:

Decidability

Decidable An algorithm can be written that will

return “yes” if the problem is solvable and “no” if it is not

Semidecidable An algorithm can be written that will

return “yes” if the problem is solvable but will not return if it is not

Undecidable Neither decidable nor semidecidable

Language Recognition Problems

Utilized in complexity analyses Definitions:

L – finite set of characters L* - set of all possible strings of

characters in Lℒ - a language, given L and L*, ℒ may

be any subset of L*

Language Recognition Problems

Recognition procedure for ℒ : computational procedure p such that

for every s ∈ L*, p(s) returns yes if s ∈ ℒ and p(s) does not return yes if s ∉ ℒ

may return “no” or not at all

Language Recognition Problems (LR)

Worst case running time:Tmax(p,n,ℒ) = max{T(p,s)|s ∈ ℒ and |s| = n}

Worst case running space:Smax(p,n,ℒ) = max{S(p,s)|s ∈ ℒ and |s| = n}

reduction of ℒ1 to ℒ2: deterministic procedure r: ℒ1*→ ℒ2*

such that s ∈ ℒ1 iff r(s) ∈ ℒ2

Complexity Classes

Time P NP EXPTIME NEXPTIME

Space NLOGSPACE PSPACE EXPSPACE

Bounded by Time

P – Set of all languages ℒ such that ℒ has a deterministic recognition procedure whose worst-case running time is polynomially bounded

Bounded by Time

NP – Set of all languages ℒ such that ℒ has a nondeterministic recognition procedure whose worst-case running time is polynomially bounded

Examples: Boolean-SAT, knapsack problem, clique problem, vertex cover problem, etc.

Bounded by Time

EXPTIME – Set of all languages ℒ such that ℒ has a deterministic recognition procedure whose worst-case running time is exponentially bounded

Bounded by Space

NLOGSPACE - Set of all languages ℒ such that ℒ has a nondeterministic recognition procedure whose worst-case space requirement is logarithmically bounded

Bounded by Space

PSPACE - Set of all languages ℒ such that ℒ has a recognition procedure whose worst-case space requirement is polynomially bounded

Bounded by Space

EXPSPACE - Set of all languages ℒ such that ℒ has a recognition procedure whose worst-case space requirement is exponentially bounded

Complexity Classes

Given a complexity class C and a language ℒ ℒ is C-hard if every language in C is

reducible to ℒ in polynomial time ℒ is C-complete if ℒ is C-hard and ℒ ∈ C

Some sets known to be unequal Unknown whether all are unequal P = NP anyone?

NLOGSPACE ⊆ P ⊆ NP ⊆ PSPACE ⊆ EXPTIME ⊆ NEXPTIME ⊆ EXPSPACE

Planning Problems as LR Problems

PLAN-EXISTENCE – set off all strings s ⊆ L* such that s is the statement of a solvable problem

Also known as PLANSAT

Planning Problems as LR Problems

PLAN-LENGTH – set of all strings of the form (s,k) such that s is the statement of a solvable planning problem, k is a nonnegative integer, and s has a solution plan that contains no more than k actions

Decidability Results

For classical, set-theoretic, & state-variable planning, PLAN-EXISTENCE is decidable

If we extend classical or state-variable planning to allow terms to contain function symbols, PLAN-LENGTH is still decidable

If we extend classical or state-variable planning to allow terms to contain function symbols, PLAN-EXISTENCE is semidecidable

Allow function symbols? Decidability of PLAN-EXISTENCE

Decidability of PLAN-LENGTH

No Decidable Decidable

Yes Semidecidable Decidable

Proof of Semidecidability

Let P = (O,s0, g) O has no negative preconditions, no

negative effects, and at most one positive effect

Set of Horn clauses Hp: ∀a ∈ s0; Hp includes {true ⇒ a} Hp includes {true ⇒ g} ∀o ∈ O let precond(o) = {p1,…,pn} and

effects(o)={e}; Hp includes {e ⇒ p1,…,pn}

P has solution plan iff Hp is consistent

SEMIDECIDABLE!

EXPSPACE Turing Machine

Turing Machine M = (K,∑,Γ,δ,q0,F) K = {q0,…, qm} is a finite set of states F ⊆ K is set of final states Γ is finite set of allowable symbols ∑ ⊆ Γ is the set of allowable input symbols q0 ∈ K is the start state δ is a mapping from K × Γ to K × Γ × {Left,Right}

Given a Turing Machine M that uses at most an exponential number of tape cells in terms of the length of its input and an input string x, does M accept the string x?

……

Complexity Results

No restrictions, the size of any state is at most exponential: PLAN-EXISTENCE is in EXPSPACE

No negative effects: PLAN-EXISTENCE is reduced to NEXPTIME

No negative effects & no negative preconditions (ordering now doesn’t matter) PLAN-EXISTENCE is now reduced to EXPTIME

NLOGSPACE ⊆ P ⊆ NP ⊆ PSPACE ⊆ EXPTIME ⊆ NEXPTIME ⊆ EXPSPACE

Complexity Results (cont…)

Even with both these restrictions, PLAN-LENGTH remains NEXPTIME

If each operator has at most one precondition: Both PLAN-EXISTENCE & PLAN-LENGTH

are now in PSPACE Restricting all atoms to be ground

lowers complexity by one level

NLOGSPACE ⊆ P ⊆ NP ⊆ PSPACE ⊆ EXPTIME ⊆ NEXPTIME ⊆ EXPSPACE

Complexity Results (cont…)

If the operator set is fixed in advance: classical planning is at most in PSPACE

NLOGSPACE ⊆ P ⊆ NP ⊆ PSPACE ⊆ EXPTIME ⊆ NEXPTIME ⊆ EXPSPACE

Interesting Properties

Extending planning operators to allow conditional effects doesn’t affect these complexity results

In most cases, the complexity of PLAN-EXISTENCE in classical planning is one level harder than in set-theoretic planning

NLOGSPACE ⊆ P ⊆ NP ⊆ PSPACE ⊆ EXPTIME ⊆ NEXPTIME ⊆ EXPSPACE

Interesting Properties (cont…)

If negative effects are allowed, PLAN-EXISTENCE is EXPSPACE-complete but PLAN-LENGTH is only NEXPTIME-complete

PLAN-LENGTH has same complexity regardless of allowing/disallowing negated preconditions

Negative effects are more powerful than negative preconditions

NLOGSPACE ⊆ P ⊆ NP ⊆ PSPACE ⊆ EXPTIME ⊆ NEXPTIME ⊆ EXPSPACE

Dana Nau: Lecture slides for Automated PlanningLicensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/

STRIPS Review π the empty plan do a modified backward search from g

instead of -1(s,a), each new set of subgoals is just precond(a)

whenever you find an action that’s executable in the current state, then go forward on the current search path as far as possible, executing actions and appending them to π

repeat until all goals are satisfied

g

g1

g2

g3

a1

a2

a3

g4

g5

g3

a4

a5

current search path

a6

π = a6, a4s = ((s0,a6),a4)

g6

a3

satisfied in s0

Propositional STRIPS Planning

Initial state is finite set of ground atomic formuals

Preconditions & postconditions of an operator are ground literals

Goals are ground literals Operators don’t have any variables

or indirect side effects

Extended Propositional STRIPS Planning

Augments propositional STRIPS planning with a “domain theory” domain theory = set of ground

formulas infers additional effects requires preference ordering of all

literals to avoid ambiguity

References

Automated Planning, Theory and Practice, Chapter 3

Tom Bylander The Computational Complexity of Propositional STRIPS Planning, in: Artificial Intelligence, 1994