Action Planning � The goal of action planning is to choose actions and ordering relations among these actions to (Where logic-based representation achieve specified goals of knowledge makes search problems � Search-based problem solving applied to 8-puzzle more interesting) was one example of planning, but our description of this problem used specific data structures and functions R&N: Chap. 11, Sect. 11.1–4 � Here, we will develop a non-specific, logic-based language to represent knowledge about actions, states, and goals, and we will study how search algorithms can exploit this representation 1 2 Knowledge Representation Tradeoff � Expressiveness vs. computational efficiency � STRIPS: a simple, still SHAKEY STRIPS Language the robot reasonably expressive planning language based through Examples on propositional logic 1) Examples of planning problems in STRIPS 2) Planning methods 3) Extensions of STRIPS � Like programming, knowledge representation is still an art 3 4 Vacuum-Robot Example State Representation R 1 R 2 R 1 R 2 In(Robot, R 1 ) ∧ Clean(R 1 ) � Two rooms: R 1 and R 2 � A vacuum robot � Dust Propositions Logical “and” that “hold” connective (i.e. are true) in the state 5 6 1
State Representation Goal Representation R 1 R 2 Example: Clean(R 1 ) ∧ Clean(R 2 ) � Conjunction of propositions � No negated proposition � No “or” connective In(Robot, R 1 ) ∧ Clean(R 1 ) � No variable A goal G is achieved in a state S if all � Conjunction of propositions the propositions in G (called sub-goals) � No negated proposition, such as ¬ Clean(R 2 ) � Closed-world assumption: Every proposition that is are also in S not listed in a state is false in that state � No “or” connective, such as In(Robot,R 1 ) ∨ In(Robot,R 2 ) � No variable, e.g., ∃ x Clean(x) 7 8 Action Representation Action Representation Right Right � Precondition = In(Robot, R 1 ) � Precondition = In(Robot, R 1 ) � Delete-list = In(Robot, R 1 ) � Delete-list = In(Robot, R 1 ) � Add-list = In(Robot, R 2 ) � Add-list = In(Robot, R 2 ) R 1 R 2 R 1 R 2 Sets of propositions Right Same form as a goal: conjunction of propositions In(Robot, R 1 ) ∧ Clean(R 1 ) In(Robot, R 2 ) ∧ Clean(R 1 ) 9 10 Action Representation Other Actions Right Left Left � Precondition = In(Robot, R 1 ) � P = In(Robot, R 2 ) � P = In(Robot, R 2 ) � Delete-list = In(Robot, R 1 ) � D = In(Robot, R 2 ) � D = In(Robot, R 2 ) � Add-list = In(Robot, R 2 ) � A = In(Robot, R 1 ) � A = In(Robot, R 1 ) � An action A is applicable to a state S if the Suck(R 1 ) Suck(R 2 ) propositions in its precondition are all in S � P = In(Robot, R 1 ) � P = In(Robot, R 2 ) � The application of A to S is a new state � D = ∅ [empty list] � D = ∅ [empty list] obtained by deleting the propositions in the delete list from S and adding those in the � A = Clean(R 1 ) � A = Clean(R 2 ) add list 11 12 2
Other Actions Action Schema It describes several actions, here: Suck(R 1 ) and Suck(R 2 ) Left Left � P = In(Robot, R 2 ) � P = In(Robot, R 2 ) Parameter that will get “instantiated” by � D = In(Robot, R 2 ) � D = In(Robot, R 2 ) matching the precondition against a state � A = In(Robot, R 1 ) � A = In(Robot, R 1 ) Suck(r) Suck(r) � P = In(Robot, r) � P = In(Robot, r) � D = ∅ [empty list] � D = ∅ � A = Clean(r) � A = Clean(r) 13 14 Action Schema Action Schema R 1 R 2 R 1 R 2 R 1 Left R 2 R 1 Left R 2 Suck(R 2 ) Suck(R 1 ) � P = In(Robot, R 2 ) � P = In(Robot, R 2 ) � D = In(Robot, R 2 ) � D = In(Robot, R 2 ) � A = In(Robot, R 1 ) � A = In(Robot, R 1 ) In(Robot, R 2 ) ∧ Clean(R 1 ) In(Robot, R 1 ) ∧ Clean(R 1 ) In(Robot, R 2 ) ∧ Clean(R 1 ) In(Robot, R 1 ) ∧ Clean(R 1 ) ∧ Clean(R 2 ) Suck(r) Suck(r) r � R 2 � P = In(Robot, r) r � R 1 � P = In(Robot, r) � D = ∅ � D = ∅ � A = Clean(r) � A = Clean(r) 15 16 Blocks-World Example State C C A B A B TABLE TABLE Block(A) ∧ Block(B) ∧ Block(C) ∧ � A robot hand can move blocks on a table � The hand cannot hold more than one block at a time On(A,TABLE) ∧ On(B,TABLE) ∧ On(C,A) � No two blocks can fit directly on the same block ∧ Clear(B) ∧ Clear(C) ∧ Handempty � The table is arbitrarily large 17 18 3
Goal Goal C C B B A A On(A,TABLE) ∧ On(B,A) ∧ On(C,B) ∧ Clear(C) On(A,TABLE) ∧ On(B,A) ∧ On(C,B) ∧ Clear(C) 19 20 Goal Action Unstack(x,y) P = Handempty ∧ Block(x) ∧ Block(y) ∧ Clear(x) ∧ On(x,y) D = Handempty, Clear(x), On(x,y) C A = Holding(x), Clear(y) C B A B A On(A,TABLE) ∧ On(C,B) 21 22 Action Action Unstack(x,y) Unstack(x,y) P = Handempty ∧ Block(x) ∧ Block(y) ∧ Clear(x) ∧ On(x,y) P = Handempty ∧ Block(x) ∧ Block(y) ∧ Clear(x) ∧ On(x,y) D = Handempty, Clear(x), On(x,y) D = Handempty, Clear(x), On(x,y) A = Holding(x), Clear(y) A = Holding(x), Clear(y) C Block(A) ∧ Block(B) ∧ Block(C) ∧ Block(A) ∧ Block(B) ∧ Block(C) ∧ On(A,TABLE) ∧ On(B,TABLE) ∧ On(C,A) On(A,TABLE) ∧ On(B,TABLE) ∧ On(C,A) C C ∧ Clear(B) ∧ Clear(C) ∧ Handempty ∧ Clear(B) ∧ Clear(C) ∧ Handempty A B A B ∧ Holding(C) ∧ Clear(A) Unstack(C,A) Unstack(C,A) P = Handempty ∧ Block(C) ∧ Block(A) ∧ Clear(C) ∧ On(C,A) P = Handempty ∧ Block(C) ∧ Block(A) ∧ Clear(C) ∧ On(C,A) D = Handempty, Clear(C), On(C,A) D = Handempty, Clear(C), On(C,A) A = Holding(C), Clear(A) A = Holding(C), Clear(A) 23 24 4
All Actions Action Unstack(x,y) Unstack(x,y) P = Handempty ∧ Block(x) ∧ Block(y) ∧ Clear(x) ∧ On(x,y) D = Handempty, Clear(x), On(x,y) P = Handempty ∧ Block(x) ∧ Block(y) ∧ Clear(x) ∧ On(x,y) A = Holding(x), Clear(y) D = Handempty, Clear(x), On(x,y) Stack(x,y) A = Holding(x), Clear(y) P = Holding(x) ∧ Block(x) ∧ Block(y) ∧ Clear(y) D = Clear(y), Holding(x) C Block(A) ∧ Block(B) ∧ Block(C) ∧ A = On(x,y), Clear(x), Handempty On(A,TABLE) ∧ On(B,TABLE) ∧ On(C,A) Pickup(x) ∧ Clear(B) ∧ Clear(C) ∧ Handempty P = Handempty ∧ Block(x) ∧ Clear(x) ∧ On(x,Table) A B ∧ Holding(C) ∧ Clear(A) D = Handempty, Clear(x), On(x,Table) A = Holding(x) Unstack(C,A) Putdown(x) P = Handempty ∧ Block(C) ∧ Block(A) ∧ Clear(C) ∧ On(C,A) P = Holding(x), ∧ Block(x) D = Handempty, Clear(C), On(C,A) D = Holding(x) A = Holding(C), Clear(A) A = On(x,Table), Clear(x), Handempty 25 26 All Actions Key-in-Box Example Unstack(x,y) P = Handempty ∧ Block(x) ∧ Block(y) ∧ Clear(x) ∧ On(x,y) D = Handempty, Clear(x), On(x,y) R 1 R 2 A = Holding(x), Clear(y) Stack(x,y) P = Holding(x) ∧ Block(x) ∧ Block(y) ∧ Clear(y) D = Clear(y), Holding(x), A = On(x,y), Clear(x), Handempty Pickup(x) P = Handempty ∧ Block(x) ∧ Clear(x) ∧ On(x,Table) D = Handempty, Clear(x), On(x,TABLE) A = Holding(x) � The robot must lock the door and put the key in the box A block can always fit Putdown(x) on the table � The key is needed to lock and unlock the door P = Holding(x), ∧ Block(x) � Once the key is in the box, the robot can’t get it back D = Holding(x) A = On(x,TABLE), Clear(x), Handempty 27 28 Initial State Goal R 1 R 1 R 2 R 2 In(Robot,R 2 ) ∧ In(Key,R 2 ) ∧ Unlocked(Door) Locked(Door) ∧ In(Key,Box) [The robot’s location isn’t specified in the goal] 29 30 5
Actions Grasp-Key-in-R 2 P = In(Robot,R 2 ) ∧ In(Key,R 2 ) R 1 R 2 D = ∅ A = Holding(Key) Planning Methods Lock-Door P = Holding(Key) D = ∅ A = Locked(Door) Move-Key-from-R 2 -into-R 1 P = In(Robot,R 2 ) ∧ Holding(Key) ∧ Unlocked(Door) D = In(Robot,R 2 ), In(Key,R 2 ) A = In(Robot,R 1 ), In(Key,R 1 ) Put-Key-Into-Box P = In(Robot,R 1 ) ∧ Holding(Key) D = Holding(Key), In(Key,R 1 ) A = In(Key,Box) 31 32 Forward Planning Forward Planning Goal: On(B,A) ∧ On(C,B) Suck(R 1 ) B R 1 R 2 R 1 R 2 C Pickup(B) B C C Right A A B A Unstack(C,A)) Left C C Initial state Suck(R 2 ) C B A B A B A R 1 R 2 Goal: Clean(R 1 ) ∧ Clean(R 2 ) B B A B C A C A C 33 34 Planning Graph for a State of the Need for an Accurate Heuristic Vacuum Robot S 0 A 0 S 1 A 1 S 2 � Forward planning simply searches the space of In(Robot,R 1 ) In(Robot,R 1 ) In(Robot,R 1 ) world states from the initial to the goal state Clean(R 1 ) Clean(R 1 ) Clean(R 1 ) In(Robot,R 2 ) In(Robot,R 2 ) � Imagine an agent with a large library of Clean(R 2 ) actions, whose goal is G, e.g., G = Have(Milk) R 1 R 2 persistence Right Left � In general, many actions are applicable to any actions Suck(R 1 ) Suck(R 2 ) given state, so the branching factor is huge � In any given state, most applicable actions are S 0 contains the state’s propositions (here, the initial state) � A 0 contains all actions whose preconditions appear in S 0 � irrelevant to reaching the goal Have(Milk) S 1 contains all propositions that were in S 0 or are contained in the � add lists of the actions in A 0 � Fortunately, an accurate consistent heuristic So, S 1 contains all propositions that may be true in the state � can be computed using planning graphs reached after the first action A 1 contains all actions not already in A 0 whose preconditions appear � in S 1 , hence that may be executable in the state reached after executing the first action. Etc... 35 36 6
Recommend
More recommend