Download - Roots of planning
![Page 1: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/1.jpg)
Roots of planning
n problem solving through state-spacesearch
n software agents (e.g. robotics)
EXAMPLE: “Shakey” (pg. 360)n a robot that roamed the halls of SRI in
the early 1970’sn actions were based on plans
![Page 2: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/2.jpg)
The Problem
Find a sequence of actions that achievesa given goal when performed starting in
a given state.
PLANPLANPLANPLAN
START
FINISH
Initial State
Goal State
OperatorInstances
![Page 3: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/3.jpg)
A Simple Planning Agent
plans ahead before acting (ch3)
selects actions based on explicit,logical representations of thecurrent state and the effects ofactions (ch6)
agent uses beliefs about actionsand their consequences tosearch for a solution over aspace of plans rather than aspace of situations
![Page 4: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/4.jpg)
A Simple Planning Agent
Algorithm: (pg. 338)
1. Generate a goal to achieve
2. Construct a plan to achieve goal fromcurrent state
3. Execute plan until finished
4. Begin again with new goal
![Page 5: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/5.jpg)
A Simple Planning Agent
n Assumptions:– Atomic time
– no concurrent actions allowed
– deterministic actions
– agent is the sole cause of change in theworld
– agent is omniscient
– Closed World Assumption
![Page 6: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/6.jpg)
“The Blocks World”
Domain:– set of cubic blocks sitting on
a table
Actions:– blocks can be stacked
– can pick up a block andmove it to another position
– can only pick up one blockat a time
Goal:– to build a specified stack of
blocks
AAAACCCCBBBB
INITIAL STATE
GOAL STATE
BBBB
AAAACCCC
![Page 7: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/7.jpg)
So what’s the difference?
Problem-Solving:
(State-space search)n representation of actions,
states, goals, plansn actions are represented by a
program that generatescomplete state descriptions
n “black box”n unbroken sequences of
actions beginning from theinitial state to the goal state
Planning:
(Situation Calculus)n “open up” the representation
of states, goals, and actionsn planner is free to add actions
to the plan wherever theyare needed
n most parts of the world areindependent of most otherparts -> divide and conquer
![Page 8: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/8.jpg)
Important Points
n Planning agents uselookahead
n Planning agents differ fromproblem-solving agents– use of more flexible
representations of states,actions, goals, and plans
![Page 9: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/9.jpg)
Situation Calculus
n Augment FOL so that it can reasonabout actions in time– Add situation variables to specify time
– Add predicate holds(f,s)
– Add function result(a,s)
n Example: agent-walks-to-location-y(∀∀ x)(∀∀ y)(∀∀ s)(at(Agent,x,s)) =
at(Agent,y,result(walk(y),s))
![Page 10: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/10.jpg)
Situation Calculus
n You must also specify what doesn’tchange!
n Example: agent-walks-to-location-y– (∀∀ x)(∀∀ y)(∀∀ s)(at(Agent,x,s)) =
at(Agent,y,result(walk(x,y),s))
– (∀∀ x)(∀∀ y)(∀∀ s)(at(Bananas,x,s)) =at(Bananas,x,result(walk(x,y),s))
![Page 11: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/11.jpg)
Practical Planning
n Restrict the language with which wedefine problems
n Use a special-purpose algorithm calleda planner rather
![Page 12: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/12.jpg)
Important Points
n A planning problem isrepresented in situationcalculus by logicalsentences
n Planning by unguidedlogical inference isinefficient and gives noguarantees about theresulting plan
![Page 13: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/13.jpg)
Representing States & Goals
n STRIPS:– describes states & operators in a restricted
language
n States:– a conjunction of “facts” (ground literals that
do not contain variable symbols)
n Goals:– a conjunction of positive literals
![Page 14: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/14.jpg)
Representing States & Goals
Initial State:ontable(A) Λontable(B) Λ
on(C, B) Λ
clear(A) Λclear(C) Λ
handempty
Goal:ontable(B) Λ
on(C,B) Λon(A,C) Λ
clear(A) Λ
handempty
AAAACCCCBBBB
INITIAL STATE
GOAL STATE
BBBB
AAAACCCC
![Page 15: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/15.jpg)
Representing Actions
1. Action descriptionName: pickup(x)
2. PreconditionPreconditions: ontable(x), clear(x), handempty
3. EffectEffect: holding(x), ~ontable(x), ~clear(x),
~handempty
![Page 16: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/16.jpg)
An operator is APPLICABLE if all preconditions areAn operator is APPLICABLE if all preconditions aresatisfied.satisfied.
Actions in “Blocks World”
n pickup(x)– picks up block ‘x’
from table
n putdown(x)– if holding block ‘x’,
puts it down on table
n stack(x,y)– if holding block ‘x’,
puts it on top ofblock ‘y’
n unstack(x,y)– picks up block ‘x’ that
is currently onblock ‘y’
![Page 17: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/17.jpg)
Important Points
n The STRIPS languagedescribes actions in termsof their preconditions andeffects. It captures much ofthe expressive power ofsituation calculus, but notall domains and problemscan be described in theSTRIPS language
![Page 18: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/18.jpg)
Planning as Search
n Situation Space– start at initial
state, applyoperators untilreached goal(e.g. searching)
n Plan Space– search through a
space of plans
See Figure 11.2 (pg. 340)
See Figure 11.5 (pg. 348)
FinishStartpickup(A)
unstack(C,B)
putdown(A)
stack(A,C)
...putdown(C)
stack(C,A)
stack(C,B)
Start
Finishon(A,C)
holding(A)pickup(A)
handempty
stack(A,C)
![Page 19: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/19.jpg)
Situation-Space Planners
n Progression– Forward chaining from initial state to goal
state
n Regression– Backward chaining from goal state to initial
state
![Page 20: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/20.jpg)
Progression Situation Space
n Like a state-space search exceptSTRIPS operators specified instead aset of next-move functions
n Use any search method you like (e.g.BFS, DFS, A*)
n PROBLEM:– huge search space to explore, so usually
very inefficient
![Page 21: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/21.jpg)
AAAACCCCBBBB
INITIAL STATE
GOAL STATE
BBBB
AAAACCCC
Progression Situation-Space
Algorithm:1. Start from initial state2. Find all operators whose
preconditions are true inthe initial state
3. Compute effects ofoperators to generatesuccessor states
4. Repeat steps 2-3, until anew state satisfies thegoal conditions
![Page 22: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/22.jpg)
Important Points
n There are 2 approaches tosolving planning problems:– situation-space planners
– plan-space planners
n Progression is one type ofsituation-space planners
![Page 23: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/23.jpg)
Regression Situation-Space
n Usually more efficient than progression– progression: many operators are
applicable at each state
– regression: only a small number ofoperators are applicable for achieving agiven goal
n PROBLEM:– cannot always find a plan even if one
exists!
![Page 24: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/24.jpg)
AAAACCCCBBBB
INITIAL STATE
GOAL STATE
BBBB
AAAACCCC
Regression Situation-Space
Algorithm:1. Start with goal node
corresponding to goal tobe achieved
2. Choose an operator thatwill add one of the goals
3. Replace that goal withthe operator’spreconditions
4. Repeat steps 2-3 untilyou have reached theinitial state
![Page 25: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/25.jpg)
Important Points
n Regression is the secondtype of situation-spaceplanner
n It is more efficient thanprogression
![Page 26: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/26.jpg)
Where Situation-Space fails…
n If the order of solving a set of goals failsbecause solving a later goal undoes anearlier goal
n Does not allow for interleaving of stepsin any solution it finds
![Page 27: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/27.jpg)
“Sussman Anomaly”
n Solving on(A,B) first will be undonewhen solving the second goal on(B,C)and vice versa.
AAAACCCC
BBBBINITIAL STATE GOAL STATE
BBBBAAAA
CCCC
![Page 28: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/28.jpg)
Plan-Space Planners
n Use when ordering of sub-goals matters
n Make commitments only as necessaryn Least Commitment planning:
– never making a choice unless required todo so
• Advantage: don’t have to backtrack later!
![Page 29: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/29.jpg)
Important Points
n Use situation spaceplanners when goals arenot interleaved
n Use plan space plannerswhen goals are interleaved– the ordering of goals affects
the outcome
![Page 30: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/30.jpg)
Definition of a plan
n A plan is formally defined as a data structureconsisting of the following 4 components:– A set of plan steps– A set of step ordering constraints
– A set of variable binding constraints– A set of causal links
Plan(STEPS:{S1:Op(ACTION: Start),
S2:Op(ACTION: Finish,
PRECOND: On(c, table) ∧ On(b,c) ∧ On(a,b) } ,
ORDERINGS: {S1 < S2},
BINDINGS: {},
LINKS: {})
![Page 31: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/31.jpg)
Representation for Plans
Partial Order Plans:n can represent plans
in which some stepsare ordered withrespect to eachother and othersteps are unordered
Total Order Plans:n plans consist of a
simple list of steps
![Page 32: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/32.jpg)
Partial vs. Total Order Plans
Start
LeftSock
RightSock
LeftShoe
RightShoe
Finish
Start
Finish
RightSock
LeftSock
LeftShoe
RightShoe
Partial Order Plan: Total Order Plan:
Start
Finish
LeftSock
RightSock
RightShoe
LeftShoe
Start
Finish
LeftSock
RightSock
LeftShoe
RightShoe
Start
Finish
RightSock
RightShoe
LeftSock
LeftShoe
Start
Finish
RightSock
LeftSock
RightShoe
LeftShoe
Start
Finish
LeftSock
LeftShoe
RightSock
RightShoe
![Page 33: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/33.jpg)
Important Points
n Partial-ordering constraintsand uninstantiatedvariables allow us to followa least-commitmentapproach
![Page 34: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/34.jpg)
Chapter 11 - Planning
Section 11.5
Partial-Order PlanningExample
![Page 35: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/35.jpg)
Partial-Order Planning Example
n Return to shopping problem:– Buy milk, bananas, a drill, and then return
back home
n Start with the definitions of the initialand final states
n Also give the actions involved in theexample
![Page 36: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/36.jpg)
State Definitions
n Initial StateOp(ACTION: Start,
EFFECT: At(Home) ∧ Sells(HWS,Drill) ∧
Sells(SM, Milk) ∧ Sells(SM,Bananas))
n Goal StateOp(ACTION: Finish,
PRECOND: Have(Drill) ∧ Have(Milk) ∧
Have(Bananas) ∧ At(Home))
![Page 37: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/37.jpg)
Action Definitions
n ActionsOp(ACTION: Go(there),
PRECOND: At(here),
EFFECT: At(there) ∧ ¬ At(here))
Op(ACTION: Buy(x),
PRECOND: At(store) ∧ Sells(store, x),
EFFECT: Have(x))
![Page 38: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/38.jpg)
Initial Plan
n Bold arrows are causal links
n Thin arrows are ordering constraints
Figure 11.6 From Artificial Intelligence: A Modern Approach
![Page 39: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/39.jpg)
Extending the Plan
n Since there is no other way to achieve the Have(x)preconditions of the goal state, planner mustextend plan by adding actions that will achievethem
n Extend plan by adding Buy actions
Figure 11.7a From Artificial Intelligence: A Modern Approach
![Page 40: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/40.jpg)
Causal Links Protect Conditions
n Causal link between Buy(Drill) andFinish means it was added to achievethe Finish precondition Have(Drill)
n If a new step comes that deletesHave(Drill) condition the planner willmake sure it won’t go betweenBuy(Drill) and Finish.
![Page 41: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/41.jpg)
Achieving Preconditions
n Now planner achieves the Sells preconditions bylinking them to the initial state by causal links
n Since this is the only operator that achieves the Sellsprecondition, the planner must choose this one
Figure 11.17b From Artificial Intelligence: A Modern Approach
![Page 42: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/42.jpg)
How Well Are We Doing?
n Large improvement over the problem-solving approach– Planner was able to choose the right
actions without considering all of the otheralternatives
– Don’t need to worry about ordering ofactions because the POP will do that later
![Page 43: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/43.jpg)
Adding the Go Actions
n Planner must now extend the plan by adding Goactions to achieve At condition of Buy action
n This will get us to the HWS and the SM
Figure 11.8 From Artificial Intelligence: A Modern Approach
![Page 44: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/44.jpg)
Problem with the Go Actions I
n If planner links both Go actions to the initial state,both actions will interact with each other
n Problem: agent can’t be at two places at once
Figure 11.9 From Artificial Intelligence: A Modern Approach
![Page 45: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/45.jpg)
Problem with Go Actions II
n If the agent takes one link, then theprecondition At(Home) for the other linkwill be negated
n This is a threat, and must be resolvedbefore continuing
![Page 46: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/46.jpg)
Problem with Go Actions III
n We realize that neither promotion nordemotion can solve this threat
n No matter which of the two is chosenfirst, At(Home) precondition of the otheris deleted
n When this occurs, the planner must giveup on partial plan and back up to aprevious choice
![Page 47: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/47.jpg)
Solution to Go Actions
n Instead of linking both Go actions to initial state, theplanner decides to go from Home to the HWS, thenfrom the HWS to the SM
n This is done by linking Go(HWS) to Go(SM)
Modified Figure 11.11 From Artificial Intelligence: A Modern Approach
![Page 48: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/48.jpg)
Another Threat
n Go(SM) step threatens the At(HWS) precondition ofthe Buy(Drill) step which is protected
n Might go from HWS to the SM and forget to buy thedrill!
n Solution: promotion– constrain Go(SM) to come after the Buy(Drill) step
– add an ordering constraint from Buy(Drill) to Go(SM)
Modified Figure 11.11 From Artificial Intelligence: A Modern Approach
![Page 49: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/49.jpg)
Final Step I
n Only At(Home) precondition of goal stateleft to achieve
n Now planner must extend plan by addingGo(Home) step to achieve this
n Try to achieve At(x) by linking At(Home) tothe initial state, this will threaten At(Home)precondition of At(HWS) step
n There is no way to resolve this threat, soplanner must back up and try again
![Page 50: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/50.jpg)
Final Step II
n Now planner tries to link At(x) to theGo(HWS) step, then this will also be athreat
n Threatens At(HWS) step of the Go(SM)step
n Again, can’t resolve this, so plannermust backtrack and try another path
![Page 51: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/51.jpg)
Final Step III
n It now tries to link to Go(SM) step
n Another threat:– Threatens At(SM) preconditions of the
Buy(Milk) and Buy(Bananas) steps
n But this can be solved with promotion– Constrain the Go(Home) step to come after
the Buy(Milk) and Buy(Bananas) steps
n Now we’re done!
![Page 52: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/52.jpg)
Final Plan
Figure 11.11 From Artificial Intelligence: A Modern Approach
![Page 53: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/53.jpg)
Advantages of POP
n POP can take a problem that would takemany search states for problem-solvingapproach and solve it in only a few steps
n Least commitment nature of planner means itonly needs to search where subplans interact
n Causal links allow planner to know when tostop a bad plan without wasting timeexpanding irrelevant parts of the plan
![Page 54: Roots of planning](https://reader031.vdocuments.net/reader031/viewer/2022012018/61dad0500b7c4d20c55cd499/html5/thumbnails/54.jpg)
Summary
n POP starts with a minimal plan and adds to it until allpreconditions have been satisfied
n POP is a regression planner
n POP can take a problem that would take manysearch states for problem-solving approach and solveit in only a few steps
n Causal links protect conditions
n If threat occurs, promote/demote threatening steps
n POP can be extended to allow partially-instantiatedoperators– need to worry about possible threats