Partial Order Plan Execution 1 Brian C. Williams 16.412J/6.834J Sept. 16 th, 2002 Slides with help from: Dan Weld Stuart Russell & Peter Norvig.

Post on 18-Jan-2016

216 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

Transcript

Partial Order Plan Execution

1

Brian C. Williams

16.412J/6.834J

Sept. 16th, 2002Slides with help from:Dan Weld Stuart Russell & Peter Norvig

Outline• Plan execution

• Plan monitoring

Start

Go(HWS)

Go(Home)

Finish

Buy(Drill)

Buy(Milk) Buy(Ban.)

Go(SM)

Have(Milk) At(Home) Have(Ban.) Have(Drill)

At(SM), Sells(SM,Milk)

At(SM)

At(SM), Sells(SM,Ban.)

At(Home)

At(HWS)

At(HWS) Sells(HWS,Drill)

At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.)

Execution

Can perform a stepwhen all predecessorshave been executed.

Start

Go(HWS)

Go(Home)

Finish

Buy(Drill)

Buy(Milk) Buy(Ban.)

Go(SM)

Have(Milk) At(Home) Have(Ban.) Have(Drill)

At(SM), Sells(SM,Milk)

At(SM)

At(SM), Sells(SM,Ban.)

At(Home)

At(HWS)

At(HWS) Sells(HWS,Drill)

At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.)

Execution

Can perform a stepwhen all predecessorshave been executed.

Start

Go(HWS)

Go(Home)

Finish

Buy(Drill)

Buy(Milk) Buy(Ban.)

Go(SM)

Have(Milk) At(Home) Have(Ban.) Have(Drill)

At(SM), Sells(SM,Milk)

At(SM)

At(SM), Sells(SM,Ban.)

At(Home)

At(HWS)

At(HWS) Sells(HWS,Drill)

At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.)Can perform a stepwhen all predecessorshave been executed.

Execution

Start

Go(HWS)

Go(Home)

Finish

Buy(Drill)

Buy(Milk) Buy(Ban.)

Go(SM)

Have(Milk) At(Home) Have(Ban.) Have(Drill)

At(SM), Sells(SM,Milk)

At(SM)

At(SM), Sells(SM,Ban.)

At(Home)

At(HWS)

At(HWS) Sells(HWS,Drill)

At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.)Can perform a stepwhen all predecessorshave been executed.

Execution

Start

Go(HWS)

Go(Home)

Finish

Buy(Drill)

Buy(Milk) Buy(Ban.)

Go(SM)

Have(Milk) At(Home) Have(Ban.) Have(Drill)

At(SM), Sells(SM,Milk)

At(SM)

At(SM), Sells(SM,Ban.)

At(Home)

At(HWS)

At(HWS) Sells(HWS,Drill)

At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.)Can perform a stepwhen all predecessorshave been executed.

Execution

Start

Go(HWS)

Go(Home)

Finish

Buy(Drill)

Buy(Milk) Buy(Ban.)

Go(SM)

Have(Milk) At(Home) Have(Ban.) Have(Drill)

At(SM), Sells(SM,Milk)

At(SM)

At(SM), Sells(SM,Ban.)

At(Home)

At(HWS)

At(HWS) Sells(HWS,Drill)

At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.)Can perform a stepwhen all predecessorshave been executed.

Execution

Start

Go(HWS)

Go(Home)

Finish

Buy(Drill)

Buy(Milk) Buy(Ban.)

Go(SM)

Have(Milk) At(Home) Have(Ban.) Have(Drill)

At(SM), Sells(SM,Milk)

At(SM)

At(SM), Sells(SM,Ban.)

At(Home)

At(HWS)

At(HWS) Sells(HWS,Drill)

At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.)Can perform a stepwhen all predecessorshave been executed.

Execution

Start

Go(HWS)

Go(Home)

Finish

Buy(Drill)

Buy(Milk) Buy(Ban.)

Go(SM)

Have(Milk) At(Home) Have(Ban.) Have(Drill)

At(SM), Sells(SM,Milk)

At(SM)

At(SM), Sells(SM,Ban.)

At(Home)

At(HWS)

At(HWS) Sells(HWS,Drill)

At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.)Can perform a stepwhen all predecessorshave been executed.

Execution

Plan Execution

Initialize the agenda, called Ready, with action StartMark all actions as not executed.

Loop • If Ready is empty then terminate.• Dequeue action a from Ready and execute• When completed, mark a as executed.• For each action b such that a < b or linked(a,b,p).

– If every action c is marked executed, such that c < b or linked(c,b,p’)

– Then queue b on Ready.

Outline• Partial order planning in a nutshell

• Plan execution

• Plan monitoring

Start

Go(HWS)

Go(Home)

Finish

Buy(Drill)

Buy(Milk) Buy(Ban.)

Go(SM)

Have(Milk) At(Home) Have(Ban.) Have(Drill)

At(SM), Sells(SM,Milk)

At(SM)

At(SM), Sells(SM,Ban.)

At(Home)

At(HWS)

At(HWS) Sells(HWS,Drill)

At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.)

Fail if preconditions of ready action are not satisfied.

Action Monitoring

Start

Go(HWS)

Go(Home)

Finish

Buy(Drill)

Buy(Milk) Buy(Ban.)

Go(SM)

Have(Milk) At(Home) Have(Ban.) Have(Drill)

At(SM), Sells(SM,Milk)

At(SM)

At(SM), Sells(SM,Ban.)

At(Home)

At(HWS)

At(HWS) Sells(HWS,Drill)

At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.)

Action Monitoring

Fail if preconditions of ready action are not satisfied.

Plan Execution with Action Monitoring

Initialize the agenda, called Ready, with action StartMark all actions as not executed.Loop• If Ready is empty then terminate.• Dequeue action a from ready • If preconditions of action are satisfied

– Then execute– Else return failure

• When completed, mark a as executed.• For each action b such that a < b or linked(a,b,p).

– If every action c has been executed, such that c < b or linked(c,b,p’)

– Then queue b on Ready.

Start

Go(HWS)

Go(Home)

Finish

Buy(Drill)

Buy(Milk) Buy(Ban.)

Go(SM)

Have(Milk) At(Home) Have(Ban.) Have(Drill)

At(SM), Sells(SM,Milk)

At(SM)

At(SM), Sells(SM,Ban.)

At(Home)

At(HWS)

At(HWS) Sells(HWS,Drill)

At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.)

ExecutionMonitoring• Check if precondition of remaining plan is violated.

•Check if causal link crossing current time is violated.

Start

Go(HWS)

Go(Home)

Finish

Buy(Drill)

Buy(Milk) Buy(Ban.)

Go(SM)

Have(Milk) At(Home) Have(Ban.) Have(Drill)

At(SM), Sells(SM,Milk)

At(SM)

At(SM), Sells(SM,Ban.)

At(Home)

At(HWS)

At(HWS) Sells(HWS,Drill)

At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.)

ExecutionMonitoring• Check if precondition of remaining plan is violated.

•Check if causal link crossing current time is violated.

Plan Execution with Execution Monitoring

Initialize agenda Ready with action StartInitialize agenda ActiveLinks to emptyMark all actions as not executed.Loop• If Ready is empty then terminate.• For each link on ActiveLinks

– If the condition of link doesn’t hold, Then return failure

• Dequeue action a from Ready • If preconditions of action are satisfied

– Then execute– Else return failure

• …

Plan Execution with Execution Monitoring (cont).

Loop• …• Mark a as executed. • For each action c such that linked(c,a,p).

– dequeue <c,a,p> from ActiveLinks.

• For each action d such that linked(a,d,p).– queue <a,d,p> on ActiveLinks.

• For each action b such that a < b or linked(a,b,p).– If every action c has been executed,

such that c <b or linked(c,b,p’)– Then queue b on Ready.

Outline• Plan execution

• Plan monitoring

Monitors

Autonomous Agents: What is missing?

Command dispatchFault protectionAttitude control

Mission Goal Scenario

Self-commandingSelf-commandingSelf-diagnosingSelf-diagnosingSelf-repairingSelf-repairing

RECOVERY

PLA

NN

ING

EX

EC

UTIO

N

Outline• Plan execution

• Plan monitoring

• Appendix: Partial order planning in a nutshell

Simple Operator-based Planning• Input

– Initial state of world– Goal

• partial state

– Operators (actions)• Fn: world-stateworld-state

• Output– Sequence of actions

What assumptions areimplied?

• Atomic time.

• Agent is omniscient (no sensing necessary).

• Agent is sole cause of change.

• Actions have deterministic effects.

• No indirect effects.

STRIPS Assumptions

a

aa

north11 north12

W0 W2W1

STRIPS Representation

• Effects specify how to change the set of propositions.

a anorth11

W0 W1

• Initial state:• ((block a) (block

b) (block c) (on-table a) (on-table b) (clear a) (clear b) (clear c)

(arm-empty))

• goal (partial state):• ((on a b)

(on b c)))

• Available actions• Strips operators

precond: (and (agent-at 1 1)(agent-facing north))

effect: (and (agent-at 1 2) (not (agent-at 1 1)))

North11

Action Schemata

(:operator pick-up :parameters ((block ?ob1)) :precondition (and (clear ?ob1)

(on-table ?ob1) (arm-empty))

:effect (and (not (clear ?ob1)) (not (on-table ?ob1))

(not (arm-empty)) (holding ?ob1)))

• Instead of defining: pickup-A and pickup-B and …

• Define a schema:Note: strips doesn’t

allow derived effects;

you must be complete!}

?var denotes a free variable

A Solution: Complete and Consistent Plan

• Complete Plan

• Consistent Plan

IFF every precondition of every step is achieved

A step’s precondition is achieved iff • its the effect of a preceding step,• no possibly intervening step undoes it.

IFF there is no contradiction in the ordering constraints(I.e., never si < sj and sj < si.)

Start

Go(HWS)

Go(Home)

Finish

Buy(Drill)

Buy(Milk) Buy(Ban.)

Go(SM)

Have(Milk) At(Home) Have(Ban.) Have(Drill)

At(SM), Sells(SM,Milk)

At(SM)

At(SM), Sells(SM,Ban.)

At(Home)

At(HWS)

At(HWS) Sells(HWS,Drill)

At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.)

POP(<A,O,L>, agenda, actions)

• <A,O,L>, A partial plan to expand

• Agenda: A queue of open conditions still to be satisfied: <p, aneed >

• Actions: A set of actions that may be introduced to meet needs.

• aadd: an action that produces the needed condition p for aneed

• Athreat : an action that might threaten a causal link from aproducer to aconsumer

POP(<A,O,L>, agenda, actions)1. Termination: If agenda is empty, return plan <A,O,L>.

2. Goal Selection: select and remove open condition <p, aneed > from agenda.

3. Action Selection: Choose new or existing action aadd that can precede aneed and whose effects include p. Link and order actions.

4. Update Agenda: If aadd is new, add preconditions to agenda.

5. Threat Detection: For every action athreat that might threaten some causal link from aproduce to aconsume, choose a consistent ordering:

a) Demotion: Add athreat < aproduce

b) Promotion: Add aconsume < athreat

6. Recurse: on modified plan and agendaChoose is nondeterministic Select is deterministic

Start

Go(HWS)

Finish

Buy(Drill) Buy(Milk) Buy(Ban.)

Go(SM)

Have(Drill) Have(Milk) Have(Ban.) at(Home)

At(SM), Sells(SM,Milk) At(SM), Sells(SM,Ban.)

At(Home)

At(HWS) Sells(HWS,Drill)

At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.)

At(x)

Go(Home)At(SM)

top related