540 likes | 552 Views
This article introduces temporal representation in planning using Situation Calculus and explores deductive planning as an automated reasoning approach. It discusses the trade-offs in knowledge representation and provides a complex illustration of this approach.
E N D
PLANNING Temporal representation 1 Deductive planning in Logic Temporal representation 2 Partial order regression planning
A second class of planners: based on A.R. The many motivations ... • Provide an additional (more complex) illustration of AR. • Show important trade-offs in Knowledge Representation. • Introduce Temporal Representation (Situation Calculus).
Temporal representation 1 From STRIPS to a simple situation calculus
Towards planning as Automated Reasoning • Formulate in a logic theoryT: • The initial situation • For each operator: • its preconditions • the relation between the previous situation and the next one. • Prove the logical consequenceF: “ There exists a sequence of operations, such that if they are applied to the initial situation, the resulting situation satisfies some given properties”. • Extract the plan from the proof.
1) State representations, like on(A,B) clear(A) on(B,Table) • Thus: if the goal is to have on(A,Table), this is inconsistent with the current property on(A,B) What the STRIPS represen-tation lacks to do this: 2) Add and Delete list are procedural. • These do not declaratively describe the relation between the previous situation and the next. do NOT describe WHEN (at which time point or in which situation) these properties hold. • Remember: logic is monotonic … no consequences get removed!
1) What kind of temporal identifications to use? Time points Situation names Extra argument Meta-predicate • 2) How to add this information? Introducing temporal information: • Two dimensions of options: on(A,B,T) on(A,B,S) holds(on(A,B),T) holds(on(A,B),S)
on(B,A,S0) on(A,Table,S0) clear(B,S0) B A Initial situation A B Goal situation s on(B,Table,s) A tiny example problem:
Examples of situations: • moveATableB(S0) • moveCBA(moveABTable(S0)) • Operations are described by functors: • Examples: • move A from B to C: moveABC(x) • move A from Table to B: moveATableB(x) • Situation descriptions using ‘terms’: • The initial situation is described by a constant: S0 • A situation obtained from a situation s by applying an operator move . from . to . as the term: move…(s) Situation calculus, extra argument.
A B B A A B moveATableB(moveBATable(S0)) S0 moveBATable(S0) moveBTableA(moveBATable(S0)) B A The situations in this world
B A Initial situation A B Goal situation Finding a proof = finding a substitution for s of the form: THUS: the value for sIS THE PLAN. s on(B,Table,s) s/ moveBATable(S0) The plan ?
Note: also valid are: ~on(A,B,S0) ~on(B,Table,S0) ~clear(A,S0) Not clear x z x y z y x y Completing situations • In STRIPS (and in LP) these are implicitly represented. • In FOL, we could instead add: x,y,z,s on(x,y,s) ~y=Table ~x=z ~on(z,y,s) x,y,z,s on(x,y,s) ~y=z ~on(x,z,s) x,y,s on(x,y,s) ~y=Table ~clear(y,s) PS: also completes all later situations
move B from A to Table • Example: if on(B,A) clear(B) add on(B,Table) clear(A) delete on(B,A) Relating different situations (1) • For each operator we need to represent the relation between previous and next situation s on(B,A,s) clear(B,s) on(B,Table,moveBATable(s)) clear(A,moveBATable(s)) • Note: delete on(B,A) is implicitly represented because of add on(B,Table) and the completing formulae.
still holds on(A,Table) • Example: if on(B,A) clear(B) add clear(A) on(B,Table) delete on(B,A) FRAME AXIOMS move B from A to Table • Ifon(A,Table,s) is true and move B from A to Table is applicable, thenon(A,Table,moveBATable(s)) is true. on(A,Table) • We need to express this explicitly ! initially Relating different situations: Frame axioms (1): • STRIPS operators only express which things change !
Example: if on(B,A) clear(B) add clear(A) on(B,Table) delete on(B,A) move B from A to Table Relating different situations: Frame axioms (2): • Anything that was on something else before, except for B on A, still is: x,y,s on(B,A,s) clear(B,s) on(x,y,s) ~(x=B y=A) on(x,y,moveBATable(s)) • Anything that was clear before, still is: x,s on(B,A,s) clear(B,s) clear(x,s) clear(x,moveBATable(s))
It requires: • very many axioms and frame axioms • for EACH separate operation Discussion: • This is one of the most simple options. • Generalizing to operators patterns in not easy. • But: this is sufficient to illustrate planning as deduction. • We discuss more refined representations later.
Planning as deduction Automated reasoning applied to a simple situation calculus representation
T: on(B,A,S0) on(A,Table,S0) clear(B,S0) s on(B,A,s) clear(B,s) on(B,Table,moveBATable(s)) clear(A,moveBATable(s)) + the consistency axioms + the Frame axioms + similar formulae for other operators F: s on(B,Table,s) ~F:false on(B,Table,s) The theory and goal
(T {~F})’: on(B,A,S0) on(A,Table,S0) clear(B,S0) on(B,Table,moveBATable(s)) on(B,A,s) clear(B,s) clear(A,moveBATable(s)) on(B,A,s) clear(B,s) false on(B,Table,s) + normalization of others Normalization
false on(B,Table,s1) on(B,Table,moveBATable(s2)) on(B,A,s2) clear(B,s2) {s1/moveBATable(s2)} false on(B,A,s2) clear(B,s2) on(B,A,S0) {s2/S0} false clear(B,S0) clear(B,S0) false A linear top-down proof What is the plan?? The answer substitution:{s1/moveBATable(S0)}
~F: false on(B,Table,s) on(A,Table,s) • Proof: first part identical to the previous one, except that every goal gets an extra conjunct: on(A,Table,s1), where s1 gradually get instantiated tomoveBATable(S0). The relevance of Frame axioms? • Find a plan such that B gets on the Table AND A is still on the Table.
false on(B,Table,s1) on(A,Table, s1) on(B,Table,moveBATable(s2)) on(B,A,s2) clear(B,s2) {s1/moveBATable(s2)} on(A,Table, moveBATable(s2)) false on(B,A,s2) clear(B,s2) on(B,A,S0) {s2/S0} false clear(B,S0) on(A,Table, moveBATable(S0)) clear(B,S0) false on(A,Table, moveBATable(S0)) A linear top-down proofextended No longer resolves with anything, except frame axioms !
on(x,y,moveBATable(s)) x=B on(B,A,s) clear(B,s) on(x,y,s) on(x,y,moveBATable(s)) y=A on(B,A,s) clear(B,s) on(x,y,s) Normalization of Frame Axiom 1: x,y,s on(B,A,s) clear(B,s) on(x,y,s) ~(x=B y=A) on(x,y,moveBATable(s)) x,y,s on(x,y,moveBATable(s)) ~on(B,A,s) ~clear(B,s) ~on(x,y,s) (x=B y=A) x,y,s (on(x,y,moveBATable(s)) x=B ~on(B,A,s) ~clear(B,s) ~on(x,y,s)) (on(x,y,moveBATable(s)) y=A ~on(B,A,s) ~clear(B,s) ~on(x,y,s))
false on(A,Table, moveBATable(S0)) on(x,y,moveBATable(s)) x=B on(B,A,s) clear(B,s) on(x,y,s) {x/A,y/Table, s/S0} A=B on(B,A,S0) clear(B,S0) on(A,Table,S0) on(B,A,S0) A=B clear(B,S0) on(A,Table,S0) clear(B,S0) A=B on(A,Table,S0) on(A,Table,S0) A=B false ???? The continuation of the proof
false A=B false A=Table false B=Table • In normalized form: • Thus we get: A=B false A=B false Unique Names Axioms • For each two non-unifiable syntactic objects o1 and o2: ~o1=o2. • Here: ~A=B, ~A=Table, ~B=Table
No, not with this simple representation. • Planning with operator patterns? • No: are not even represented here! Can deductive planning achieve the STRIPS control? • Definitely does regression (goal directed search) ! • Partial order planning? • Reason: s property(s) • Resolution steps construct: • s = move…(move…(move…( . . . ))) • this is a total order !! • Need more refined temporal representations to do these.
Temporal representation 2 Representing operator patterns Meta-representation: situation calculus Time-point representation: event calculus
Example: move x from y to z s move(x,y,z,s) • Effect on relating situations: example: x,y,z,s on(x,y,s) clear(x,s) clear(z,s) on(x,z,move(x,y,z,s)) clear(y,move(x,y,z,s)) Representing operator patterns (1) • S0 still represents the initial situation. • Representation of a situation resulting from an operator pattern: functor move/4 • =WE get MUCH LESS different axioms!
move x from Table to y move x from y to Table movetoT(x,y,s) s s movefromT(x,y,s) • Relating situations: example: x,y,s on(x,Table,s) clear(x,s) clear(y,s) on(x,y,movefromT(x,y,s)) Representing operator patterns (2) • Better represent other operator patterns with other functors (to avoid confusion - and unification with wrong ones). • Still: 3 such axioms + 6 frame axioms needed !
on(B,A,S0) on(A,Table,S0) clear(B,S0) x,y,z,s on(x,y,s) ~y=Table ~x=z ~on(z,y,s) x,y,z,s on(x,y,s) ~y=z ~on(x,z,s) x,y,s on(x,y,s) ~y=Table ~clear(y,s) x,y,z,s on(x,y,s) clear(x,s) clear(z,s) on(x,z,move(x,y,z,s)) clear(y,move(x,y,z,s)) x,y,s on(x,Table,s) clear(x,s) clear(y,s) on(x,y,movefromT(x,y,s)) x,y,s on(x,y,s) clear(x,s) on(x,Table,movetoT(x,y,s)) clear(y,movetoT(x,y,s)) The full theory: Initial situation: Consistency axioms: New initiated properties for each action:
x,y,z,u,v,s on(x,y,s) clear(x,s) clear(z,s) on(u,v,s) ~(u=x v=y) on(u,v,move(x,y,z,s)) x,y,z,u,s on(x,y,s) clear(x,s) clear(z,s) clear(u,s) ~(u=z) clear(u,move(x,y,z,s)) x,y,u,v,s on(x,y,s) clear(x,s) on(u,v,s) ~(u=x v=y) on(u,v,movetoTable(x,y,s)) x,y,u,s on(x,y,s) clear(x,s) clear(u,s) clear(u,movetoTable(x,y,s)) x,y,u,v,s on(x,Table,s) clear(x,s) clear(y,s) on(u,v,s) ~(u=x v=Table) on(u,v,movefromTable(x,y,s)) x,y,u,s on(x,Table,s) clear(x,s) clear(y,s) clear(u,s) ~(u=y) clear(u,movefromTable(x,y,s)) The full theory (2) Frame axioms for “move x from y to z” Frame axioms for “move x from y to table” Frame axioms for “move x from Table to y”
Initial situation: on(B,A,S0) on(A,Table,S0) clear(B,S0) Consistency axioms: x,y,z,s on(x,y,s) ~y=Table ~x=z ~on(z,y,s) x,y,z,s on(x,y,s) ~y=z ~on(x,z,s) x,y,s on(x,y,s) ~y=Table ~clear(y,s) No difference here! Difference with previous representation?
New initiated properties for each action: x,y,z,s on(x,y,s) clear(x,s) clear(z,s) on(x,z,move(x,y,z,s)) clear(y,move(x,y,z,s)) x,y,s on(x,Table,s) clear(x,s) clear(y,s) on(x,y,movefromT(x,y,s)) x,y,s on(x,y,s) clear(x,s) on(x,Table,movetoT(x,y,s)) clear(y,movetoT(x,y,s)) Each of these for EVERY instance of x,y and z ! For N blocks: N ! times all these rules. Difference with previousrepresentation (2): Also for the frame axioms!
Meta-representation The Situation Calculus
Basic change in representation: holds(on(x,y),s) on(x,y,s) • Why is this useful? • on/2 now is a term • FOL allows to abstract terms by variables (and quantify over them) • FOL doesn’t allow abstraction of atoms or predicates ! • Example: x,y,p,s holds(p,s) ~p = on(x,y) holds(p,movetoT(x,y,s)) Is the frame axiom for on/2 and for clear/1 combined in one ! Meta-representation • Could not be done with extra-argument representation.
The initial situation: p holds(p,S0) p=on(B,A) p=on(A,Table) p=clear(B) • A slightly better representation: holds(p,S0) initially(p) initially(p) p=on(B,A) p=on(A,Table) p=clear(B) Meta-representation:initial situation
S0 A B moveBATable(S0) move B from A to Table movetoT(B,A,S0) B A result(movetoT(B,A),S0) Situation Names:final version 1 2 Reason: The name of the operator is now a term that we can abstract with a variable 3 movetoT(B,A)
We introduce a separate term-representation for operator patterns: move(x,y,z) movetoT(x,y) movefromT(x,y) • Examples: S0 result(move(C,B,A),S0)) result(movefromT(A,B), result(movetoT(B,A),S0)) … Formally: situation names: • Situations are now represented as: result(o,s) , where o is an operator pattern and s a situation.
Ontological improvement: • Now we can not only name SITUATIONS, we can ALSO name OPERATOR PATTERNS. move(x,y,z) movetoT(x,y) movefromT(x,y) AND abstract them by variables: holds(p,result(o,s)) … Improvement ? • Use: we can now define if list, add listand delete listof each operator pattern explicitly with new predicates !
Move x from y to z: move x from y to z if on(x,y) clear(x) clear(z) add clear(y) on(x,z) delete on(x,y) clear(z) legal(move(x,y,z),s) holds(on(x,y),s) holds(clear(x),s) holds(clear(z),s) • Others: legal(movetoT(x,y),s) holds(on(x,y),s) holds(clear(x),s) legal(movefromT(x,y),s) holds(on(x,Table),s) holds(clear(x),s) holds(clear(y),s) If-list: legal/2 predicate
move x from y to z • Move x from y to z: if on(x,y) clear(x) clear(z) add clear(y) on(x,z) delete on(x,y) clear(z) initiates(move(x,y,z),p) p = clear(y) p = on(x,z) • Others: initiates(movetoT(x,y,z),p) p = on(x,Table)p = clear(y) initiates(movefromT(x,y,z),p) p = on(x,y) Add-list: initiates/2 predicate
move x from y to z if on(x,y) clear(x) clear(z) add clear(y) on(x,z) delete on(x,y) clear(z) • Move x from y to z: terminates(move(x,y,z),p) p = on(x,y)p = clear(z) • Others: terminates(movetoT(x,y),p) p = on(x,y) terminates(movefromT(x,y),p) p = on(x,Table)p = clear(y) Delete-list: terminates/2 predicate:
Positive effects of actions: holds(p,result(o,s)) legal(o,s) initiates(o,p) only 1 rule ! • The frame axiom: holds(p,result(o,s)) holds(p,s) legal(o,s) ~terminates(o,p) only 1 rule ! • + the initialization rule: holds(p,S0) initially(p) What is gained ?The Situation Calculus!
holds(p,S0) initially(p) holds(p,result(o,s)) legal(o,s) initiates(o,p) holds(p,result(o,s)) holds(p,s) legal(o,s) ~terminates(o,p) Problem independence • Observe that these axioms defining ‘holds’ are problem independent • and can be applied to any planning problem. • For each new planning problem: only initially, legal, initiates and terminates need to be defined ! • These correspond to the initial situation and to the if- add- and delete-lists of operator patterns.
A goal of the type: false holds(p1,s) … holds(pn,s) Planning: • should be added, where p1,…,pn are the properties that should hold in the goal situation. • Deduction proceeds similarly to what was presented in the extra-argument representation. • In particular; the final value for s in the unifier is the plan !
holds(p,result(o,s)) holds(p,s) legal(o,s) ~terminates(o,p) terminates(move(x,y,z),p) p = on(x,y)p = clear(z) terminates(move(x,y,z),p) p = on(x,y) terminates(move(x,y,z),p) p = clear(z) Completion and consistency • Note that all formulae are essentially Horn clauses (possibly extended with negation in the bodies - case: ~terminates). • Disjunctions in bodies are readily transformed to a set of Horn clauses.
Completion and consistency (2) • Assume that this description is complete (anything else than described is false !), then we can interpret these Horn clauses as a Logic program. • Consequence: the consistency axioms are no longer needed: • Requires that we understand ~holds(p,s) as holds(~p,s), • then information such as holds(~on(B,Table),S0) follows from our specification.
Meta-representation (2) The Event Calculus
Time points Situation names Extra argument on(A,B,T) on(A,B,S) Meta-predicate holds(on(A,B),T) holds(on(A,B),S) Using time points: • Alternative to situations: • Ontology: something holds on a specific moment in time.
holds(p,t) initiated(p,t’) t’ < t ~clipped(p,t’,t) initiated(p,t0) initially(p) initiated(p,t) event(o,t) legal(o,t) initiates(o,p) clipped(p,t’,t) t’ < ss < t event(o,s) legal(o,s) terminates(o,p) t0 < t ~t0=t The main axioms: Where the concepts: initially/1, initiates/2 and terminates/2 are the same as before (and problem dependent), and legal/2 is completely similar as before,but defined in terms of holds(p,t) instead of holds(p,s) .
on(A,B) on(A,B) is still true if it was not undone. t0 t nothing here ‘clips’ on(A,B) on(A,B) is still true if it was not undone. t0 t’ t nothing ‘clips’ Event calculus pictured: • When does something hold at time t ? • If is was true from the beginning and not ‘clipped’: • If something happened to make it true and not ‘clipped’: