Class notes 2 (powerpoint)
Download
Report
Transcript Class notes 2 (powerpoint)
Causal-link planning 2
Jim Blythe
Useful bells and whistles
Last class: state-space and plan-space planning, the
POP algorithm, principle of least commitment.
This class: improving the action representation.
CS 541
Variablised actions
Disjunctive preconditions
Conditional effects
Universal quantifiers
Causal Link Planning II
2
Reminder: blocks world (Sussman anomaly)
Initial:
Goal:
C
A
A
B
B
C
State I: (on-table A) (on C A) (on-table B) (clear B) (clear C)
Goal: (on A B) (on B C)
CS 541
Causal Link Planning II
3
STRIPS representation for actions:
Move-C-from-A-to-Table:
precondition: (and (on C A) (clear C))
effects:
(and (on C Table)
(not (on C A))
(clear A))
CS 541
The explicit effects are the only changes to the state.
Causal Link Planning II
4
POP algorithm
POP((A, O, L), agenda, PossibleActions):
1. If agenda is empty, return (A, O, L)
2. Pick (Q, An) from agenda
3. Ad = choose an action that adds Q.
a.
b.
c.
4.
5.
Remove (Q, An) from agenda. If Ad is new, for each
of its preconditions P add (P, Ad) to agenda.
Q Ac
Ap
For every action At that threatens any link
1.
2.
6.
CS 541
If no such action exists, fail.
Add the link Ad Q Ac to L and the ordering Ad < Ac to O
If Ad is new, add it to A.
Choose to add At < Ap or Ac < At to O.
If neither choice is consistent, fail.
POP((A, O, L), agenda, PossibleActions)
Causal Link Planning II
5
1. ‘Operators’ --- action schemata
CS 541
Move ?b from ?x to ?y
parameters: ?b, ?x, ?y
preconds: (and (on ?b ?x) (clear ?b) (clear ?y)
(≠ ?b ?x) (≠ ?b ?y) (≠ ?x ?y)
(≠ ?y Table))
effects:
(and (on ?b ?y)
(not (on ?b ?x))
(clear ?x)
(not (clear ?y)))
Causal Link Planning II
6
Modifications to POP
Keep a list of bindings with a partial plan (A, O, L, B)
Choose action Ad adding E, with MGU(Q, E, B) defined.
When adding an action, add bindings preconditions to B.
Delay threat checks until ground values are known for
variables.
(why do we know they eventually will be?)
CS 541
Causal Link Planning II
7
Spot the threat!
Work on open precondition (on B C)
A0
(on C A)
(on-table A)
(on-table B)
(clear C)
(clear B)
(clear ?b2) (clear ?y2) (on ?b2 Table)
(clear ?b1) (clear ?y1) (on ?b1 Table)
A2: move ?b2 from Table to ?y2
-(on ?b2 Table) -(clear ?y2) (on ?b2 ?y2)
[[?b2 A] [?y2 B]]
A1: move ?b1 from Table to ?y1
-(on ?b1 Table) -(clear ?y1) (on ?b1 ?y1)
[[?b1 B] [?y1 C]]
(on A B)
(on B C)
Ainf
CS 541
Causal Link Planning II
8
2. Disjunctive preconditions
Preconditions: (and (on ?x ?y)
(or (clear ?x) (big-and-flat ?x)))
Put (or Q1 Q2) on the agenda when the action is selected.
When it’s picked from the agenda, choose either Q1 or
Q2 to work on. (Must try all choices for completeness).
CS 541
Causal Link Planning II
9
3. Conditional effects
CS 541
Move ?b from ?x to ?y
parameters: ?b, ?x, ?y
preconds: (and (on ?b ?x) (clear ?b) (clear ?y)
(≠ ?b ?x) (≠ ?b ?y) (≠ ?x ?y)
effects:
(and (on ?b ?y)
(not (on ?b ?x))
(clear ?x)
(when (≠ ?y Table) (not (clear ?y))))
Causal Link Planning II
10
Modifications to planning algorithm
Allow conditional effects to be used for causal links.
Add the condition to the agenda.
Allow threat resolution by “confrontation”: if the threat
is from a conditional effect, add its negation to the
agenda.
CS 541
Causal Link Planning II
11
4. Universal quantification
Move-briefcase:
preconds: (and (briefcase ?b) (at ?b ?loc)
(forall ((padlock ?p)) (not (locked ?b ?p)))
(≠ ?dest ?loc))
effects: (and (at ?b ?dest)
(not (at ?b ?loc))
(forall ((object ?x))
(when (in ?x ?b)
(and (at ?x ?dest) (not (at ?x ?loc))))
Assume a finite, static set of typed objects.
CS 541
Causal Link Planning II
12
Approach: replace with ground literals
Replace “forall” goals with the conjunction of all the
implied ground goals.
“Universal base” x (x) ( ) .. ( )
1
n
t1
where the instances of t1 are (C1, .., Cn) and
i (x) \ [x Ci ]
so (forall ((padlock ?x)) (not (locked ?x ?b)))
(and (not (locked p1 ?b)) (not (locked p2 ?b)) …)
CS 541
Causal Link Planning II
13
Modifications to planner
Replace a universally quantified goal with its
universal base.
Only use ground literals from the universal base of a
quantified effect as they are needed for causal links.
Consider threats when their bindings refer to
universally quantified variables.
CS 541
Causal Link Planning II
14
Briefcase example
A0
(briefcase B)
(briefcase B)
(at B home)
(at B ?l)
(in P B)
(at P home)
(in ?o1 B)
move B ?l office
(at B off) (not (at B ?l)) (at ?o1 off) (not (at ?o1 ?l))
(at B off)
(at P home)
Ainf
CS 541
Causal Link Planning II
15
Briefcase 2
A0
(briefcase B)
(briefcase B)
(at B home)
(at B home)
(in P B)
(at P home)
(in ?o1 B)
move B ?l office
(at B off)
(not (at B home))(at ?o1 off) (not (at ?o1 home))
(at B off)
(at P home)
Ainf
CS 541
Causal Link Planning II
16
Briefcase 3
A0
(briefcase B)
(at B home)
(briefcase B)
(at B home)
(in P B)
(in ?o1 B)
(at P home)
(not (in P B))
move B ?l office
(at B off)
(not (at B home))(at ?o1 off) (not (at ?o1 home))
(at B off)
(at P home)
Ainf
CS 541
Causal Link Planning II
17
Briefcase 4
A0
(briefcase B)
(at B home)
(in P B)
(at P home)
take-out P B
(briefcase B)
(at B home)
(in ?o1 B)
(not (in P B))
move B ?l office
(at B off)
(not (at B home))(at ?o1 off) (not (at ?o1 home))
(at B off)
(at P home)
Ainf
CS 541
Causal Link Planning II
18