Hierarchical Task Network (HTN) Planning Hai Hoang 4/17/2007.

Slides:



Advertisements
Similar presentations
Practical Planning: Scheduling and Hierarchical Task Networks Chapter CS 63 Adapted from slides by Tim Finin and Marie desJardins.
Advertisements

1 Hierarchical Task Network (HTN) Planning José Luis Ambite* [* Based in part on presentations by Dana Nau and Rao Kambhampati]
REVIEW : Planning To make your thinking more concrete, use a real problem to ground your discussion. –Develop a plan for a person who is getting out of.
In the name of God An Application of Planning An Application of PlanningJSHOP BY: M. Eftekhari and G. Yaghoobi.
CSE391 – 2005 NLP 1 Planning The Planning problem Planning with State-space search.
1 Planning Chapter CMSC 471 Adapted from slides by Tim Finin and Marie desJardins. Some material adopted from notes by Andreas Geyer-Schulz,
Hierarchical Task Networks Planning to perform tasks rather than to achieve goals.
Complexity Classes: P and NP
Planning II: Partial Order Planning
Planning Module THREE: Planning, Production Systems,Expert Systems, Uncertainty Dr M M Awais.
Planning Module THREE: Planning, Production Systems,Expert Systems, Uncertainty Dr M M Awais.
SHOP2: An HTN Planning System Nau, D.S., Au, T.C., Ilghami, O., Kuter, U., Murdock, J.W., Wu, D. and Yaman, F. (2003) "SHOP2: An HTN Planning System",
CLASSICAL PLANNING What is planning ?  Planning is an AI approach to control  It is deliberation about actions  Key ideas  We have a model of the.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
1 Graphplan José Luis Ambite * [* based in part on slides by Jim Blythe and Dan Weld]
Classical Planning via Plan-space search COMP3431 Malcolm Ryan.
Time Constraints in Planning Sudhan Kanitkar
Plan Generation & Causal-Link Planning 1 José Luis Ambite.
Planning CSE 473 Chapters 10.3 and 11. © D. Weld, D. Fox 2 Planning Given a logical description of the initial situation, a logical description of the.
Computing & Information Sciences Kansas State University Lecture 24 of 42 CIS 530 / 730 Artificial Intelligence Lecture 24 of 42 Planning: Monitoring &
Planning Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 11.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
1 Planning. R. Dearden 2007/8 Exam Format  4 questions You must do all questions There is choice within some of the questions  Learning Outcomes: 1.Explain.
Planning II CSE 473. © Daniel S. Weld 2 Logistics Tournament! PS3 – later today Non programming exercises Programming component: (mini project) SPAM detection.
Planning Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 11.
Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.
1 Planning Chapters 11 and 12 Thanks: Professor Dan Weld, University of Washington.
Planning II CSE 573. © Daniel S. Weld 2 Logistics Reading for Wed Ch 18 thru 18.3 Office Hours No Office Hour Today.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
Classical Planning Chapter 10.
(Classical) AI Planning. Some Examples Route search: Find a route between Lehigh University and the Naval Research Laboratory Project management: Construct.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
Homework 1 ( Written Portion )  Max : 75  Min : 38  Avg : 57.6  Median : 58 (77%)
State-Space Search and the STRIPS Planner Searching for a Path through a Graph of Nodes Representing World States.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Planning, page 1 CSI 4106, Winter 2005 Planning Points Elements of a planning problem Planning as resolution Conditional plans Actions as preconditions.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
Automated Planning Dr. Héctor Muñoz-Avila. What is Planning? Classical Definition Domain Independent: symbolic descriptions of the problems and the domain.
AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)
Automating DAML-S Web Services Composition Using SHOP2 Based on an article by Dan Wu, Bijan Parsia, Evren Sirin, James Hendler and Dana Nau in Proceedings.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.
Specializing Project 06/07 HTN Presentation for MS1 By Glenn Wissing.
(Classical) AI Planning. General-Purpose Planning: State & Goals Initial state: (on A Table) (on C A) (on B Table) (clear B) (clear C) Goals: (on C Table)
Finite State Machines (FSM) OR Finite State Automation (FSA) - are models of the behaviors of a system or a complex object, with a limited number of defined.
Hierarchical Task Network Planning Automated Planning: Theory and Practice, Chapter 11 소프트컴퓨팅 연구실
1 CMSC 471 Fall 2004 Class #21 – Thursday, November 11.
1 CMSC 471 Fall 2002 Class #24 – Wednesday, November 20.
Write a function rule for a graph EXAMPLE 3 Write a rule for the function represented by the graph. Identify the domain and the range of the function.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
1 Chapter 11 Hierarchical Task Network Planning. 2 Motivation We may already have an idea how to go about solving problems in a planning domain Example:
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
Automated Planning & Computer Games: Perspectives and Applications
SNS College of Engineering Department of Computer Science and Engineering AI Planning Presented By S.Yamuna AP/CSE 5/23/2018 AI.
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Richard Anderson Lecture 26 NP-Completeness
Planning: Forward Planning and CSP Planning
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Planning CSE 573 A handful of GENERAL SEARCH TECHNIQUES lie at the heart of practically all work in AI We will encounter the SAME PRINCIPLES again and.
Class #20 – Wednesday, November 5
NP-Complete Problems.
Introduction to Data Structures
Hierarchical Task Networks
Class #17 – Tuesday, October 30
Presentation transcript:

Hierarchical Task Network (HTN) Planning Hai Hoang 4/17/2007

Reminder JSHOP and JSHOP2 come with some sample domain files. You CANNOT use those files. Need to write your own.

HTN vs Classical Like classical planning: –Each state of the world is represented by a set of atoms –Each action corresponds to a deterministic state transition – (block b1) (block b2) (block b3) (block b4) (on-table b1) (on b2 b1) (clear b2) (on-table b3) (on b4 b3) (clear b4)

HTN vs Classical Differs: –Objective: to perform a set of tasks not a set of goals –Terms, literals, operators, actions, plans have same meaning as classical planning. –Added tasks, methods, task networks –Tasks decompose into subtasks Constraints Backtrack if necessary

Decomposition Non-primitive task precond method instance s0s0 precondeffectsprecondeffects s1s1 s2s2 primitive task operator instance Non-primitive task Shows the order plan will be executed later

Tasks vs Control Rules We saw control rules – actions NOT to consider HTN – actions and tasks to consider

Control Rules Classical planning efficiency suffers from combinatorial complexity (intractable) Prune function detects and cuts unpromising nodes –Can improve solving: exponential to polynomial Φ 1 (c,d,p) = [GOAL(in(c,p))   q GOAL(in(c,q))]  [GOAL(on(c,d)   e GOAL(on(c,e))] –No goal requiring c in another pile or on top of something else (prune if exist?) –Holds if acceptable when container c is on item d in pile p By: Steve Lee-Urban

HTN Instead of detecting and cutting unpromising nodes HTN methods are only applied only when the preconditions are satisfied. (:method (pick-up ?x) ((clear ?x)) ((!pick-up ?x)) ) Only pick up if x is on top

Domain Domain dependent – Bridge Baron game Domain independent – SHOP D1D2D3 P1P2P3 D1D2D3 P Domain Planner Planning procedures

HTN Domain consists of –methods and operators (SHOP- axioms) Problem consists of –domain, initial state, initial task network (tasks to accomplish, with some ordering of the tasks defined) Solution –A plan: Totally ordered collection of primitive tasks (SHOP) –General HTN planner - partially ordered collection of primitive tasks.

TASK Task: an expression of the form t(u 1,…,u n ) –t is a task symbol, and each u i is a term (variable, constant, function expression (f t 1 t 2 t n ) –(move-block ?nomove) –(move-block (list ?x. ?nomove)) Two types of task 1.Non-primitive (compound) – decomposed into subtasks. 2.Primitive – cannot be decomposed, know how to perform directly (task name is the operator name). (!drive-truck ?truck ?loc-from ?loc-to)

Methods and Operators Defined a little differently in the textbook, but we’re more concerned with coding it in SHOP so forget the book for now (book notations later on). Explain both with an example instead of notations. –Spent a good amount of time arranging the next slide –Help to visualize how they map to a real shop method or operator. method as defined by SHOP (see manual) (:method h [n 1 ] C 1 T 1 [n 2 ] C 2 T 2 … [n k ] C k T k )  h method head – task atom with no call terms  [n 1 ] OPTIONAL name for succeeding C i T i pair  C 1 conjunct or tagged conjunct? Precondition list??  T1 task list Operator (:operator h P D A)  h head – primitive task atom with no call terms  P precondition list (logical atoms)  D delete list (logical atoms)  A add list (logical atoms)

Operators and Methods Method ( decomposes into subtasks) (:method (drive-truck ?truck ?loc-from ?loc-to) ((same ?loc-from ?loc-to)) ((!do-nothing)) () ((!drive-truck ?truck ?loc-from ?loc-to))) –Notice the if else structure –Invoke non-primitive task: (drive-truck ?t ?x ?y) Operator (achieves PRIMITIVE TASKS) (:operator (!drive-truck ?truck ?locfrom ?locto) () ((truck-at ?truck ?locfrom)) ((truck-at ?truck ?locto))) Invoke primitive task: (!drive-truck ?t ?l1 ?l2) Non prim preconditions Subtasks list prim task preconditionsdelete listAdd list Primitive task

Review Relationship between non-primitive tasks and methods –Decomposed by applying a method Relationship between primitive tasks and operators –Primitive task is achieved by applying an operator Important that you understand this!!!

STN and HTN STN – Simple Task Network (simplified version of HTN) 1.TFD – Total-order Forward Decomposition (used in SHOP) 1.Example later Input: tasks are totally ordered Output: totally ordered plan 2.PFD – Partial-order Forward Decomposition (SHOP2) 1.Example later Input: tasks are partially ordered Output: totally ordered plan HTN – generalization of STN 1.More freedom about how to construct the task networks. 2.Can use other decomposition procedures not just forward- decomposition. 3.Like Partial-order planning combined with STN Input: partial-order tasks Output: The resulting plan is partially ordered

Task Network STN w = (U, E) - an acyclic graph U – set of task nodes E – set of edges HTN w = (U, C) U – set of task nodes C – set of constraints (allow for generic task networks). Different planning procedures.

STN STN method: 4-tuple m = (name(m), task(m), precond(m), subtasks(m)) –name(m): an expression of the form n(x 1,…,x n ) n – name of the method – method symbol x 1,…,x n are parameters - variable symbols –task(m): a nonprimitive task task that this method could apply to In SHOP, the task is the head of the method. –precond(m): preconditions (literals) –subtasks(m): a sequence of tasks  t 1, …, t k  do-nothing(p,q) task: move-stack(p,q) precond: top(pallet,p) subtasks: ()

Pseudo-code for TFD Applying an operator Changing the state Decompose method into tasks Randomly pick an applicable method

DWR Move the containers, preserving ordering Use loc1 as example.

Total Order Tasks (SHOP- STD)

Example TFD Goal: move-each-twice Move-stack(p1a, p1b) Move-stack(p1b, p1c) Stack 2 and 3 empty.

Partially Ordered tasks (SHOP2 - PFD)

PFD Example

TFD & PFD STN doesn’t allow parallel execution, but can interleave steps (PFD) At the end the resulting plan is totally ordered (both TFD & PFD)

SHOP & SHOP2 SHOP: Simple Hierarchical Ordered Planner SHOP is basically TFD STN SHOP2 is PFD STN – mainly with the addition of the unordered keyword for the task list. Note: resulting plan is still a totally-ordered task list.

Prefix Notation Domain and problem file are in Lisp like format (+ 7 3) p(a,?x) -> (p a ?x) Any volunteer? p(f (a,b), ?y) Answer: (p (f a b) ?y) (call + 3 7)

Axioms (Horn clauses) (:- a C 1 C 2 C 3 … C n ) –a is true if C 1 is true, else if C 1 is false and C 2 is true, or else if C 1 to C n-1 is false and C n is true. (:- (same ?x ?x) nil) (same 5 5) (same 5 7)

Above Example (:- (above ?a ?b) ((on ?a ?b))) (:- (above ?a ?b) ((on ?a ?c) (above ?c ?b))) S0 = (on 1 2) (on 2 3) (on 3 4) Is (above 1 4) true?  (on 1 2) (above 2 4)  (on 1 2) (on 2 3) (above 3 4)  (on 1 2) (on 2 3) (on 3 4)  When all conjuncts are true, (above 1 4) is true.

JSHOP Domain file: operators, methods, axioms Problem file: initial state, initial task list (goals) On Vega in /home/hah3/jshop To run one of the sample problem java umd.cs.shop.JSJshop logistic/logistic.shp logistic/Log_ran_problems_10.shp 1 all > output.txt java –jar shop.jar logistic/logistic.shp logistic/Log_ran_problems_10.shp 1 all > output.txt java umd.cs.shop.JSJshop domainfile problemfile logLevel numofplan

For reference: JSHOP manual in the jshop directory -ijcai99.pdfhttp:// -ijcai99.pdf Contact me