180 likes | 269 Views
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. Variablised actions Disjunctive preconditions Conditional effects
E N D
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. • Variablised actions • Disjunctive preconditions • Conditional effects • Universal quantifiers
Reminder: blocks world (Sussman anomaly) State I: (on-table A) (on C A) (on-table B) (clear B) (clear C) Goal: (on A B) (on B C) Initial: Goal: A C B A B C
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)) • The explicit effects are the only changes to the state.
Q Ac Ap POP algorithm POP((A, O, L), agenda, PossibleActions): • If agenda is empty, return (A, O, L) • Pick (Q, An) from agenda • Ad = choose an action that adds Q. • If no such action exists, fail. • Add the link Ad Ac to L and the ordering Ad < Ac to O • If Ad is new, add it to A. • Remove (Q, An) from agenda. If Ad is new, for each of its preconditions P add (P, Ad) to agenda. • For every action At that threatens any link • Choose to add At < Ap or Ac < At to O. • If neither choice is consistent, fail. • POP((A, O, L), agenda, PossibleActions) Q
1. ‘Operators’ --- action schemata • 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)))
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?)
Work on open precondition (on B C) Spot the threat! A0 (on C A) (on-table A) (on-table B) (clear C) (clear B) (clear ?b2) (clear ?y2) (on ?b2 Table) A2: move ?b2 from Table to ?y2 (clear ?b1) (clear ?y1) (on ?b1 Table) -(on ?b2 Table) -(clear ?y2) (on ?b2 ?y2) A1: move ?b1 from Table to ?y1 [[?b2 A] [?y2 B]] -(on ?b1 Table) -(clear ?y1) (on ?b1 ?y1) [[?b1 B] [?y1 C]] (on A B) (on B C) Ainf
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).
3. Conditional effects • 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))))
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.
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.
Approach: replace with ground literals • Replace “forall” goals with the conjunction of all the implied ground goals. • “Universal base” where the instances of t1 are (C1, .., Cn) and so (forall ((padlock ?x)) (not (locked ?x ?b))) (and (not (locked p1 ?b)) (not (locked p2 ?b)) …)
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.
Briefcase example A0 (briefcase B) (at B home) (in P B) (at P home) (briefcase B) (at B ?l) (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
Briefcase 2 A0 (briefcase B) (at B home) (in P B) (at P home) (briefcase B) (at B 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
Briefcase 3 A0 (briefcase B) (at B home) (in P B) (at P home) (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
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