29
Partial Order Plan Execution 1 Brian C. Williams 16.412J/6.834J Sept. 16 th , 2002 lides with help from: an Weld tuart Russell & eter Norvig

Partial Order Plan Execution

  • Upload
    haamid

  • View
    58

  • Download
    0

Embed Size (px)

DESCRIPTION

Partial Order Plan Execution. Brian C. Williams 16.412J/6.834J Sept. 16 th , 2002. Slides with help from: Dan Weld Stuart Russell & Peter Norvig. 1. Outline. Plan execution Plan monitoring. Start. At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.). At(Home). Go(HWS). - PowerPoint PPT Presentation

Citation preview

Page 1: Partial Order Plan Execution

Partial Order Plan Execution

1

Brian C. Williams

16.412J/6.834J

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

Page 2: Partial Order Plan Execution

Outline• Plan execution

• Plan monitoring

Page 3: Partial Order Plan 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.)

Execution

Can perform a stepwhen all predecessorshave been executed.

Page 4: Partial Order Plan 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.)

Execution

Can perform a stepwhen all predecessorshave been executed.

Page 5: Partial Order Plan 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

Page 6: Partial Order Plan 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

Page 7: Partial Order Plan 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

Page 8: Partial Order Plan 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

Page 9: Partial Order Plan 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

Page 10: Partial Order Plan 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

Page 11: Partial Order Plan 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.

Page 12: Partial Order Plan Execution

Outline• Partial order planning in a nutshell

• Plan execution

• Plan monitoring

Page 13: Partial Order Plan 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.)

Fail if preconditions of ready action are not satisfied.

Action Monitoring

Page 14: Partial Order Plan 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.)

Action Monitoring

Fail if preconditions of ready action are not satisfied.

Page 15: Partial Order Plan Execution

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.

Page 16: Partial Order Plan 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.)

ExecutionMonitoring• Check if precondition of remaining plan is violated.

•Check if causal link crossing current time is violated.

Page 17: Partial Order Plan 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.)

ExecutionMonitoring• Check if precondition of remaining plan is violated.

•Check if causal link crossing current time is violated.

Page 18: Partial Order Plan Execution

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

• …

Page 19: Partial Order Plan Execution

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.

Page 20: Partial Order Plan Execution

Outline• Plan execution

• Plan monitoring

Page 21: Partial Order Plan Execution

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

Page 22: Partial Order Plan Execution

Outline• Plan execution

• Plan monitoring

• Appendix: Partial order planning in a nutshell

Page 23: Partial Order Plan Execution

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

Page 24: Partial Order Plan Execution

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

Page 25: Partial Order Plan Execution

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

Page 26: Partial Order Plan Execution

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.)

Page 27: Partial Order Plan Execution

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

Page 28: Partial Order Plan Execution

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

Page 29: Partial Order Plan Execution

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)