Partial Order Plan Execution Slides with help from

  • Slides: 29
Download presentation
Partial Order Plan Execution Slides with help from: Dan Weld Stuart Russell & Peter

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

Outline • Plan execution • Plan monitoring

Outline • Plan execution • Plan monitoring

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS,

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) At(Home) Go(HWS) At(HWS) Sells(HWS, Drill) Buy(Drill) At(HWS) Go(SM) At(SM), Sells(SM, Milk) At(SM), Sells(SM, Ban. ) Buy(Milk) Buy(Ban. ) At(SM) Go(Home) Have(Milk) At(Home) Have(Ban. ) Have(Drill) Finish

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS,

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) At(Home) Go(HWS) At(HWS) Sells(HWS, Drill) Buy(Drill) At(HWS) Go(SM) At(SM), Sells(SM, Milk) At(SM), Sells(SM, Ban. ) Buy(Milk) Buy(Ban. ) At(SM) Go(Home) Have(Milk) At(Home) Have(Ban. ) Have(Drill) Finish

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS,

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) At(Home) Go(HWS) At(HWS) Sells(HWS, Drill) Buy(Drill) At(HWS) Go(SM) At(SM), Sells(SM, Milk) At(SM), Sells(SM, Ban. ) Buy(Milk) Buy(Ban. ) At(SM) Go(Home) Have(Milk) At(Home) Have(Ban. ) Have(Drill) Finish

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS,

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) At(Home) Go(HWS) At(HWS) Sells(HWS, Drill) Buy(Drill) At(HWS) Go(SM) At(SM), Sells(SM, Milk) At(SM), Sells(SM, Ban. ) Buy(Milk) Buy(Ban. ) At(SM) Go(Home) Have(Milk) At(Home) Have(Ban. ) Have(Drill) Finish

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS,

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) At(Home) Go(HWS) At(HWS) Sells(HWS, Drill) Buy(Drill) At(HWS) Go(SM) At(SM), Sells(SM, Milk) At(SM), Sells(SM, Ban. ) Buy(Milk) Buy(Ban. ) At(SM) Go(Home) Have(Milk) At(Home) Have(Ban. ) Have(Drill) Finish

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS,

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) At(Home) Go(HWS) At(HWS) Sells(HWS, Drill) Buy(Drill) At(HWS) Go(SM) At(SM), Sells(SM, Milk) At(SM), Sells(SM, Ban. ) Buy(Milk) Buy(Ban. ) At(SM) Go(Home) Have(Milk) At(Home) Have(Ban. ) Have(Drill) Finish

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS,

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) At(Home) Go(HWS) At(HWS) Sells(HWS, Drill) Buy(Drill) At(HWS) Go(SM) At(SM), Sells(SM, Milk) At(SM), Sells(SM, Ban. ) Buy(Milk) Buy(Ban. ) At(SM) Go(Home) Have(Milk) At(Home) Have(Ban. ) Have(Drill) Finish

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS,

Execution Start Can perform a step when all predecessors have been executed. At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) At(Home) Go(HWS) At(HWS) Sells(HWS, Drill) Buy(Drill) At(HWS) Go(SM) At(SM), Sells(SM, Milk) At(SM), Sells(SM, Ban. ) Buy(Milk) Buy(Ban. ) At(SM) Go(Home) Have(Milk) At(Home) Have(Ban. ) Have(Drill) Finish

Plan Execution Initialize the agenda, called Ready, with action Start Mark all actions as

Plan Execution Initialize the agenda, called Ready, with action Start Mark 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

Outline • Partial order planning in a nutshell • Plan execution • Plan monitoring

Action Monitoring Start At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) At(Home) Fail if

Action Monitoring Start At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) At(Home) Fail if preconditions Go(HWS) of ready action are not satisfied. At(HWS) Sells(HWS, Drill) Buy(Drill) At(HWS) Go(SM) At(SM), Sells(SM, Milk) At(SM), Sells(SM, Ban. ) Buy(Milk) Buy(Ban. ) At(SM) Go(Home) Have(Milk) At(Home) Have(Ban. ) Have(Drill) Finish

Action Monitoring Start At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) At(Home) Fail if

Action Monitoring Start At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) At(Home) Fail if preconditions Go(HWS) of ready action are not satisfied. At(HWS) Sells(HWS, Drill) Buy(Drill) At(HWS) Go(SM) At(SM), Sells(SM, Milk) At(SM), Sells(SM, Ban. ) Buy(Milk) Buy(Ban. ) At(SM) Go(Home) Have(Milk) At(Home) Have(Ban. ) Have(Drill) Finish

Plan Execution with Action Monitoring Initialize the agenda, called Ready, with action Start Mark

Plan Execution with Action Monitoring Initialize the agenda, called Ready, with action Start Mark 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.

Execution Monitoring Start At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) • Check if

Execution Monitoring Start At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) • Check if precondition of remaining plan is violated. At(Home) Go(HWS) At(HWS) Sells(HWS, Drill) • Check if causal link crossing current time is violated. Buy(Drill) At(HWS) Go(SM) At(SM), Sells(SM, Milk) At(SM), Sells(SM, Ban. ) Buy(Milk) Buy(Ban. ) At(SM) Go(Home) Have(Milk) At(Home) Have(Ban. ) Have(Drill) Finish

Execution Monitoring Start At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) • Check if

Execution Monitoring Start At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) • Check if precondition of remaining plan is violated. • Check if causal link crossing current time is violated. At(Home) Go(HWS) At(HWS) Sells(HWS, Drill) Buy(Drill) At(HWS) Go(SM) At(SM), Sells(SM, Milk) At(SM), Sells(SM, Ban. ) Buy(Milk) Buy(Ban. ) At(SM) Go(Home) Have(Milk) At(Home) Have(Ban. ) Have(Drill) Finish

Plan Execution with Execution Monitoring Initialize agenda Ready with action Start Initialize agenda Active.

Plan Execution with Execution Monitoring Initialize agenda Ready with action Start Initialize agenda Active. Links to empty Mark all actions as not executed. Loop • If Ready is empty then terminate. • For each link on Active. Links – 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.

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 Active. Links. • For each action d such that linked(a, d, p). – queue <a, d, p> on Active. Links. • 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

Outline • Plan execution • Plan monitoring

N IO PL UT AN NI EC EX Self-commanding Self-diagnosing Self-repairing NG Autonomous Agents:

N IO PL UT AN NI EC EX Self-commanding Self-diagnosing Self-repairing NG Autonomous Agents: What is missing? RECOVERY Monitors Command dispatch Fault protection Attitude control Mission Goal Scenario

Outline • Plan execution • Plan monitoring • Appendix: Partial order planning in a

Outline • Plan execution • Plan monitoring • Appendix: Partial order planning in a nutshell

Simple Operator-based Planning What assumptions are implied? • Input – Initial state of world

Simple Operator-based Planning What assumptions are implied? • Input – Initial state of world – Goal • Atomic time. • partial state – Operators (actions) • Fn: world-state • Output • Agent is sole cause of change. – Sequence of actions north 11 a W 0 a W 1 north 12 • Agent is omniscient (no sensing necessary). a W 2 • Actions have deterministic effects. • No indirect effects. ] STRIPS Assumptions

STRIPS Representation • Initial state: • ((block a) (block b) (block c) (on-table a)

STRIPS Representation • 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 a W 0 north 11 a W 1 precond: (and (agent-at 1 1) (agent-facing north)) North 11 effect: (and (agent-at 1 2) (not (agent-at 1 1))) • Effects specify how to change the set of propositions.

Action Schemata • Instead of defining: pickup-A and pickup-B and … • Define a

Action Schemata • Instead of defining: pickup-A and pickup-B and … • Define a schema: ? var denotes a free variable (: operator pick-up : parameters ((block ? ob 1)) : precondition (and (clear ? ob 1) (on-table ? ob 1) (arm-empty)) : effect (and (not (clear ? ob 1)) (not (on-table ? ob 1)) (not (arm-empty)) (holding ? ob 1))) } No all te: yo ow stri u m de ps us rive doe t b d sn e c eff ’t om ect pl s; ete !

A Solution: Complete and Consistent Plan • Complete Plan IFF every precondition of every

A Solution: Complete and Consistent Plan • Complete Plan IFF every precondition of every step is achieved Start At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) At(Home) Go(HWS) At(HWS) Sells(HWS, Drill) A step’s precondition is achieved iff • its the effect of a preceding step, • no possibly intervening step At(SM), Sells(SM, Milk) undoes it. Buy(Drill) At(HWS) Go(SM) At(SM), Sells(SM, Ban. ) Buy(Milk) • Consistent Plan IFF there is no contradiction in the ordering constraints (I. e. , never si < sj and sj < si. ) Buy(Ban. ) At(SM) Go(Home) Have(Milk) At(Home) Have(Ban. ) Have(Drill) Finish

POP(<A, O, L>, agenda, actions) • <A, O, L>, A partial plan to expand

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. 2. 3. 4. 5. 6. Termination: If agenda

POP(<A, O, L>, agenda, actions) 1. 2. 3. 4. 5. 6. Termination: If agenda is empty, return plan <A, O, L>. Goal Selection: select and remove open condition <p, aneed > from agenda. Action Selection: Choose new or existing action aadd that can precede aneed and whose effects include p. Link and order actions. Update Agenda: If aadd is new, add preconditions to agenda. 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 Recurse: on modified plan and agenda Choose is nondeterministic Select is deterministic

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

Start At(Home) Sells(HWS, Drill) Sells(SM, Milk) Sells(SM, Ban. ) At(x) At(Home) Go(SM) Go(HWS) At(HWS) Sells(HWS, Drill) Buy(Drill) At(SM), Sells(SM, Milk) At(SM), Sells(SM, Ban. ) Buy(Milk) Buy(Ban. ) At(SM) Go(Home) Have(Drill) Have(Milk) Have(Ban. ) at(Home) Finish