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

Post on 22-Dec-2015

221 views 3 download

Tags:

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

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

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.

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.

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.

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

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)

STRIPS Goals

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

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 )

Constants and Predicates

Operators (Actions)

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.

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.

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

Example UCPOP Domain

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

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

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

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 )

Method Structure

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

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)

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.

Sample SHOP2 Domains

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

Warcraft 2 Project