Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning...

24
Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Classical Planning – The STRIPS Language Language HTN – Hierarchical Task HTN – Hierarchical Task Networks & SHOP2 Networks & SHOP2

Transcript of Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning...

Page 1: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Automated Planning and HTNs

Planning – A brief introPlanning – A brief intro

Classical Planning – The STRIPS LanguageClassical Planning – The STRIPS Language

HTN – Hierarchical Task Networks & SHOP2HTN – Hierarchical Task Networks & SHOP2

Page 2: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

What is planning?

Planning is the process of generating a Planning is the process of generating a sequence of actions that will achieve a goal.sequence of actions that will achieve a goal.

Automated planning is a branch of Automated planning is a branch of computer science that deals with producing computer science that deals with producing plans to achieve a goal.plans to achieve a goal.

Page 3: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Features of a planning system

A representation of the state of the world.A representation of the state of the world. A representation of the goals to be achieved.A representation of the goals to be achieved. Actions that change the state of the world.Actions that change the state of the world.

Page 4: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

The Blocks World Example

The world (problem domain) is a table covered The world (problem domain) is a table covered by children’s blocks.by children’s blocks.

Blocks can sit on the table on on each other.Blocks can sit on the table on on each other. We want to move blocks from one We want to move blocks from one

configuration to another.configuration to another.

Page 5: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

The STRIPS Planning Language

STanford Research Institute Problem SolverSTanford Research Institute Problem Solver Based on First Order Predicate Calculus.Based on First Order Predicate Calculus. Developed in 1971Developed in 1971

Page 6: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

STRIPS State Representation

Conjunctions of state symbols.Conjunctions of state symbols. But not disjunctions or negative assertionsBut not disjunctions or negative assertions

InHouse & HasDinnerInHouse & HasDinner Conjunctions of grounded operators.Conjunctions of grounded operators.

At(Mark, House) & Using(Jane, Computer)At(Mark, House) & Using(Jane, Computer)

Page 7: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

STRIPS Goals

A partially specified stateA partially specified state At(Joe, Museum) & Has(Joe, Camera)At(Joe, Museum) & Has(Joe, Camera)

Page 8: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

STRIPS Actions

Operators are actions that transform world stateOperators are actions that transform world state Parameters – Walk( person, place1, place2 )Parameters – Walk( person, place1, place2 ) Precondition – Conjunctions describing partial Precondition – Conjunctions describing partial

states.states.At( person, place1 ) & Door( place1, open )At( person, place1 ) & Door( place1, open )

Effects – Conjunctions and negations to add Effects – Conjunctions and negations to add and delete state members.and delete state members.

~At( person, place1 ) & At( person, place2 )~At( person, place1 ) & At( person, place2 )

Page 9: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Constants and Predicates

Page 10: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Operators (Actions)

Page 11: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

The Algorithm

Planning is a search procedure.Planning is a search procedure. A graph of a search space is constructed.A graph of a search space is constructed. State-Space PlanningState-Space Planning

Each node represents a state of the world.Each node represents a state of the world. A plan is a path through this space.A plan is a path through this space.

Plan-Space PlanningPlan-Space Planning Each node is a set of partially instantiated Each node is a set of partially instantiated

operators, and a set of constraints.operators, and a set of constraints. Constraints are added until we get a plan.Constraints are added until we get a plan.

Page 12: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Search Types

Forward Search (SHOP2)Forward Search (SHOP2) Start at initial state and apply operators.Start at initial state and apply operators. Construct graph of state space.Construct graph of state space. Search from initial state to goal.Search from initial state to goal. Can have a very large branching factor.Can have a very large branching factor.

Page 13: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Search Types

Backward Search (STRIPS)Backward Search (STRIPS) State-Space searchState-Space search Starts at goal.Starts at goal. Searches backwards to initial state.Searches backwards to initial state. Efficient but less expressiveEfficient but less expressive

Page 14: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Example UCPOP Domain

Page 15: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Hierarchical Task Networks

HTNs can be used to form complex plans.HTNs can be used to form complex plans. Two types of Operators (Methods).Two types of Operators (Methods). Methods form a hierarchy of tasks.Methods form a hierarchy of tasks.

Complex – Composed of subtasksComplex – Composed of subtasks Simple – Executes directlySimple – Executes directly

Page 16: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Method Structure

Complex MethodComplex Method Name( parameter list )Name( parameter list ) Precondition set 1Precondition set 1 Task list 1Task list 1

…… Precondition set nPrecondition set n Task list nTask list n

Page 17: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Sample Task Hierarchy

Method Travel( location1, location2 )Method Travel( location1, location2 ) Precondition 1: ShortDistance( loc1, loc2 )Precondition 1: ShortDistance( loc1, loc2 ) Tasks 1: Tasks 1:

get_taxiget_taxi Ride( loc1, loc2 )Ride( loc1, loc2 ) Pay_driverPay_driver

Page 18: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Method Travel()…

Method Travel( location1, location2 )Method Travel( location1, location2 ) Precondition 2: LongDistance( loc1, loc2 )Precondition 2: LongDistance( loc1, loc2 ) Tasks 2:Tasks 2:

get_airplane_ticket( loc1, loc2 )get_airplane_ticket( loc1, loc2 ) Travel( loc1, loc1(airport) )Travel( loc1, loc1(airport) ) Fly( loc1(airport), loc2(airport) )Fly( loc1(airport), loc2(airport) ) Travel( loc2(airport), loc2 )Travel( loc2(airport), loc2 )

Page 19: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Method Structure

Simple MethodSimple Method Name( parameter list )Name( parameter list ) Precondition setPrecondition set Delete listDelete list Add ListAdd List

Page 20: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Method ride()

Ride( loc1, loc2 )Ride( loc1, loc2 ) Preconditions: ShortDistance( loc1, loc2 )Preconditions: ShortDistance( loc1, loc2 ) Delete: (at Joe loc1)Delete: (at Joe loc1) Add: (at Joe loc2)Add: (at Joe loc2)

Page 21: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

The SHOP2 Planner

Created at University of Maryland in 2002Created at University of Maryland in 2002 Language for developing HTNsLanguage for developing HTNs Input: Planning domain and problem set.Input: Planning domain and problem set. Output: Java program to implement Output: Java program to implement

planner.planner.

Page 22: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Sample SHOP2 Domains

Page 23: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Planning in Games / Simulation Most systems use FSM.Most systems use FSM. Planning offers more behaviors, flexibility.Planning offers more behaviors, flexibility.

Page 24: Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.

Warcraft 2 Project