Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:

Similar presentations


Presentation on theme: "Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:"— Presentation transcript:

1 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 1 Chapter 2 Representations for Classical Planning Dana S. Nau CMSC 722, AI Planning University of Maryland, Fall 2004 Lecture slides for Automated Planning: Theory and Practice

2 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 2 location 1 location 2 location 1 location 2 s1s1 s3s3 s4s4 take put location 1 location 2 location 1 location 2 s0s0 s2s2 s5s5 move1 put take move1 move2 load unload Quick Review of Classical Planning move2 l Classical planning requires all eight of the restrictive assumptions: A0: Finite A1: Fully observable A2: Deterministic A3: Static A4: Attainment goals A5: Sequential plans A6: Implicit time A7: Offline planning location 1 location 2 location 1 location 2

3 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 3 Representations: Motivation l In most problems, far too many states to try to represent all of them explicitly as s 0, s 1, s 2, … l Represent each state as a set of features u e.g., »a vector of values for a set of variables »a set of ground atoms in some first-order language L l Define a set of operators that can be used to compute state- transitions l Don’t give all of the states explicitly u Just give the initial state u Use the operators to generate the other states as needed

4 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 4 Outline l Representation schemes u Classical representation u Set-theoretic representation u State-variable representation u Examples: DWR and the Blocks World u Comparisons

5 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 5 Classical Representation l Start with a function-free first-order language u Finitely many predicate symbols and constant symbols, but no function symbols  Atom: predicate symbol and args - e.g., on(c1,c3), on(c1, x )  Ground expression: contains no variable symbols - e.g., on(c1,c3)  Unground expression: at least one variable symbol - e.g., on(c1, x ) u Substitution:  = {x 1  v 1, x 2  v 2, …, x n  v n } »Each x i is a variable symbol; each v i is a term u Instance of e: result of applying a substitution  to e »Replace variables of e simultaneously, not sequentially l State: a set s of ground atoms u The atoms represent the things that are true in one of  ’s states u Only finitely many ground atoms, so only finitely many possible states

6 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 6 Example of a State

7 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 7 Operators l Operator: a triple o=(name(o), precond(o), effects(o)) u name(o) is a syntactic expression of the form n(x 1,…,x k ) »n: operator symbol - must be unique for each operator »x 1,…,x k : variable symbols (parameters) must include every variable symbol in o u precond(o): preconditions »literals that must be true in order to use the operator u effects(o): effects »literals the operator will make true

8 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 8 Actions l Action: ground instance (via substitution) of an operator

9 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 9 Notation l Let S be a set of literals. Then u S + = {atoms that appear positively in S} u S – = {atoms that appear negatively in S} l More specifically, let a be an operator or action. Then u precond + (a) = {atoms that appear positively in a} u precond – (a) = {atoms that appear negatively in a} u effects + (a) = {atoms that appear positively in a} u effects – (a) = {atoms that appear negatively in a}  effects + ( take (k,l,c,d,p) = { holding (k,c), top (d,p)}  effects – ( take (k,l,c,d,p) = { empty (k), in (c,p), top (c,p), on (c,d)}

10 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 10 Applicability l An action a is applicable to a state s if s satisfies precond(a), u i.e., if precond + (a)  s and precond – (a)  s =  l Here are an action and a state that it’s applicable to:

11 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 11 Result of Performing an Action l If a is applicable to s, the result of performing it is  (s,a) = (s – effects – (a))  effects + (a) u Delete the negative effects, and add the positive ones

12 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 12 l Planning domain: language plus operators u Corresponds to a set of state-transition systems u Example: operators for the DWR domain

13 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 13 Planning Problems l Given a planning domain (language L, operators O) u Statement of a planning problem: a triple P=(O,s 0,g) » O is the collection of operators » s 0 is a state (the initial state) » g is a set of literals (the goal formula)  The actual planning problem: P = ( ,s 0,S g ) » s 0 and S g are as above »  = (S,A,  ) is a state-transition system » S = {all sets of ground atoms in L} » A = {all ground instances of operators in O} »  = the state-transition function determined by the operators l I’ll often say “planning problem” when I mean the statement of the problem

14 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 14 Plans and Solutions l Plan: any sequence of actions  =  a 1, a 2, …, a n  such that each a i is a ground instance of an operator in O l The plan is a solution for P=(O,s 0,g) if it is executable and achieves g u i.e., if there are states s 0, s 1, …, s n such that »  (s 0,a 1 ) = s 1 »  (s 1,a 2 ) = s 2 »… »  (s n–1,a n ) = s n »s n satisfies g

15 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 15 Example l Let P 1 = (O, s 1, g 1 ), where u O is the set of operators given earlier u s 1 is as shown:  g 1 ={ loaded(r1,c3), at(r1,loc2) }

16 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 16 Example (continued) l Here are three solutions for P:   take(crane1,loc1,c3,c1,p1), move(r1,loc2,loc1), move(r1,loc1,loc2), move(r1,loc2,loc1), load(crane1,loc1,c3,r1), move(r1,loc1,loc2)    take(crane1,loc1,c3,c1,p1), move(r1,loc2,loc1), load(crane1,loc1,c3,r1), move(r1,loc1,loc2)    move(r1,loc2,loc1), take(crane1,loc1,c3,c1,p1), load(crane1,loc1,c3,r1), move(r1,loc1,loc2)  l Each of them produces the state shown:

17 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 17 Example (continued) l The first is redundant: can remove actions and still have a solution   take(crane1,loc1,c3,c1,p1), move(r1,loc2,loc1), move(r1,loc1,loc2), move(r1,loc2,loc1), load(crane1,loc1,c3,r1), move(r1,loc1,loc2)    take(crane1,loc1,c3,c1,p1), move(r1,loc2,loc1), load(crane1,loc1,c3,r1), move(r1,loc1,loc2)    move(r1,loc2,loc1), take(crane1,loc1,c3,c1,p1), load(crane1,loc1,c3,r1), move(r1,loc1,loc2)  l The 2nd and 3rd are irredundant and shortest

18 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 18 Set-Theoretic Representation l Like classical representation, but restricted to propositional logic l States: u Instead of a collection of ground atoms … {on(c1,pallet), on(c1,r1), on(c1,c2), …, at(r1,l1), at(r1,l2), …} … use a collection of propositions (boolean variables): {on-c1-pallet, on-c1-r1, on-c1-c2, …, at-r1-l1, at-r1-l2, …}

19 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 19 Set-Theoretic Representation l Instead of an operator like this one, … there are lots of actions like this one l Exponential blowup u If a classical operator contains n atoms and each atom has arity k, then it corresponds to c nk actions where c = |{constant symbols}| take-crane1-loc1-c3-c1-p1 precond : belong-crane1-loc1, attached-p1-loc1, empty-crane1, top-c3-p1, on-c3-c1 delete : empty-crane1, in-c3-p1, top-c3-p1, on-c3-p1 add : holding-crane1-c3, top-c1-p1

20 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 20 l A state variable is like a field in a record structure { top(p1)=c3, cpos(c3)=c1, cpos(c1)=pallet, …} l Classical and state-variable representations take similar amounts of space u Each can be translated into the other in low-order polynomial time State-Variable Representation

21 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 21 Example: The Blocks World l Infinitely wide table, finite number of children’s blocks l Ignore where a block is located on the table l A block can sit on the table or on another block l Want to move blocks from one configuration to another u e.g., initial state goal l Can be expressed as a special case of DWR u But the usual formulation is simpler l I’ll give classical, set-theoretic, and state-variable formulations u For the case where there are five blocks c a b c ab e d

22 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 22 Classical Representation: Symbols l Constant symbols:  The blocks: a, b, c, d, e l Predicates: u ontable(x)- block x is on the table u on(x,y)- block x is on block y u clear(x)- block x has nothing on it u holding(x)- the robot hand is holding block x u handempty- the robot hand isn’t holding anything c ab e d

23 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 23 unstack(x,y) Precond: on(x,y), clear(x), handempty Effects: ~on(x,y), ~clear(x), ~handempty, holding(x), clear(y) stack(x,y) Precond: holding(x), clear(y) Effects: ~holding(x), ~clear(y), on(x,y), clear(x), handempty pickup(x) Precond: ontable(x), clear(x), handempty Effects: ~ontable(x), ~clear(x), ~handempty, holding(x) putdown(x) Precond: holding(x) Effects: ~holding(x), ontable(x), clear(x), handempty Classical Operators c ab c ab c ab c a b c ab

24 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 24 l For five blocks, there are 36 propositions l Here are 5 of them: ontable-a - block a is on the table on-c-a - block c is on block a clear-c - block c has nothing on it holding-d - the robot hand is holding block d handempty - the robot hand isn’t holding anything c ab d e Set-Theoretic Representation: Symbols

25 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 25 Set-Theoretic Actions Fifty different actions Here are four of them: unstack-c-a Pre:on-c,a, clear-c, handempty Del:on-c,a, clear-c, handempty Add:holding-c, clear-a stack-c-a Pre:holding-c, clear-a Del:holding-c, ~clear-a Add:on-c-a, clear-c, handempty pickup-c Pre:ontable-c, clear-c, handempty Del:ontable-c, clear-c, handempty Add:holding-c putdown-c Pre:holding-c Del:holding-c Add:ontable-c, clear-c, handempty c ab c ab c ab c a b c ab

26 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 26 l Constant symbols: a, b, c, d, e of type block 0, 1, table, nil of type other l State variables: pos(x) = yif block x is on block y pos(x) = table if block x is on the table pos(x) = nil if block x is being held clear(x) = 1 if block x has nothing on it clear(x) = 0 if block x is being held or has another block on it holding = x if the robot hand is holding block x holding = nil if the robot hand is holding nothing c ab e d State-Variable Representation: Symbols

27 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 27 State-Variable Operators unstack(x : block, y : block) Precond: pos(x)=y, clear(y)=0, clear(x)=1, holding=nil Effects: pos(x)=nil, clear(x)=0, holding=x, clear(y)=1 stack(x : block, y : block) Precond: holding=x, clear(x)=0, clear(y)=1 Effects: holding=nil, clear(y)=0, pos(x)=y, clear(x)=1 pickup(x : block) Precond: pos(x)=table, clear(x)=1, holding=nil Effects: pos(x)=nil, clear(x)=0, holding=x putdown(x : block) Precond: holding=x Effects: holding=nil, pos(x)=table, clear(x)=1 c ab c ab c ab c a b c ab

28 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 28 Expressive Power l Any problem that can be represented in one representation can also be represented in the other two l Can convert in linear time and space, except for the following: u Converting to set-theoretic from either of the others can incur exponential blowup Classical representation State-variable representation Set-theoretic representation trivial P(x 1,…,x n ) becomes f P (x 1,…,x n )=1 write all of the ground instances f(x 1,…,x n )=y becomes P f (x 1,…,x n,y)

29 Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License: http://creativecommons.org/licenses/by-nc-sa/2.0/ 29 Comparison l Classical representation u The most popular for classical planning, partly for historical reasons l Set-theoretic representation u Can take much more space than classical representation u Useful in algorithms that manipulate ground atoms directly »e.g., planning graphs (Chapter 6), satisfiability (Chapters 7) u Useful for certain kinds of theoretical studies l State-variable representation u Equivalent to classical representation u Less natural for logicians, more natural for engineers u Useful in non-classical planning problems as a way to handle numbers, functions, time


Download ppt "Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:"

Similar presentations


Ads by Google