Graphplan. Automated Planning: Introduction and Overview 2 The Dock-Worker Robots (DWR) Domain...
-
Upload
kassidy-howson -
Category
Documents
-
view
221 -
download
0
Transcript of Graphplan. Automated Planning: Introduction and Overview 2 The Dock-Worker Robots (DWR) Domain...
Automated Planning: Introduction and Overview
2
The Dock-Worker Robots (DWR) Domain
• informal description:– harbour with several locations
(docks), docked ships, storage areas for containers, and parking areas for trucks and trains
– cranes to load and unload ships etc., and robot carts to move containers around
Simplified DWR
• Two robots: r and q• Two containers: a and b• Two locations: 1 and 2• Robots can load and unload containers and
move between locations
Dock-Worker-Robot domain
• Move(r, l, l’)– Pre: at(r,l), adjacent(l,l’)– Effects: at(r,l’), ¬at(r,l)
• Load(c,r,l)– Pre: at(r,l), in(c,l), unloaded(r)– Effects: loaded(r,c), ¬in(c,l), ¬unloaded(r)
• Unload(c,r,l)– Pre: at(r,l), loaded(r,c)– Effects: unloded(r), in(c,l), ¬loaded(r,c)
Dock-Worker-Robot domain:Propositionalized version
• Robots r and q:– r1 and r2: at(r, l1), at(r, l2)– q1 and q2: at(q, l1), at (q, l2)– ur and uq: unloaded(r), unloaded(q)
• Containers a and b:– a1, a2, ar, aq: in(a, l1), in(a, l2), loaded(a, r), loaded(a,q)– b1, b2, br, bq: in(b, l1), in(b, l2), loaded(b, r), loaded(b,q)
• Example initial state: {r1,q2,a1,b2,ur,uq}
Dock-Worker-Robot domain:Propositionalized version
• Move actions in propositions:– Mr12: move(r,l1,l2)• similarly we hae Mr21, Mq12, Mq21
• Load actions:– Lar1: load(a,r,l1)• Similarly we have Lar2, Laq1, Laq2, Lbr1, Lbr2, Lbq1, Lbq2
• Unload actions:– Uar1: unload(a, r, l1)• Similarly we have Uar2, Uaq1, Uaq2, Ubr1, Ubr2, Ubq1, Ubq2
The Graphplan algorithm
• Main compoents– Expand graph, where each level includes
• Action Layer• Proposition Layer• Mutex propositions• Mutex actions
– Back-search procedure to retrieve plan• Executed when a graph level includes all goal
propositions and non of them are mutex– This still doesn’t mean there is a valid plan in this level
• Basically, this is depth-first search
The expand method
r1q2a1b2uruq
Mr12
Mq21
Lar1
Lbq2
r1r2q1q2a1arb2bquruq
Mr12
Mr21
Mq12
Mq21
Lar1
Laq1
Lbr2
Lbq2
Uar1
Ubq2
r1r2q1q2a1araqb2brbquruq
Mr12
Mr21
Mq12
Mq21
Lar1
Laq1
Lbr2
Lbq2
Uar1
Uar2
Uaq1
Ubr2
Ubq1
Ubq2
r1r2q1q2a1a2araqb1b2brbquruq
P0 P1 P2 P3A1 A2 A3
The expand method
– Expand graph, where each level includes• Action Layer• Proposition Layer• Mutex propositions• Mutex actions
– Important: we also have noOps to propagate propositions from one layer to the next (these were not shown in previous example to save space)
Independent actions
• Mr12 and Lar1:– Not independent– Mr12 deletes precondition of Lar1
• Mr12 and Mr21:– Not independent– Mr12 deletes positive effect of Mr21
• Mr12 and Mq21:– Independent– May occur in same action layer
Mr12
Mr21
Mq12
Mq21
Lar1
Laq1
Lbr2
Lbq2
Uar1
Ubq2
r1r2q1q2a1araqb2brbquruq
P2A2
Mutex actions
Function mutexAction(a1, a2, mP)if not(independent(a1,a2)
return truefor all p1 in precon(a1)
for all p2 in precon(a2)if(p1,p2) in mP
return truereturn false
Mutex propositions
Function mutexProposition (p1, p2, mA)for all a1 in p1.producers
for all a2 in p2.producersif(a1,a2) not in mA
return falsereturn true
The expand method: Pseudo-code
Function expand(Gk-1)
Ak {a in A | precond(a) in Pk-1 and
{(p1,p2)|p1,p2 in precond(a) mPk-1={} }
mAk {(a1,a2)|a1,a2 in Ak, a1!=a2, and mutex(a1,a2,mPk-1)}
Pk {p in P | a in Ak: p is positive effect of a}
mPk {(p1,p2)|p1,p2 in pk, p1!=p2, and mutex(p1,p2,mAk)}
Backward graph search
– Back-search procedure to retrieve plan• Executed when a graph level includes all goal
propositions and non of them are mutex– This still doesn’t mean there is a valid plan in this level
• Basically, this is depth-first search from the latest layer to layer 0• At each iteration we choose an action that achieves one
of the goal propositions and add its preconditions as goals for the next iteration• Backtrack when fails
r1q2a1b2uruq
Mr12
Mq21
Lar1
Lbq2
r1r2q1q2a1arb2bquruq
Mr12
Mr21
Mq12
Mq21
Lar1
Laq1
Lbr2
Lbq2
Uar1
Ubq2
r1r2q1q2a1araqb2brbquruq
Mr12
Mr21
Mq12
Mq21
Lar1
Laq1
Lbr2
Lbq2
Uar1
Uar2
Uaq1
Ubr2
Ubq1
Ubq2
r1r2q1q2a1a2araqb1b2brbquruq
P0 P1 P2 P3A1 A2 A3
noOp
Choose one action for each proposition, will back track if fail
The noGood table
• When the planning graph has k levels, the noGood table is an array of k sets of sets of goal propositions. – A set of goal propositions g appears in noGood(k) if
we failed to find a plan for g in level k
• Before searching for set g in Pj:– Check whether g is in noGood(j)
• When search for set g in Pj failed:– Add g to noGood(j)
Backward graph search: Optional implementation
Function extract (G, g, level)if level=0
return []if g in noGoods(level)
return failureplan gpSearch(G, g, {}, level)if plan!=failure
reuturn plannoGood(level) noGood(level) + greturn failure
Backward graph search: Optional implementation
Function gpSearch(G, g, plan, level)if g = {} #no more subgoals
newPlan = extract (G, all preconds of actions in plan, level-1)
if newPlan = failure return failureelse return newPlan union with plan
p g.selectOneProp()providers {a in Alevel|p in posEffects(a) and no action in plan
is mutex with a}if providers = {} return failurea providers.chooseOneAction()return gpSearch(G, g – positive effects of a, plan+a, level)
Need to add backtracking here and choose another action if failing