Professional Documents
Culture Documents
Expert Systems
- Planning -
Gerald Steinbauer
Institut für Softwaretechnologie
Inffeldgasse 16b/2
A-8010 Graz
Austria
Motivation
• planning is …
• a very old problem
• a very important problem
• related to scheduling
• part of research on AI since ever
• part of every intelligent system
• annual conferences on planning; e.g. ICAPS
• annual competitions for planning
Applications of Planning
• Classical Action Planning, e.g., Robots
• Renormalization of Diagnosis Problems
• Software Testing
• Repair and Reconfiguration
• Exploration
• Logistics
• … and many more
Example: Logistics
Running Example
• rigid propositions
•
•
•
• dynamic propositions
•
•
•
•
.. location •
.. robot •
.. pile •
.. crane •
.. container •
Gerald Steinbauer Expert Systems
6
Institute for Software Technology
Example: Dinner-Date
initial situation: one has clean hands and there is
garbage in the kitchen. it is quiet in the house.
desired situation: a dinner is cooked, there is no
garbage in the kitchen and we have a present.
what can we do?
cook a dinner,
wrap a present,
carry the garbage out or
dolly the garbage out
Restrictive Assumptions
• A0: Finite system:
• finitely many states, actions, events
• A1: Fully observable:
• the controller always knows Σ’s
current state
• A2: Deterministic:
• each action has only one outcome
• A3: Static (no exogenous events):
• no changes but the controller’s actions
• A4: Restricted goals:
• a set of goal states 𝑆
• A5: Sequential plans:
• a plan is a linearly ordered sequence of actions (𝑎 , 𝑎 , … , 𝑎 )
• A6: Implicit time:
• no time durations; linear sequence of instantaneous states
• A7: Off-line planning:
• planner doesn’t know the execution status
Gerald Steinbauer Expert Systems
10
Institute for Software Technology
Transition System
• a transition system is a 5-tupel
T=<S,L,T,s0,S*>
• S a finite set of states
• L is a finite set of (transition) labels
• TSLS is transition relation
• s0S is the initial state
• S*S is the set of goal states
Transition System
goal states a
C B c
b
d b d
d
D A
a f
b
d E F
e
initial states
Set-Theoretic Representation
• it relies on a finite set of proposition symbols
• let L={p1,p2,…,pn} a finite set of proposition symbols
then a set-theoretic planning domain is a restricted
transition system =(S,A,)
• S2L, each state is a subset of L, if p s then p holds in the
world represented by s
• each action aA is a triple of subsets of L
a=(pre(a),effects+(a),effects-(a)), effects+(a) and effects-(a)
are disjoint, a is applicable if pre(a)S
• if sS the state produced by an action is also in S
• transition function (s,a)=(s-effects-(a))effects+(a)
Classical Representation
• let L be a first-order language with finite many
predicate and constant symbols
• a classical planning domain is a restricted transition
system =(S,A,)
• S2{all ground atoms of L}
• A are all ground operators in O, O is the set of all operators
defended as triple (name(o) with n(x1,...,xn), pre(o),
effects(o)), x1,…,xn are variables in pre(o) and effects(o),
pre(o) and effects(o) are set of literals, a is applicable if
pre+(a) s and pre-(a) s =
• (s,a)= (s-effects-(a))effects+(a) if a is applicable in s
• if sS the state produced by an action is also in S
Types of Planning
• State-Space Planning
• search in the space of states
• states are connected by state transitions (i.e., actions )
• find a state which satisfied the goal
• solution: a path from the initial state to the goal state
Forward Search
the most simple algorithm
Forward-Search(D,I,g)
sI
the empty plan
loop
if s satisfies g return
applicable {a|a is a ground action of D and
precond(a) is true in s}
if applicable=Ø then return failure
non-deterministically choose an action a applicable
s (s,a)
.a
there exist also deterministic implementation
Gerald Steinbauer Expert Systems
17
Institute for Software Technology
Backward Search
Backward-Search(D,I,g)
the empty plan
loop
if I satisfies g return
relevant {a|a is a ground action of D and
a is relevant for g}
if relevant=Ø then return failure
non-deterministically choose an action a relevant
a.
g -1(g,a)
Types of Planning
• Plan-Space Planning
• search in the space of partially defined plans
• plans are connected by refinement actions, i.e., achieve a
new sub-goal or remove inconsistencies
• search starts with an empty plan node
• search for a final node containing a solution plan
• uses the “least commitment” philosophy
• a partial plan comprises a set of actions plus some ordering
and grounding constraints
Plan-Space Planning
• each node of the search space is a partial plan
• a set of partially-instantiated actions
• a set of constraints
• make more and more refinements, until we have a solution
• types of constraints
• precedence constraint: a must precede b
• binding constraints: inequality constraints, e.g., v1 ≠ v2 or v ≠ c;
equality constraints (e.g., v1 = v2 or v = c) and/or substitutions
• causal link: use action a to establish the precondition p needed by
action b
Threat
• an action in a plan is a threat on a causal link
iff
• has an effect that is possibly inconsistent with , i.e and
are unifiable
• the ordering constraints and are consistent with
• the binding constraints for the unification of and consistent with
Flaw
• a flaw in a plan is either:
• a subgoal, i.e. a precondition of an action in without a causal link
or
• a threat, i.e. an action that may interfere with a causal link
• a partial plan is a solution to the
planning problem if has no flaws and
if the set of ordering constraints and binding
constraints are consistent
• quantifiers in formulas
• types
• conditional effects
• disjunctive preconditions
• axiomatic inference
• functions
PDDL Basics
• The Planning Domain Definition Language (PDDL)
• variants used by most implemented planning systems
• supports a formalism comparable to what we have outlined above
(including schematic operators and quantification)
• syntax inspired by the Lisp programming language: e.g., prefix
notation for formulas
(and (or (on A B) (on A C))
(or (on B A) (on B C))
(or (on C A) (on A B)))
• the planner input is separated into a domain file (predicates, types,
action schemas) and a problem file (objects, initial state, goal).
Dinner-Date: Domain
(define (domain dinner-date)
(:requires :strips)
(:predicates (garbage) (cleanHands) (quiet) (dinner)
(present))
(:action cook
:precondition (cleanHands)
:effect (dinner)
)
(:action wrap
:precondition (quiet)
:effect (present)
)
(:action carry
:effect (and (not (garbage)) (not(cleanHands)))
)
(:action dolly
:effect (and (not (garbage)) (not(quiet)))
)
)
Gerald Steinbauer Expert Systems
38
Institute for Software Technology
Dinner-Date: Problem
(define (problem dinner-date)
(:domain dinner-date)
(:requires :strips :negative-preconditions)
(:init (garbage) (cleanHands) (quiet))
(:goal (and (dinner) (present) (not (garbage))))
)
Example
http://editor.planning.domains
Graphplan
• basic idea, alternate between two phases
• graph expansion: extends Graphplan forward in time
• solution extraction: performs backward-chaining to look for a
plan that solved the planning problem
• fast algorithm - outperforms (most) others
• basic for encoding planning problems as SAT
problems
• Graphplan uses a planning graph
Planning Graph
• two types of nodes
• proposition nodes
• action nodes
• nodes are arranged in levels
• even-numbered levels contain proposition nodes
• odd-numbered levels contain action nodes
• the zero level stores nodes of propositions true in the initial
state
• edges connect proposition nodes of the level i with
action nodes of level i+1 and actions from level i+1 to
propositions of level i+2
Planning Graph
• an action is element of a level i iff all propositions
occurring in the precondition are in level i-1.
• an edge between a proposition p at level i and action a
at level i+1 exists iff p is a precondition of a.
• a proposition p is in level i>1 iff there exists an action a
in level i-1 where p is in the effect set. in this case there
exists an edge between a and p.
• we assume the existence of identity actions for each
proposition (aka maintenance actions).
• an action level represents (possible) parallel actions
Planning Graph
0 i-1 i i+1
actions
propositions
Mutex Relations
• actions at the same level may not be executed at
once, e.g., carry and cook
• binary mutual exclusion (mutex) between nodes
• two actions at level i are mutex if either
• the effect of one action is the negation of the other’s effect
[inconsistent effect]
• one action deletes the precondition of the other [interference]
• the actions have preconditions, that are mutex at level i-1
[competing needs]
Mutex Relations
• two propositions at level i are mutex if
• all ways of achieving the proposition (actions at level i-1) are
pairwise mutex [inconsistent support]
--
Gerald Steinbauer Expert Systems
46
Institute for Software Technology
Inconsistent Effect
not A
Inference
not A
Competing Needs
not A
Inconsistent Support
--
Gerald Steinbauer Expert Systems
50
Institute for Software Technology
Graph Expansion
• assume we built up the graph to the proposition level
i.
• create a new action level i+1. for every action a,
where all preconditions are satisfied, create a new
node for a.
• create a new proposition level i+2. for every effect in
action a occurring in level i+1 create a proposition
node in i+1.
• compute the mutex relations.
carry
not garbage
dolly
cleanHands cleanHands
not cleanHands
cook
quiet quiet
wrap
not quiet
dinner
present
0 1 2
Gerald Steinbauer Expert Systems
52
Institute for Software Technology
Solution Extraction
1. assume Graphplan has extended the graph up to a
level i, in which all goal propositions are present
[necessary condition].
2. for each of the sub-goals at level i do:
a) choose an action a from level i-1 that achieves the sub-goal.
b) if this action is consistent, i.e., not mutex, with the previously
chosen actions, then take the next sub-goal.
c) otherwise, backtrack to a previous choice.
Solution Extraction
3. after Graphplan has found a consistent set of
actions for level i-1, it recursively tries to find a plan
for the action’s precondition on level i-2.
4. if the zero level is reached a plan has been
extracted.
5. if backtracking fails on all combinations (of actions
for each goal) then Graphplan extends the graph (as
described previously) and tries solution extraction
again.
garbage
Dinner Example Level 2 garbage
carry carry
not garbage
dolly dolly
cleanHands
cleanHands
not cleanH.
cook cook
quiet quiet
wrap wrap
not quiet
dinner
present
0 1 2 3 4
Gerald Steinbauer Expert Systems
56
Institute for Software Technology
carry carry
not garbage
dolly dolly
cleanHands
cleanHands
not cleanH.
wrap wrap
not quiet
dinner
possible plan: dinner
cook, wrap, carry
present
0 1 2 3 4
Gerald Steinbauer Expert Systems
57
Institute for Software Technology
Some Observations
• from one level to another …
• propositions monotonically increase
• actions have new effects
• always carried forward by no-ops
• actions monotonically increase
• more preconditions are satisfied
• propositional mutex relations monotonically decrease
• new paths for propositions emerge
• action mutex relations monotonically decrease
• new ways to achieve the precondition emerge
Level Off
• plan graph levels off
• after some some levels k all levels are identical
• because of it’s finite state
• and the set of propositions never decrease
• and mutex do not reappear
Bibliography
• Daniel S. Weld. Recent advances in AI Planning. AI Magazine, pp
93-123, Summer 1999.
• Richard Fikes and Nils Nilsson. STRIPS: A New Approach to the
Application of Theorem Proving to Problem Solving. Artificial
Intelligence, 2(3-4): 189-208, 1971.
• Avrim L. Blum and Merrick L. Furst. Fast Planning Through
Planning Graph Analysis. Artificial Intelligence 90(1-2). 1995.
• Malik Ghallab, Dana Nau and Paolo Traverso. Automated
Planning – Theory and Practice. Morgan Kaufman. 2005.
• @article{fox2003pddl2,
• Fox, Maria and Long, Derek. PDDL2. 1: An Extension to PDDL for
Expressing Temporal Planning Domains. J. Artif. Intell. Res. (JAIR),
2003(20).
Thank You!
--
Gerald Steinbauer Expert Systems
61