Scheduling And Htn

705 views

Published on

Scheduling And Htn

Published in: Education, Technology, Real Estate
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
705
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Scheduling And Htn

  1. 1. Practical Planning: Scheduling and Hierarchical Task Networks Chapter 12.1-12.2 CMSC 471 Adapted from slides by Tim Finin and Marie desJardins.
  2. 2. Outline <ul><li>Intelligent scheduling </li></ul><ul><li>Hierarchical task network (HTN) planning </li></ul><ul><li>Increasing expressivity </li></ul>
  3. 3. Real-world planning domains <ul><li>Real-world domains are complex and don’t satisfy the assumptions of STRIPS or partial-order planning methods </li></ul><ul><li>Some of the characteristics we may need to deal with: </li></ul><ul><ul><li>Modeling and reasoning about resources </li></ul></ul><ul><ul><li>Representing and reasoning about time </li></ul></ul><ul><ul><li>Planning at different levels of abstractions </li></ul></ul><ul><ul><li>Conditional outcomes of actions </li></ul></ul><ul><ul><li>Uncertain outcomes of actions </li></ul></ul><ul><ul><li>Exogenous events </li></ul></ul><ul><ul><li>Incremental plan development </li></ul></ul><ul><ul><li>Dynamic real-time replanning </li></ul></ul>} a.k.a. scheduling!
  4. 4. Planning vs. scheduling <ul><li>Planning : given one or more goals, generate a sequence of actions to achieve the goal(s) </li></ul><ul><li>Scheduling : given a set of actions and constraints, allocate resources and assign times to the actions so that no constraints are violated </li></ul><ul><li>Traditionally, planning is done with specialized logical reasoning methods </li></ul><ul><li>Traditionally, scheduling is done with constraint satisfaction, linear programming, or OR methods </li></ul><ul><li>However, planning and scheduling are closely interrelated and can’t always be separated </li></ul>
  5. 5. Hierarchical decomposition <ul><li>Hierarchical decomposition, or hierarchical task network ( HTN ) planning, uses abstract operators to incrementally decompose a planning problem from a high-level goal statement to a primitive plan network </li></ul><ul><li>Primitive operators represent actions that are executable , and can appear in the final plan </li></ul><ul><li>Non-primitive operators represent goals (equivalently, abstract actions ) that require further decomposition (or operationalization ) to be executed </li></ul><ul><li>There is no “right” set of primitive actions: One agent’s goals are another agent’s actions! </li></ul>
  6. 6. HTN operator: Example <ul><li>OPERATOR decompose </li></ul><ul><li>PURPOSE: Construction </li></ul><ul><li>CONSTRAINTS: </li></ul><ul><li>Length (Frame) <= Length (Foundation), </li></ul><ul><li>Strength (Foundation) > Wt(Frame) + Wt(Roof) </li></ul><ul><li>+ Wt(Walls) + Wt(Interior) + Wt(Contents) </li></ul><ul><li>PLOT: Build (Foundation) </li></ul><ul><li>Build (Frame) </li></ul><ul><li>PARALLEL </li></ul><ul><li>Build (Roof) </li></ul><ul><li>Build (Walls) </li></ul><ul><li>END PARALLEL </li></ul><ul><li>Build (Interior) </li></ul>
  7. 7. HTN planning: example
  8. 8. SIPE-2 <ul><li>SIPE-2 is an HTN planner with many advanced features: </li></ul><ul><ul><li>Plan critics </li></ul></ul><ul><ul><li>Resource reasoning </li></ul></ul><ul><ul><li>Constraint reasoning (complex numerical or symbolic variable and state constraints) </li></ul></ul><ul><ul><li>Interleaved planning and execution </li></ul></ul><ul><ul><li>Interactive plan development </li></ul></ul><ul><ul><li>Sophisticated truth criterion </li></ul></ul><ul><ul><li>Conditional effects </li></ul></ul><ul><ul><li>Parallel interactions in partially ordered plans </li></ul></ul><ul><ul><li>Replanning if failures occur during execution </li></ul></ul>
  9. 9. SIPE-2 Image from: http://www.ai.sri.com/~sipe/architecture.html
  10. 10. Blocksworld in SIPE-2 <ul><li>;;some colored blocks for other problems </li></ul><ul><li>(ON R1 B1) </li></ul><ul><li>(ON B1 TABLE) </li></ul><ul><li>(ON B2 TABLE) </li></ul><ul><li>(ON R2 TABLE) </li></ul><ul><li>;true in all problems </li></ul><ul><li>(CLEAR TABLE) </li></ul><ul><li>END PREDICATES </li></ul><ul><li>STOP </li></ul><ul><li>OPERATOR: PUTON1 </li></ul><ul><li>ARGUMENTS: BLOCK1, OBJECT1 IS NOT BLOCK1; </li></ul><ul><li>PURPOSE: (ON BLOCK1 OBJECT1) </li></ul><ul><li>PLOT: </li></ul><ul><li>PARALLEL </li></ul><ul><li>BRANCH 1: </li></ul><ul><li>GOALS: (CLEAR OBJECT1) </li></ul><ul><li>BRANCH 2: </li></ul><ul><li>GOALS: (CLEAR BLOCK1) </li></ul><ul><li>END PARALLEL </li></ul><ul><li>PROCESS </li></ul><ul><li>ACTION: PUTON; </li></ul><ul><li>ARGUMENTS: BLOCK1,OBJECT1 </li></ul><ul><li>RESOURCES: BLOCK1 </li></ul><ul><li>EFFECTS: (ON BLOCK1 OBJECT1) </li></ul><ul><li>END PLOT </li></ul><ul><li>END OPERATOR </li></ul>Excerpt taken from http://www.ai.sri.com/~sipe/blocks-sipe.txt Image taken from http://www.ai.sri.com/~sipe/sussman-derivation.html Sussman Anomaly Excerpt from SIPE-2 Blocksworld Definition
  11. 11. HTN operator representation <ul><li>Russell & Norvig explicitly represent causal links; these can also be computed dynamically by using a model of preconditions and effects (this is what SIPE-2 does) </li></ul><ul><li>Dynamically computing causal links means that actions from one operator can safely be interleaved with other operators, and subactions can safely be removed or replaced during plan repair </li></ul><ul><li>Russell & Norvig’s representation only includes variable bindings, but more generally we can introduce a wide array of variable constraints </li></ul>
  12. 12. Truth criterion <ul><li>Determining whether a formula is true at a particular point in a partially ordered plan is, in the general case, NP-hard </li></ul><ul><li>Intuition: there are exponentially many ways to linearize a partially ordered plan </li></ul><ul><li>In the worst case, if there are N actions unordered with respect to each other, there are N! linearizations </li></ul><ul><li>Ensuring soundness of the truth criterion requires checking the formula under all possible linearizations </li></ul><ul><li>Use heuristic methods instead to make planning feasible </li></ul><ul><li>Check later to be sure no constraints have been violated </li></ul>
  13. 13. Truth criterion in SIPE-2 <ul><li>Heuristic: prove that there is one possible ordering of the actions that makes the formula true – but don’t insert ordering links to enforce that order </li></ul><ul><li>Such a proof is efficient </li></ul><ul><ul><li>Suppose you have an action A1 with a precondition P </li></ul></ul><ul><ul><li>Find an action A2 that achieves P (A2 could be initial world state) </li></ul></ul><ul><ul><li>Make sure there is no action necessarily between A2 and A1 that negates P </li></ul></ul><ul><li>Applying this heuristic for all preconditions in the plan can result in infeasible plans </li></ul>
  14. 14. Increasing expressivity <ul><li>Conditional effects </li></ul><ul><ul><li>Instead of having different operators for different conditions, use a single operator with conditional effects </li></ul></ul><ul><ul><li>Move (block1, from, to) and MoveToTable (block1, from) collapse into one Move (block1, from, to): </li></ul></ul><ul><ul><ul><li>Op(ACTION: Move(block1, from, to), PRECOND: On (block1, from) ^ Clear (block1) ^ Clear (to) EFFECT: On (block1, to) ^ Clear (from) ^ ~On(block1, from) ^ ~Clear(to) when to ≠ Table </li></ul></ul></ul><ul><ul><ul><li>There’s a problem with this operator: can you spot what it is? </li></ul></ul></ul><ul><li>Negated and disjunctive goals </li></ul><ul><li>Universally quantified preconditions and effects </li></ul>
  15. 15. Reasoning about resources <ul><li>Introduce numeric variables that can be used as measures </li></ul><ul><li>These variables represent resource quantities, and change over the course of the plan </li></ul><ul><li>Certain actions may produce (increase the quantity of) resources </li></ul><ul><li>Other actions may consume (decrease the quantity of) resources </li></ul><ul><li>More generally, may want different types of resources </li></ul><ul><ul><li>Continuous vs. discrete </li></ul></ul><ul><ul><li>Sharable vs. nonsharable </li></ul></ul><ul><ul><li>Reusable vs. consumable vs. self-replenishing </li></ul></ul>
  16. 16. Other real-world planning issues <ul><li>Conditional planning </li></ul><ul><li>Partial observability </li></ul><ul><li>Information gathering actions </li></ul><ul><li>Execution monitoring and replanning </li></ul><ul><li>Continuous planning </li></ul><ul><li>Multi-agent (cooperative or adversarial) planning </li></ul>
  17. 17. SATPlan
  18. 18. SATPlan <ul><li>Formulate the planning problem as a CSP </li></ul><ul><li>Assume that the plan has k actions </li></ul><ul><li>Create a binary variable for each possible action a: </li></ul><ul><ul><li>Action(a,i) (TRUE if action a is used at step i) </li></ul></ul><ul><li>Create variables for each proposition that can hold at different points in time: </li></ul><ul><ul><li>Proposition(p,i) (TRUE if proposition p holds at step i) </li></ul></ul>
  19. 19. Constraints <ul><li>Only one action can be executed at each time step (XOR constraints) </li></ul><ul><li>Constraints describing effects of actions </li></ul><ul><li>Persistence: if an action does not change a proposition p, then p’s value remains unchanged </li></ul><ul><li>A proposition is true at step i only if some action (possibly a maintain action) made it true </li></ul><ul><li>Constraints for initial state and goal state </li></ul>
  20. 20. Now apply our favorite CSP solver!
  21. 21. Planning summary <ul><li>Planning representations </li></ul><ul><ul><li>Situation calculus </li></ul></ul><ul><ul><li>STRIPS representation: Preconditions and effects </li></ul></ul><ul><li>Planning approaches </li></ul><ul><ul><li>State-space search (STRIPS, forward chaining, ….) </li></ul></ul><ul><ul><li>Plan-space search (partial-order planning, HTN, …) </li></ul></ul><ul><ul><li>Constraint-based search (GraphPlan, SATplan, …) </li></ul></ul><ul><li>Search strategies </li></ul><ul><ul><li>Forward planning </li></ul></ul><ul><ul><li>Goal regression </li></ul></ul><ul><ul><li>Backward planning </li></ul></ul><ul><ul><li>Least-commitment </li></ul></ul><ul><ul><li>Nonlinear planning </li></ul></ul>
  22. 22. Applications of Planning <ul><li>Military operations </li></ul><ul><li>Autonomous space operations </li></ul><ul><li>Construction tasks </li></ul><ul><li>Machining tasks </li></ul><ul><li>Mechanical assembly </li></ul><ul><li>Design of experiments in genetics </li></ul><ul><li>Command sequences for satellite </li></ul>Most applied systems use extended representation languages, nonlinear planning techniques, and domain-specific heuristics
  23. 23. Oil-Spill Response in SIPE-2 Image taken from http://www.ai.sri.com/~sipe/oil.html

×