graphplan

19
Graphplan

Upload: cahil

Post on 23-Feb-2016

32 views

Category:

Documents


0 download

DESCRIPTION

Graphplan. 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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Graphplan

Graphplan

Page 2: Graphplan

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

Page 3: Graphplan

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

Page 4: Graphplan

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)

Page 5: Graphplan

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}

Page 6: Graphplan

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

Page 7: Graphplan

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

Page 8: Graphplan

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

Page 9: Graphplan

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)

Page 10: Graphplan

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

Page 11: Graphplan

Mutex actionsFunction mutexAction(a1, a2, mP)

if not(independent(a1,a2)return true

for all p1 in precon(a1)for all p2 in precon(a2)

if(p1,p2) in mPreturn true

return false

Page 12: Graphplan

Mutex propositionsFunction mutexProposition (p1, p2, mA)

for all a1 in p1.producersfor all a2 in p2.producers

if(a1,a2) not in mAreturn false

return true

Page 13: Graphplan

The expand method: Pseudo-codeFunction 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)}

Page 14: Graphplan

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

Page 15: Graphplan

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

Page 16: Graphplan

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)

Page 17: Graphplan

Backward graph search: Optional implementation

Function extract (G, g, level)if level=0return []if g in noGoods(level)return failureplan gpSearch(G, g, {}, level)if plan!=failurereuturn plannoGood(level) noGood(level) + greturn failure

Page 18: Graphplan

Backward graph search: Optional implementation

Function gpSearch(G, g, plan, level)if g = {} #no more subgoalsnewPlan = extract (G, all preconds of actions in plan, level-1)

if newPlan = failure return failureelse return newPlan union with planp 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

Page 19: Graphplan

Graphplan pseudo-code•