290 likes | 428 Views
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).
E N D
Partial Order Plan Execution Brian C. Williams 16.412J/6.834J Sept. 16th, 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) 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 Can perform a stepwhen all predecessorshave been executed.
Execution Start At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.) Can perform a stepwhen all predecessorshave been executed. 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 At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.) Can perform a stepwhen all predecessorshave been executed. 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 At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.) Can perform a stepwhen all predecessorshave been executed. 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 At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.) Can perform a stepwhen all predecessorshave been executed. 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 At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.) Can perform a stepwhen all predecessorshave been executed. 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 At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.) Can perform a stepwhen all predecessorshave been executed. 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 At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.) Can perform a stepwhen all predecessorshave been executed. 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 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
Action Monitoring Start At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.) Fail if preconditions of ready action are not satisfied. 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
Action Monitoring Start At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.) Fail if preconditions of ready action are not satisfied. 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 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.
Start ExecutionMonitoring 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
Start ExecutionMonitoring 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 ActiveLinks to empty Mark 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
Autonomous Agents: What is missing? EXECUTION PLANNING RECOVERY Command dispatch Fault protection Attitude control Self-commanding Self-diagnosing Self-repairing Monitors Mission Goal Scenario
Outline • Plan execution • Plan monitoring • Appendix: Partial order planning in a nutshell
a north11 north12 a a W0 W1 W2 Simple Operator-based Planning • 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 • Input • Initial state of world • Goal • partial state • Operators (actions) • Fn: world-stateworld-state • Output • Sequence of actions
precond: (and (agent-at 1 1) (agent-facing north)) north11 North11 a a effect: (and (agent-at 1 2) (not (agent-at 1 1))) W1 W0 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 • Effects specify how to change the set of propositions.
Note: strips doesn’t allow derived effects; you must be complete! } Action Schemata • Instead of defining: pickup-A and pickup-B and … • Define a schema: ?var denotes a free variable (:operatorpick-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)))
A Solution: Complete and Consistent Plan Start • 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.) At(Home) Sells(HWS,Drill) Sells(SM,Milk) Sells(SM,Ban.) • Complete Plan • Consistent Plan 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
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) • 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: • Demotion: Addathreat <aproduce • Promotion: Addaconsume <athreat • Recurse: on modified plan and agenda Choose is nondeterministic Select is deterministic
At(SM) Go(Home) 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) At(SM), Sells(SM,Milk) At(SM), Sells(SM,Ban.) Buy(Drill) Buy(Milk) Buy(Ban.) Have(Drill) Have(Milk) Have(Ban.) at(Home) Finish