Alternative Representations Propositions and StateVariables Alternative Representations Literature
Alternative Representations Propositions and State-Variables Alternative Representations
Literature l Malik Ghallab, Dana Nau, and Paolo Traverso. Automated Planning – Theory and Practice, chapter 2. Elsevier/Morgan Kaufmann, 2004. Alternative Representations 2
Classical Representations l l l propositional representation • • world state is set of propositions action consists of precondition propositions, propositions to be added and removed STRIPS representation • like propositional representation, but first-order literals instead of propositions state-variable representation • • state is tuple of state variables {x 1, …, xn} action is partial function over states Alternative Representations 3
Classical Planning l l task: find solution for planning problem • initial state • atoms (relations, objects) • planning domain • operators (name, preconditions, effects) • goal l solution (plan) Alternative Representations 4
Overview l l World States Domains and Operators Planning Problems Plans and Solutions Expressiveness Alternative Representations 5
Knowledge Engineering l What types of objects do we need to represent? • example: cranes, robots, containers, … • note: objects usually only defined in problem l What relations hold between these objects? • example: at(robot, location), empty(crane), … • static vs. fluent relations Alternative Representations 6
Representing World States STRIPS state propositional state-variable set of atoms first-order atom proposition state-variable expression yes no functions objects/types yes/maybe no/no yes/maybe static relations yes not necessary no atom relations Alternative Representations 7
DWR Example: STRIPS States state = {attached(p 1, loc 1), attached(p 2, loc 1), in(c 1, p 1), in(c 3, p 1), top(c 3, p 1), on(c 3, c 1), on(c 1, pallet), in(c 2, p 2), top(c 2, p 2), on(c 2, pallet), belong(crane 1, loc 1), empty(crane 1), adjacent(loc 1, loc 2), adjacent(loc 2, loc 1), at(r 1, loc 2), occupied(loc 2), unloaded(r 1)} Alternative Representations crane 1 c 2 pallet p 2 c 3 c 1 pallet p 1 r 1 loc 2 loc 1 8
DWR Example: Propositional States l l L={onpallet, onrobot, holding, at 1, at 2} S={s 0, …, s 5} • s 0={onpallet, at 2} • s 1={holding, at 2} • s 2={onpallet, at 1} • s 3={holding, at 1} • s 4={onrobot, at 1} • s 5={onrobot, at 2} Alternative Representations crane s 0 cont. pallet robot location 1 location 2 9
State Variables l some relations are functions • example: at(r 1, loc 1): relates robot r 1 to location loc 1 in some state • truth value changes from state to state • will only be true for exactly one location l in each state l idea: represent such relations using statevariable functions mapping states into objects • example: functional representation: rloc: robots×S→locations Alternative Representations 10
DWR Example: State-Variable State Descriptions l l l simplified: no cranes, no piles state-variable functions: • • • rloc: robots×S → locations rolad: robots×S→containers ∪ {nil} cpos: containers×S → locations ∪ robots sample state-variable state descriptions: • • {rloc(r 1)=loc 1, rload(r 1)=nil, cpos(c 1)=loc 1, cpos(c 2)=loc 2, cpos(c 3)=loc 2} {rloc(r 1)=loc 1, rload(r 1)=c 1, cpos(c 1)=r 1, cpos(c 2)=loc 2, cpos(c 3)=loc 2} Alternative Representations 11
Overview l l World States Domains and Operators Planning Problems Plans and Solutions Expressiveness Alternative Representations 12
Knowledge Engineering l l What types of actions are there? • For each action type, and each relation, what must (not) hold for the action to be applicable? • l preconditions For each action type, and each relation, what relations will (no longer) hold due to the action? • l example: move robots, load containers, … effects (must be consistent) For each action type, what objects are involved in performing the action? • • any object mentioned in the preconditions and effects preconditions should mention all objects Alternative Representations 13
Representing Operators name preconditions (set of) applicability STRIPS propositional state-variable n(x 1, …, xk) name n(x 1, …, xk) first-order literals propositions state-variable expressions precond+(a)⊆s ⋀ precond-(a)⋂s={} precond(a) ⊆ s propositional literals xs←v (s – effects-(a)) ∪ effects+(a) {xs=c | x∈X} where xs←c ∈ effects(a) or xs=c ∈ s otherwise effects (set of) first-order literals γ(s, a) (s – effects-(a)) ∪ effects+(a) Alternative Representations 14
DWR Example: STRIPS Operators l l l move(r, l, m) • • precond: adjacent(l, m), at(r, l), ¬occupied(m) effects: at(r, m), occupied(m), ¬occupied(l), ¬at(r, l) load(k, l, c, r) • • precond: belong(k, l), holding(k, c), at(r, l), unloaded(r) effects: empty(k), ¬holding(k, c), loaded(r, c), ¬unloaded(r) put(k, l, c, d, p) • • precond: belong(k, l), attached(p, l), holding(k, c), top(d, p) effects: ¬holding(k, c), empty(k), in(c, p), top(c, p), on(c, d), ¬top(d, p) Alternative Representations 15
DWR Example: Propositional Actions a precond(a) effects-(a) effects+(a) take {onpallet} {holding} put {holding} {onpallet} load {holding, at 1} {holding} {onrobot} unload {onrobot, at 1} {onrobot} {holding} move 1 {at 2} {at 1} move 2 {at 1} {at 2} Alternative Representations 16
DWR Example: State-Variable Operators l l l move(r, l, m) • • precond: rloc(r)=l, adjacent(l, m) effects: rloc(r)←m load(r, c, l) • • precond: rloc(r)=l, cpos(c)=l, rload(r)=nil effects: cpos(c)←r, rload(r)←c unload(r, c, l) • • precond: rloc(r)=l, rload(r)=c effects: rload(r)←nil, cpos(c)←l Alternative Representations 17
Overview l l World States Domains and Operators Planning Problems Plans and Solutions Expressiveness Alternative Representations 18
Representing Planning Problems STRIPS propositional state-variable initial state world state in respective representation domain (set of operators) in respective representation goal same as preconditions in respective representation Alternative Representations 19
DWR Example: STRIPS Planning Problem l l l Σ: STRIPS planning domain for DWR domain si: any state • example: s 0 = {attached(pile, loc 1), in(cont, pile), top(cont, pile), on(cont, pallet), belong(crane, loc 1), empty(crane), adjacent(loc 1, loc 2), adjacent(loc 2, loc 1), at(robot, loc 2), occupied(loc 2), unloaded(robot)} g: any subset of L • example: g = {¬unloaded(robot), at(robot, loc 2)}, i. e. Sg={s 5} Alternative Representations crane s 0 cont. pallet robot loc 1 loc 2 crane s 5 pallet cont. robot location 1 location 2 20
DWR Example: Propositional Planning Problem l Σ: propositional planning domain for DWR domain si: any state l g: any subset of L l • example: initial state = s 0∈S • example: g={onrobot, at 2}, i. e. Sg={s 5} Alternative Representations 21
Overview l l World States Domains and Operators Planning Problems Plans and Solutions Expressiveness Alternative Representations 22
Classical Plans and Solutions (all Representations) l A plan is any sequence of actions π=� a 1, …, ak� , where k≥ 0. • l The extended state transition function for plans is defined as follows: • γ(s, π)=s if k=0 (π is empty) • γ(s, π)=γ(γ(s, a 1), �a 2, …, ak�) if k>0 and a 1 applicable in s • γ(s, π)=undefined otherwise Let P=(Σ, si, g) be a planning problem. A plan π is a solution for P if γ(si, π) satisfies g. Alternative Representations 23
Overview l l World States Domains and Operators Planning Problems Plans and Solutions Expressiveness Alternative Representations 24
Grounding a STRIPS Planning Problem l l Let P=(O, si, g) be the statement of a STRIPS planning problem and C the set of all the constant symbols that are mentioned in si. Let ground(O) be the set of all possible instantiations of operators in O with constant symbols from C consistently replacing variables in preconditions and effects. Then P’=(ground(O), si, g) is a statement of a STRIPS planning problem and P’ has the same solutions as P. Alternative Representations 25
Translation: Propositional Representation to Ground STRIPS l Let P=(A, si, g) be a statement of a propositional planning problem. In the actions A: • replace every action (precond(a), effects-(a), effects+(a)) with an operator o with • some unique name(o), • precond(o) = precond(a), and • effects(o) = effects+(a) ∪ {¬p | p∈effects-(a)}. Alternative Representations 26
Translation: Ground STRIPS to Propositional Representation l Let P=(O, si, g) be a ground statement of a classical planning problem. • • In the operators O, in the initial state si, and in the goal g replace every atom P(v 1, …, vn) with a propositional atom Pv 1, …, vn. In every operator o: • for all ¬p in precond(o), replace ¬p with p’, • if p in effects(o), add ¬p’ to effects(o), • if ¬p in effects(o), add p’ to effects(o). In the goal replace ¬p with p’. For every operator o create an action (precond(o), effects-(a), effects+(a)). Alternative Representations 27
Translation: STRIPS to State. Variable Representation l Let P=(O, si, g) be a statement of a classical planning problem. In the operators O, in the initial state si, and in the goal g: • • replace every positive literal p(t 1, …, tn) with a statevariable expression p(t 1, …, tn)=1 or p(t 1, …, tn)← 1 in the operators’ effects, and replace every negative literal ¬p(t 1, …, tn) with a statevariable expression p(t 1, …, tn)=0 or p(t 1, …, tn)← 0 in the operators’ effects. Alternative Representations 28
Translation: State-Variable to STRIPS Representation l Let P=(O, si, g) be a statement of a statevariable planning problem. In the operators’ preconditions, in the initial state si, and in the goal g: • l replace every state-variable expression p(t 1, …, tn)=v with an atom p(t 1, …, tn, v), and in the operators’ effects: • replace every state-variable assignment p(t 1, …, tn)←v with a pair of literals p(t 1, …, tn, v), ¬p(t 1, …, tn, w), and add p(t 1, …, tn, w) to the respective operators preconditions. Alternative Representations 29
Overview l l l World States Domains and Operators Planning Problems Plans and Solutions Expressiveness Alternative Representations 30
- Slides: 30