Causal-link Planning II José Luis Ambite
Planning as Search State Space Plan Space Algorithm Progression, POP Regression Nodes World States Partial Plans Edges/ Actions Plan refinements: For example, in BW: � Step addition Transitions � move-A-from-B-to-C � Step reuse � move-B-from-A-to-Table � Demotion � move-C-from-B-to-A � Promotion � … CS 541 Causal Link Planning II 2
POP algorithm POP((A, O, L), agenda, actions) Termination If agenda = () then return (A, O, L) Goal Selection Pick (Q, a need ) from agenda Action Selection a add = choose (actions) s.t. Q ∈ effects(a add ) If no such action a add exists, fail . Step Addition L’ := L ∪ (a add , Q, a need ) ; O’ := O ∪ (a add < a need ) Step Reuse agenda’ := agenda - (Q, a need ) Update goals If a add is new, then A := A ∪ a add and ∀ P ∈ preconditions(a add ), add (P, a add ) to agenda’ For every action a t that threatens any causal link (a p , Q, a c ) in L’ choose to add a t < a p or a c < a t to O. Protect causal links If neither choice is consistent, fail . - Demotion: a t < a p Demotion POP((A’, O’, L’), agenda, actions) - Promotion: a c < a t Promotion CS 541 Causal Link Planning II 3
More expressive action representation � Actions with variables � Conditional effects � Disjunctive preconditions � Universal quantification -> UCPOP [Penberthy & Weld 92] CS 541 Causal Link Planning II 4
Propositional STRIPS Move-C-from-A-to-Table: precondition: (and (on C A) (clear C)) effects: (and (on C Table) (not (on C A)) (clear A)) � With n blocks => O(n 3 ) actions! � Many actions not relevant for goal CS 541 Causal Link Planning II 5
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))) CS 541 Causal Link Planning II 6
Modifications to POP to handle actions with variables (1) � Plan = (A, O, L, B), where � A: set of actions in the plan � O: temporal orderings between actions (a < b) � L: causal links linking actions via a literal � B : binding constraints (co-designation and non co- designation) � Unification (instead of matching) � To satisfy (Q, a need ) we can use an action a add such that P ∈ effects(a add ) and MGU(P, Q, B) ≠ ⊥ � For example, use a new action move(?b ?x ?y) to satisfy on(A C), since MGU(on(?b ?y), on(A C), B)= ((?b = A) (?y = C)) ≠ ⊥ CS 541 Causal Link Planning II 7
Modifications to POP to handle actions with variables (2) � Distinct variables for new action instances � Move(?b1 ?x1 ?y1), Move(?b2 ?x2 ?y2), … � Add codesignation constrains in the preconditions of a new action to the bindings B � After adding move(?b ?x ?y) to satisfy on(A C), B := B ∪ ((?b ≠ ?x) (?x ≠ ?y) (?b = A) (?y = C)) [(?b ≠ ?y) and (?y ≠ Table) are already satisfied since ?b and ?y are bound to constants] CS 541 Causal Link Planning II 8
Modifications to POP to handle actions with variables (3) � Threat resolution: � Delay threat checks until ground values are known for variables, or � “Separation”: add (inequality) binding that ensures condition does not unify. � Ensure all actions eventually grounded � Require ground initial state (no variables) � “Safe” operators: vars(effects) ⊆ vars (precs) CS 541 Causal Link Planning II 9
POP with variables A0 (on C A) (on-table A) (on-table B) (clear C) (clear B) Step reuse (clear ?b2) (clear ?y2) (on ?b2 ?x2) A2: move ?b2 from ?x2 to ?y2 (clear ?b1) (clear ?y1) (on ?b1 ?x1) -(on ?b2 Table) -(clear ?y2) (on ?b2 ?y2) A1: move ?b1 from ?x1 to ?y1 ((?b2 A) (?y2 B) Step -(on ?b1 Table) -(clear ?y1) (on ?b1 ?y1) … ) addition Step addition ((?b1= B) (?y1 = C) (?b1 ≠ ?x1) (?x1 ≠ ?y1) (on A B) (on B C) (?y1 ≠ Table)) Ainf CS 541 Causal Link Planning II 10
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)) CE Antecedent: State before (clear ?x) action execution (when ( ≠ ?y Table) CE Consequent: (not (clear ?y)))) State after action execution CS 541 Causal Link Planning II 11
Conditional Effects (when P Q) � means if P holds in the state before the action is applied, then Q will hold in the state resulting from the application of the action � In the situation calculus: P(x, s) → Q(y, do(a,s)) CS 541 Causal Link Planning II 12
Modifications to POP to handle conditional effects � Allow conditional effects to be used for causal links � Add the antecedent of conditional effect to the agenda. � Threat resolution by “confrontation”: � Add the negation of the antecedent of the conditional effect to the agenda. � Handle negated goals � Same as positive goals � Closed world assumption for initial state CS 541 Causal Link Planning II 13
Disjunctive preconditions � Ex: (and (on ?x ?y) (or (clear ?x) (big-and-flat ?x))) � Modifications to POP: � Put (or Q1 Q2) on the agenda when the action is selected. � When (or Q1 Q2) is picked from the agenda, choose either Q1 or Q2 to work on. � Note: No disjunctive effects CS 541 Causal Link Planning II 14
Universal quantification in preconditions and effects Move-briefcase(?b ?loc1 ?loc2) preconds: (and (briefcase ?b) (at ?b ?loc1) (forall ((padlock ?p)) (not (locked ?b ?p))) ( ≠ ?loc1 ?loc2)) effects: (and (at ?b ?loc2) (not (at ?b ?loc1)) (forall ((object ?x)) (when (in ?x ?b) (and (at ?x ?loc2) (not (at ?x ?loc1)))) CS 541 Causal Link Planning II 15
Universal quantification restricted to finite, static types � Assume a finite, static set of typed objects � No object creation � No object destruction � Example: � Extension[(briefcase ?b)] = {B1} � Extension[(padlock ?p)] = {P1, P2} � Extension[(object ?x)] = {B1, P1, P2, O1, O2, O3, …} CS 541 Causal Link Planning II 16
Approach: Replace quantified expressions with ground literals � Since quantification is over a finite set (type), replace “forall” goals with the conjunction of all the ground formulas obtained from the instances of the type. � Universal base: Y( ∀ t1 x ∆ (x)) = Y( ∆ (c 1 )) ∧ … ∧ Y( ∆ (c n )) where the instances of t1 are (c 1 , .., c n ) � Example: if Extension[(padlock ?x)] = {p1, p2}, then (forall ((padlock ?x)) (not (locked ?x ?b))) � (and (not (locked p1 ?b)) (not (locked p2 ?b))) CS 541 Causal Link Planning II 17
Modifications to POP to handle quantification � Replace a universally quantified goal with its universal base. � Use ground literals from the universal base of a quantified effect as needed for causal links. � Consider threats when their bindings refer to universally quantified variables. CS 541 Causal Link Planning II 18
Briefcase example A0 (briefcase B) (at B home) (in P B) (at P home) (at B office) (at P home) Ainf CS 541 Causal Link Planning II 19
Briefcase example: No threats yet 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 office) (not (at B ?l)) (at ?o1 office) (not (at ?o1 ?l)) (at B office) (at P home) Ainf CS 541 Causal Link Planning II 20
Briefcase example: (?l = home) => threat to (at P home) A0 (briefcase B) (at B home) (in P B) (at P home) (briefcase B) (at B home) (in ?o1 B) move B home office (at B office) (not (at B home)) (at ?o1 office) (not (at ?o1 home)) (at B off) (at P home) Ainf CS 541 Causal Link Planning II 21
Briefcase example: Solve threat by confrontation 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 home office (at B office) (not (at B home)) (at ?o1 office) (not (at ?o1 home)) (at B off) (at P home) Ainf CS 541 Causal Link Planning II 22
Briefcase example: Final Plan A0 (briefcase B) (at B home) (in P B) (at P home) (in P B) take-out P B (not (in P B)) (briefcase B) (at B home) (in ?o1 B) (not (in P B)) move B home office (at B office) (not (at B home)) (at ?o1 office) (not (at ?o1 home)) (at B off) (at P home) Ainf CS 541 Causal Link Planning II 23
Quantified goal example CS 541 Causal Link Planning II 24
Quantified goal example CS 541 Causal Link Planning II 25
Quantified goal example CS 541 Causal Link Planning II 26
CS 541 Causal Link Planning II 27
Recommend
More recommend