Transcript

Representing ActionsPlanning

Chapter 8:

Planning

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 1

Representing ActionsPlanning

Learning Objectives

At the end of the class you should be able to:

state the assumptions of deterministic planning

represent a problem using both STRIPs and thefeature-based representation of actions.

specify the search tree for a forward planner

specify the search tree for a regression planner

represent a planning problem as a CSP

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 2

Representing ActionsPlanning

Planning

Planning is deciding what to do based on an agent’sability, its goals, and the state of the world.

Initial assumptions:I The world is deterministic.I There are no exogenous events outside of the control of

the robot that change the state of the world.I The agent knows what state it is in.I Time progresses discretely from one state to the next.I Goals are predicates of states that need to be achieved

or maintained.

Aim find a sequence of actions to solve a goal.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 3

Representing ActionsPlanning

Classical Planning

flat or modular or hierarchical

explicit states or features or individuals and relations

static or finite stage or indefinite stage or infinite stage

fully observable or partially observable

deterministic or stochastic dynamics

goals or complex preferences

single agent or multiple agents

knowledge is given or knowledge is learned

perfect rationality or bounded rationality

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 4

Representing ActionsPlanning

State-space RepresentationFeature-based RepresentationSTRIPS Representation

Outline

Representing ActionsState-space RepresentationFeature-based RepresentationSTRIPS Representation

PlanningForward PlanningRegression PlanningPlanning as a CSP

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 5

Representing ActionsPlanning

State-space RepresentationFeature-based RepresentationSTRIPS Representation

Actions

A deterministic action is a partial function from states tostates.

The preconditions of an action specify when the actioncan be carried out.

The effect of an action specifies the resulting state.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 6

Representing ActionsPlanning

State-space RepresentationFeature-based RepresentationSTRIPS Representation

Delivery Robot Example

Coffee Shop

Mail Room Lab

Sam'sOffice

Features:RLoc – Rob’s locationRHC – Rob has coffeeSWC – Sam wants coffeeMW – Mail is waitingRHM – Rob has mail

Actions:mc – move clockwisemcc – move counterclockwisepuc – pickup coffeedc – deliver coffeepum – pickup maildm – deliver mail

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 7

Representing ActionsPlanning

State-space RepresentationFeature-based RepresentationSTRIPS Representation

Explicit State-space Representation

State Action Resulting State⟨lab, rhc , swc ,mw , rhm

⟩mc

⟨mr , rhc , swc ,mw , rhm

⟩⟨lab, rhc , swc ,mw , rhm

⟩mcc

⟨off , rhc , swc ,mw , rhm

⟩⟨off , rhc , swc ,mw , rhm

⟩dm

⟨off , rhc , swc ,mw , rhm

⟩⟨off , rhc , swc ,mw , rhm

⟩mcc

⟨cs, rhc , swc ,mw , rhm

⟩⟨off , rhc , swc ,mw , rhm

⟩mc

⟨lab, rhc , swc ,mw , rhm

⟩. . . . . . . . .

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 8

Representing ActionsPlanning

State-space RepresentationFeature-based RepresentationSTRIPS Representation

Feature-based representation of actions

For each action:

precondition is a proposition that specifies when theaction can be carried out.

For each feature:

causal rules that specify when the feature gets a newvalue and

frame rules that specify when the feature keeps its value.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 9

Representing ActionsPlanning

State-space RepresentationFeature-based RepresentationSTRIPS Representation

Example feature-based representation

Precondition of pick-up coffee (puc):

RLoc=cs ∧ rhc

Rules for location is cs:

RLoc ′=cs ← RLoc=off ∧ Act=mcc

RLoc ′=cs ← RLoc=mr ∧ Act=mc

RLoc ′=cs ← RLoc=cs ∧ Act 6= mcc ∧ Act 6= mc

Rules for “robot has coffee”

rhc ′ ← rhc ∧ Act 6= dc

rhc ′ ← Act=puc

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 10

Representing ActionsPlanning

State-space RepresentationFeature-based RepresentationSTRIPS Representation

STRIPS Representation

Divide the features into:

primitive features

derived features. There are rules specifying how derivedcan be derived from primitive features.

For each action:

precondition that specifies when the action can becarried out.

effect a set of assignments of values to primitive featuresthat are made true by this action.

STRIPS assumption: every primitive feature not mentioned inthe effects is unaffected by the action.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 11

Representing ActionsPlanning

State-space RepresentationFeature-based RepresentationSTRIPS Representation

Example STRIPS representation

Pick-up coffee (puc):

precondition: [cs, rhc]

effect: [rhc]

Deliver coffee (dc):

precondition: [off , rhc]

effect: [rhc , swc]

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 12

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Outline

Representing ActionsState-space RepresentationFeature-based RepresentationSTRIPS Representation

PlanningForward PlanningRegression PlanningPlanning as a CSP

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 13

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Planning

Given:

A description of the effects and preconditions of theactions

A description of the initial state

A goal to achieve

find a sequence of actions that is possible and will result in astate satisfying the goal.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 14

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Forward Planning

Idea: search in the state-space graph.

The nodes represent the states

The arcs correspond to the actions: The arcs from a states represent all of the actions that are legal in state s.

A plan is a path from the state representing the initialstate to a state that satisfies the goal.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 15

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Example state-space graph

mac

Actionsmc: move clockwisemac: move anticlockwisenm: no movepuc: pick up coffeedc: deliver coffeepum: pick up maildm: deliver mail

mc

mac

mac

mac

mac

mc

mcmc

puc

〈cs,rhc,swc,mw,rhm〉

〈cs,rhc,swc,mw,rhm〉 〈off,rhc,swc,mw,rhm〉 〈mr,rhc,swc,mw,rhm〉

〈off,rhc,swc,mw,rhm〉

〈mr,rhc,swc,mw,rhm〉

〈lab,rhc,swc,mw,rhm〉〈cs,rhc,swc,mw,rhm〉

dc

〈off,rhc,swc,mw,rhm〉

〈lab,rhc,swc,mw,rhm〉

〈mr,rhc,swc,mw,rhm〉

Locations:cs: coffee shopoff: officelab: laboratorymr: mail room

Feature valuesrhc: robot has coffeeswc: Sam wants coffeemw: mail waitingrhm: robot has mail

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 16

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

What are the errors?

puc

Actionsmc: move clockwisemac: move anticlockwisenm: no movepuc: pick up coffeedc: deliver coffeepum: pick up maildm: deliver mail

mc

mc

mac

puc

puc

mc

mcmac

pum

〈mr,rhc,swc,mw,rhm〉

〈mr,rhc,swc,mw,rhm〉 〈cs,rhc,swc,mw,rhm〉 〈mr,rhc,swc,mw,rhm〉

〈lab,rhc,swc,mw,rhm〉

〈cs,rhc,swc,mw,rhm〉

〈off,rhc,swc,mw,rhm〉〈cs,rhc,swc,mw,rhm〉

〈mr,rhc,swc,mw,rhm〉

〈off,rhc,swc,mw,rhm〉

Locations:cs: coffee shopoff: officelab: laboratorymr: mail room

Feature valuesrhc: robot has coffeeswc: Sam wants coffeemw: mail waitingrhm: robot has mail

〈cs,rhc,swc,mw,rhm〉 11

10

9

8

7

6

5

432

1

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 17

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Forward planning representation

The search graph can be constructed on demand: youonly construct reachable states.

If you want a cycle check or multiple path-pruning, youneed to be able to find repeated states.

There are a number of ways to represent states:I As a specification of the value of every featureI As a path from the start state

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 18

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Improving Search Efficiency

Forward search can use domain-specific knowledge specifiedas:

a heuristic function that estimates the number of steps tothe goal

domain-specific pruning of neighbors:I don’t go to the coffee shop unless “Sam wants coffee” is

part of the goal and Rob doesn’t have coffeeI don’t pick-up coffee unless Sam wants coffeeI unless the goal involves time constraints, don’t do the

“no move” action.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 19

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Regression/Backward Planning

Idea: search backwards from the goal description: nodescorrespond to subgoals, and arcs to actions.

Nodes are propositions: a formula made up ofassignments of values to features

Arcs correspond to actions that can achieve one of thegoals

Neighbors of a node N associated with arc A specify whatmust be true immediately before A so that N is trueimmediately after.

The start node is the goal to be achieved.

goal(N) is true if N is a proposition that is true of theinitial state.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 20

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Defining nodes and arcs

A node N can be represented as a set of assignments ofvalues to variables:

[X1 = v1, . . . ,Xn = vn]

This is a set of assignments you want to hold.

The last action is one that achieves one of the Xi = vi ,and does not achieve Xj = v ′

j where v ′j is different to vj .

The neighbor of N along arc A must contain:I The prerequisites of action AI All of the elements of N that were not achieved by A

N must be consistent.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 21

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Regression example

mac

dc

mc

macmc macmcpuc

[swc]

[off,rhc]

[cs,rhc] [lab,rhc]

[mr,rhc] [off,rhc]

[off,rhc]

[mr,rhc]

[cs]

Actionsmc: move clockwisemac: move anticlockwisepuc: pick up coffeedc: deliver coffeepum: pick up maildm: deliver mail

Locations:cs: coffee shopoff: officelab: laboratorymr: mail room

Feature valuesrhc: robot has coffeeswc: Sam wants coffeemw: mail waitingrhm: robot has mail

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 22

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Find the errors

mc puc

pucpum

dm

dc

mc

[swc,rhc,mw]

[off,rhc,mw]

[cs,rhc, mw] [off,rhc, rhm,mw]

Actionsmc: move clockwisemac: move anticlockwisepuc: pick up coffeedc: deliver coffeepum: pick up maildm: deliver mail

Locations:cs: coffee shopoff: officelab: laboratorymr: mail room

Feature valuesrhc: robot has coffeeswc: Sam wants coffeemw: mail waitingrhm: robot has mail

[swc,rhc,off] [swc,cs,mw]

[swc,cs,mw][swc,rhc,cs]

② ③④

⑤ ⑥

⑦ ⑧

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 23

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Formalizing arcs using STRIPS notation

〈G ,A,N〉

where G is [X1 = v1, . . . ,Xn = vn] is an arc if

∃i Xi = vi is on the effects list of action A

∀j Xj = v ′j is not on the effects list for A, where v ′

j 6= vj

N is preconditions(A)∪ {Xk = vk : Xk = vk /∈ effects(A)}and N is consistent in that it does not assign differentvalues to any variable.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 24

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Loop detection and multiple-path pruning

Goal G1 is simpler than goal G2 if G1 is a subset of G2.I It is easier to solve [cs] than [cs, rhc].

If on a path to node N a more specific goal has beenfound, the path to N can be pruned.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 25

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Improving Efficiency

You can define a heuristic function that estimates howdifficult it is to solve the goal from the initial state.

You can use domain-specific knowledge to removeimpossible goals.

I It is often not obvious from an action description toconclude that an agent can only hold one item at anytime.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 26

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Comparing forward and regression planners

Which is more efficient depends on:I The branching factorI How good the heuristics are

Forward planning is unconstrained by the goal (except asa source of heuristics).

Regression planning is unconstrained by the initial state(except as a source of heuristics)

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 27

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Planning as a CSP

Search over planning horizons.

For each planning horizon, create a CSP constrainingpossible actions and features

Also factor actions into action features.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 28

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Action Features

PUC : Boolean variable, the agent picks up coffee.

DelC : Boolean variable, the agent delivers coffee.

PUM : Boolean variable, the agent picks up mail.

DelM : Boolean variable, the agent delivers mail.

Move: variable with domain {mc ,mac , nm} specifieswhether the agent moves clockwise, anti-clockwise ordoesn’t move

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 29

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

CSP Variables

Choose a planning horizon k .

Create a variable for each state feature and each timefrom 0 to k .

Create a variable for each action feature for each time inthe range 0 to k − 1.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 30

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Constraints

state constraints that are constraints between variables atthe same time step.precondition constraints between state variables at time tand action variables at time t that specify constraints onwhat actions are available from a state.effect constraints between state variables at time t, actionvariables at time t and state variables at time t + 1.action constraints that specify which actions cannotco-occur. These are sometimes called mutual exclusion ormutex constraints.initial state constraints that are usually domainconstraints on the initial state (at time 0).goal constraints that constrains the final state to be astate that satisfies the goals that are to be achieved.

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 31

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

CSP for Delivery Robot

RLoc0

RHC0

SWC0

MW0

RHM0

Move0

PUC0

DelC0

PUM0

DelM0

RLoc1

RHC1

SWC1

MW1

RHM1

Move1

PUC1

DelC1

PUM1

DelM1

RLoc2

RHC2

SWC2

MW2

RHM2

State0 Action0 State1 Action1 State2

RLoci — Rob’s locationRHCi — Rob has coffeeSWCi — Sam wants coffeeMWi — Mail is waitingRHMi — Rob has mail

Movei — Rob’s move actionPUCi — Rob picks up coffeeDelC — Rob delivers coffeePUMi — Rob picks up mailDelMi — Rob delivers mail

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 32

Representing ActionsPlanning

Forward PlanningRegression PlanningPlanning as a CSP

Effect Constraint

RHCi DCi PUCi RHCi+1

true true true truetrue true false falsetrue false true truetrue false false truefalse true true truefalse true false falsefalse false true truefalse false false false

c©D. Poole, A. Mackworth 2010, W. Menzel 2013 Artificial Intelligence, Lecture 8.1, Page 33


Recommended