Presentation is loading. Please wait.

Presentation is loading. Please wait.

In the name of God An Application of Planning An Application of PlanningJSHOP BY: M. Eftekhari and G. Yaghoobi.

Similar presentations


Presentation on theme: "In the name of God An Application of Planning An Application of PlanningJSHOP BY: M. Eftekhari and G. Yaghoobi."— Presentation transcript:

1 In the name of God An Application of Planning An Application of PlanningJSHOP BY: M. Eftekhari and G. Yaghoobi

2 SHOP (Simple Hierarchical Ordered Planner) SHOP and its successors are domain- independent implementations of Ordered Task Decomposition SHOP and its successors are domain- independent implementations of Ordered Task Decomposition An AI planning technique that has been useful in several application domains (University of Maryland) An AI planning technique that has been useful in several application domains (University of Maryland)

3 JSHOP A Java implementation of SHOP As part of their HICAP for Noncombatant Evacuation Operations (NEOs). As part of their HICAP for Noncombatant Evacuation Operations (NEOs).HICAP (HICAP) Hierarchical Interactive Case- based Architecture for Planning (An applet) (HICAP) Hierarchical Interactive Case- based Architecture for Planning (An applet)

4 HTN Hierarchical Task Network Objective is to create a plan to perform a set of tasks (abstract representations of things that need to be done). Objective is to create a plan to perform a set of tasks (abstract representations of things that need to be done). HTN planning is done by problem reduction: the planner recursively decomposes tasks into subtasks, stopping when it reaches primitive tasks that can be performed directly by planning operators HTN planning is done by problem reduction: the planner recursively decomposes tasks into subtasks, stopping when it reaches primitive tasks that can be performed directly by planning operators

5 Continue In order to tell the planner how to decompose nonprimitive tasks into subtasks. it needs to have a set of methods. In order to tell the planner how to decompose nonprimitive tasks into subtasks. it needs to have a set of methods. where each method is a schema for decomposing a particular kind of task into a set of subtasks (provided that some set of preconditions is satisfied). where each method is a schema for decomposing a particular kind of task into a set of subtasks (provided that some set of preconditions is satisfied).

6 Continue What is Expressivity? Expressivity of languages Expressivity of languages A language L is as expressive as another language M iff any expression in L can be translated into an expression with the same meaning in M A language L is as expressive as another language M iff any expression in L can be translated into an expression with the same meaning in M HTN planning is more expressive than state-based planning HTN planning is more expressive than state-based planning STRIPS-style planning is a special case of HTN planning STRIPS-style planning is a special case of HTN planning

7 Continue No transformations, because HTN models have richer structure ( because HTNs can represent harder problems than the STRIPS language) No transformations, because HTN models have richer structure ( because HTNs can represent harder problems than the STRIPS language) Solutions to STRIPS problems are regular sets Solutions to STRIPS problems are regular sets Solutions to HTN problems can be arbitrary context-free sets Solutions to HTN problems can be arbitrary context-free sets Thus HTNs are more expressive than STRIPS Thus HTNs are more expressive than STRIPS

8 Ordered Task Decomposition Is a special case of HTN planning in which the planning algorithm always builds plans forward from the initial state of the world Is a special case of HTN planning in which the planning algorithm always builds plans forward from the initial state of the world ordered-task-decomposition: planner plans for tasks in the same order that the tasks will later be performed. ordered-task-decomposition: planner plans for tasks in the same order that the tasks will later be performed. the planner has already planned every action that will occur beforehand the planner has already planned every action that will occur beforehand

9 continue the preconditions of its methods and operators can include logical inferences, complex numeric computations, and calls to external programs. the preconditions of its methods and operators can include logical inferences, complex numeric computations, and calls to external programs.

10 Search Strategy Ordered task decomposition Ordered task decomposition Require the subtasks of each method to be totally ordered Require the subtasks of each method to be totally ordered Decompose these tasks left-to-right Decompose these tasks left-to-right The same order that theyll later be executedThe same order that theyll later be executed Analogous to PROLOGs search strategyAnalogous to PROLOGs search strategy method subtask 3subtask 2subtask 1subtask 4 task

11 AI Planning Is Different in Practice Than it Was in Theory Unstack(x,y) Pre:on(x,y), clear(x), handempty Del:on(x,y), clear(x), handempty Add:holding(x), clear(y) Theory: Theory: Symbolic computations (STRIPS operators) Symbolic computations (STRIPS operators) Single agent (the planner) Single agent (the planner) Perfect information Perfect information Practice: Practice: Complex numeric computations (geometry, images, probabilities) Complex numeric computations (geometry, images, probabilities) Multiple agents Multiple agents Imperfect information, external information sources Imperfect information, external information sources

12 Goal Develop synergy between theory and applications Develop synergy between theory and applications Theory Applications

13 SHOP (Simple Hierarchical Ordered Planner) Domain-independent algorithm for Ordered Task Decomposition Domain-independent algorithm for Ordered Task Decomposition Implementation Implementation Common-Lisp implementation available at Common-Lisp implementation available at http://www.cs.umd.edu/projects/shophttp://www.cs.umd.edu/projects/shop Developing a Java implementation Developing a Java implementation

14 Input and Output Input: Input: State: a set of ground atoms State: a set of ground atoms Task List: a linear list of tasks Task List: a linear list of tasks Domain: methods, operators, axioms Domain: methods, operators, axioms Output: one or more plans Output: one or more plans depending on what we tell SHOP to look for, it can return depending on what we tell SHOP to look for, it can return the first plan it findsthe first plan it finds all possible plansall possible plans a least-cost plana least-cost plan all least-cost plansall least-cost plans etc.etc.

15 Elements of the Input Initial State: collection of ground atoms (in Lisp notation) Initial State: collection of ground atoms (in Lisp notation) ((at home) (have-cash 50.43) (distance home downtown 10)) ((at home) (have-cash 50.43) (distance home downtown 10)) Task list: linear list of tasks to perform Task list: linear list of tasks to perform ((travel home downtown) (buy book)) ((travel home downtown) (buy book)) Each method: task, preconditions and decomposition Each method: task, preconditions and decomposition Preconditions to be established using logical inferencePreconditions to be established using logical inference Decomposition is a task listDecomposition is a task list Each axiom: Horn clause Each axiom: Horn clause Each primitive operator: task,precondition, delete list, add list Each primitive operator: task,precondition, delete list, add list Performs a primitive task Performs a primitive task

16 Review of the SHOP Algorithm procedure SHOP (state S, task-list T, domain D) 1.if T = nil then return nil 2.t1 = the first task in T 3.U = the remaining tasks in T 4.if t is primitive & an operator instance o matches t1 then 5.P = SHOP (o(S), U, D) 6.if P = FAIL then return FAIL 7.return cons(o,P) 8.else if t is non-primitive & a method instance m matches t1 in S & ms preconditions can be inferred from S then 9.return SHOP (S, append (m(t1), U), D) 10.else 11.return FAIL 12. end if end SHOP state S; task list T=( t 1,t 2,…) operator instance o state o(S) ; task list T=(t 2, …) task list T=( t 1,t 2,…) method instance m task list T=( u 1,…,u k,t 2,…) nondeterministic choice among all methods m whose preconditions can be inferred from S

17 Initial task list:((travel home park)) Initial task list:((travel home park)) Initial state:((at home) (cash 20) (distance home park 8)) Initial state:((at home) (cash 20) (distance home park 8)) Methods (task, preconditions, subtasks): Methods (task, preconditions, subtasks): (:method (travel ?x ?y) ((at x) (walking-distance ?x ?y)) ((!walk ?x ?y)) 1) (:method (travel ?x ?y) ((at x) (walking-distance ?x ?y)) ((!walk ?x ?y)) 1) (:method (travel ?x ?y) ((at ?x) (have-taxi-fare ?x ?y)) ((!call-taxi ?x) (!ride ?x ?y) (!pay-driver ?x ?y)) 1) (:method (travel ?x ?y) ((at ?x) (have-taxi-fare ?x ?y)) ((!call-taxi ?x) (!ride ?x ?y) (!pay-driver ?x ?y)) 1) Axioms: Axioms: (:- (walking-dist ?x ?y) ((distance ?x ?y ?d) (call (<= ?d 5)))) (:- (walking-dist ?x ?y) ((distance ?x ?y ?d) (call (<= ?d 5)))) (:- (have-taxi-fare ?x ?y) ((have-cash ?c) (distance ?x ?y ?d) (call (>= ?c (+ 1.50 ?d)))) (:- (have-taxi-fare ?x ?y) ((have-cash ?c) (distance ?x ?y ?d) (call (>= ?c (+ 1.50 ?d)))) Primitive operators (task, precondition, delete list, add list) Primitive operators (task, precondition, delete list, add list) (:operator (!walk ?x ?y) () ((at ?x)) ((at ?y))) (:operator (!walk ?x ?y) () ((at ?x)) ((at ?y))) … Simple Example Optional cost; default is 1

18 Precond: (travel home park) (!walk home park) (!call-taxi home)(!ride home park) (!pay-driver home park) Fail (distance > 5) Succeed (we have $20, and the fare is only $9.50) Succeed (at home)(walking-distance Home park) (have-taxi-fare home park) (at park) (cash 10.50) (distance home park 8) Simple Example (continued) (at home) Initial state: Final state: (at home) (cash 20) (distance home park 8)

19 Block worlds 1 12 45 3 1 12 4 5 3 Initial state Final state Final State Using Methods Task1Task2Task3Task4Task5 Book keeping Planning Classical Planning Only achievin g goals How to do?

20 What Activities Should a Planning System Plan? In AI planning, researchers traditionally have only allowed the planner to plan activities that will have a direct physical effect In AI planning, researchers traditionally have only allowed the planner to plan activities that will have a direct physical effect Examples: Examples: picking up a block picking up a block moving a truck moving a truck In human planning, we also plan lots of other activities In human planning, we also plan lots of other activities Example 2: Example 2: Planning bookkeeping operations Planning bookkeeping operations ticket (a,b)travel (x,a)fly(a,b)travel(b,y)airport(y,b) store some info about the ticket travel by air airport(x,a)

21 Encoding the Blocks World Algorithm into SHOP loop if there is a clear block x such that x or a block beneath x is in a location inconsistent with the goal and x can be moved to a location such that x and all blocks beneath x will be in locations consistent with the goal then move x to that location else if there is a clear block x such that x or a block beneath x is in a location inconsistent with the goal then move x to the table else exit endif repeat

22 (:operator (!pickup ?x) (:operator (!pickup ?x) ((clear ?x) (on-table ?x)) ((clear ?x) (on-table ?x)) ((holding ?x))) ((holding ?x))) (:operator (!putdown ?x) (:operator (!putdown ?x) ((holding ?x)) ((holding ?x)) ((on-table ?x) (clear ?x))) ((on-table ?x) (clear ?x))) (:operator (!stack ?x ?y) (:operator (!stack ?x ?y) ((holding ?x) (clear ?y)) ((holding ?x) (clear ?y)) ((on ?x ?y) (clear ?x))) ((on ?x ?y) (clear ?x))) (:operator (!unstack ?x ?y) (:operator (!unstack ?x ?y) ((clear ?x) (on ?x ?y)) ((clear ?x) (on ?x ?y)) ((holding ?x) (clear ?y))) ((holding ?x) (clear ?y))) Operators for Moving Blocks

23 Bookkeeping Operator and Methods (:operator (!assert ?atoms); ?atoms is a list of atoms to assert (:operator (!assert ?atoms); ?atoms is a list of atoms to assert (); no preconditions (); no preconditions ?atoms; put the list of atoms into the current state ?atoms; put the list of atoms into the current state 0); this operator has no cost 0); this operator has no cost (:method (assert-goals (?first. ?rest) ?atoms) ; recursively build a list (:method (assert-goals (?first. ?rest) ?atoms) ; recursively build a list () ; of atoms to assert into () ; of atoms to assert into ((assert-goals ?rest ((goal ?first). ?atoms)))) ; the current state ((assert-goals ?rest ((goal ?first). ?atoms)))) ; the current state (:method (assert-goals nil ?atoms); weve built the entire list, so assert it (:method (assert-goals nil ?atoms); weve built the entire list, so assert it () () '((!assert ?atoms))) '((!assert ?atoms))) (:method (achieve-goals ?goals) ; assert all the goals into the current state, (:method (achieve-goals ?goals) ; assert all the goals into the current state, (); then call move-block to achieve them (); then call move-block to achieve them ((assert-goals ?goals nil) (move-block nil))) ((assert-goals ?goals nil) (move-block nil)))


Download ppt "In the name of God An Application of Planning An Application of PlanningJSHOP BY: M. Eftekhari and G. Yaghoobi."

Similar presentations


Ads by Google