Lecture slides for Automted Plnning: Theory nd Prctice Chpter 5 Pln-Spce Plnning Dn S. Nu CMSC 722, AI Plnning University of Mrylnd, Spring 2008 1
Stte-Spce Plnning Motivtion g 1 1 g 4 4 s 0 g 5 5 g 2 2 g 0 Prolem with stte-spce serch In some cses we my try mny different orderings of the sme ctions efore relizing there is no solution g 3 3 ded end ded end ded end ded end ded end ded end c c c c gol Lest-commitment strtegy: don t commit to orderings, instntitions, etc., until necessry 2
Outline Bsic ide Open gols Threts The PSP lgorithm Long exmple Comments 3
Pln-Spce Plnning - Bsic Ide Bckwrd serch from the gol Ech node of the serch spce is prtil pln» A set of prtilly-instntited ctions» A set of constrints Types of constrints: precedence constrint: must precede inding constrints: foo(x Precond: Effects: p(x x y x = z p(z r(y Precond: p(y Effects: z(z Precond: p(z Effects:» inequlity constrints, e.g., v 1 v 2 or v c» equlity constrints (e.g., v 1 = v 2 or v = c nd/or sustitutions cusl link:» use ction to estlish the precondition p needed y ction 4
Pln-Spce Serch Initil pln Strt with n initil pln (will explin this lter Mke more nd more refinements to the pln, until solution is found If there re no refinements to pln during serch, then cktrck d d d c c c Questions: How to tell we hve solution?» No more flws in the pln How to refine pln?» Resolve the existing flws e d Fil! Solution! 5
Open gol: An ction hs precondition p tht we hven t decided how to estlish foo(x Precond: Effects: p(x Find n ction Resolving the flw: (either lredy in the pln, or insert it tht cn e used to estlish p cn precede nd produce p Instntite vriles nd/or constrin vrile indings Crete cusl link Flws: 1. Open Gols foo(x Precond: Effects: p(x p(z p(x z(z Precond: p(z Effects: z(x Precond: p(x Effects: 6
Flws: 2. Threts Thret: deleted-condition interction Action estlishes precondition (e.g., pq(x of ction Another ction c is cple of deleting p Resolving the flw: impose constrint to prevent c from deleting p cloer(y Precond: Effects: pq(y Three possiilities: Mke precede c Mke c precede foo(x Precond: Effects: pq(x pq(x z(x Precond: pq(x Effects: Constrin vrile(s to prevent c from deleting p 7
Initil pln The PSP Procedure d c d c d c e d Fil! Solution! PSP is oth sound nd complete It returns prtilly ordered solution pln Any totl ordering of this pln will chieve the gols Or could execute ctions in prllel if the environment permits it 8
Exmple Similr (ut not identicl to n exmple in Russell nd Norvig s Artificil Intelligence: A Modern Approch (1st edition Opertors: Strt Precond: none Effects:, sells(hws,drill, Sells(SM,Milk, Sells(SM,Bnn Finish Precond: Hve(Drill, Hve(Milk, Hve(Bnn, Effects: none Go(l,m Precond: At(l Effects: At(m, At(l Buy(p,s Precond: At(s, Sells(s,p Effects: Hve(p Strt nd Finish re dummy ctions tht we ll use insted of the initil stte nd gol 9
Exmple (continued Need to give PSP pln π s its rgument Initil pln: Strt, Finish, nd n ordering constrint Strt Effects:, Sells(HWS,Drill, Sells(SM,Milk, Sells(SM,Bnns Precond: Hve(Drill Hve(Milk Hve(Bnns Finish 10
Exmple (continued The first three refinement steps These re the only possile wys to estlish the Hve preconditions Strt At(s 1 Sells(s 1, Drill At(s 2 Sells(s 2,Milk At(s 3 Sells(s 3,Bnns Buy(Drill, s 1 Buy(Milk, s 2 Buy(Bnns, s 2 Hve(Drill Hve(Milk Hve(Bnns Finish 11
Exmple (continued Three more refinement steps The only possile wys to estlish the Sells preconditions Strt At(HWS Sells(HWS,Drill At(SM Sells(SM,Milk At(SM Sells(SM,Bnns Buy(Drill, HWS s 1 Buy(Milk, SM Buy(Bnns, SM Hve(Drill Hve(Milk Hve(Bnns Finish 12
Exmple (continued Two more refinements: the only wys to estlish At(HWS nd At(SM This time, severl threts occur Strt At(l 2 At(l 1 Go(l 2, SM Go(l 1,HWS At(HWS Sells(HWS,Drill At(SM Sells(SM,Milk At(SM Sells(SM,Bnns Buy(Drill, HWS s 1 Buy(Milk, SM Buy(Bnns, SM Hve(Drill Hve(Milk Hve(Bnns Finish 13
Exmple (continued Finlly, nondeterministic choice: how to resolve the thret to At(s 1? Our choice: mke Buy(Drill precede Go(SM This lso resolves the other two threts Strt At(l 2 At(l 1 Go(l 2, SM Go(l 1,HWS At(HWS Sells(HWS,Drill At(SM Sells(SM,Milk At(SM Sells(SM,Bnns Buy(Drill, HWS s 1 Buy(Milk, SM Buy(Bnns, SM Hve(Drill Hve(Milk Hve(Bnns Finish 14
Exmple (continued Nondeterministic choice: how to estlish At(l 1? We ll do it from Strt, with l 1 =Home Strt At(l 2 Go(l 2, SM Go(Home,HWS At(HWS Sells(HWS,Drill At(SM Sells(SM,Milk At(SM Sells(SM,Bnns Buy(Drill, HWS s 1 Buy(Milk, SM Buy(Bnns, SM Hve(Drill Hve(Milk Hve(Bnns Finish 15
Exmple (continued Nondeterministic choice: how to estlish At(l 2? We ll do it from Go(Home,HWS, with l 2 = HWS Strt At(HWS Go(HWS, SM Go(Home,HWS At(HWS Sells(HWS,Drill At(SM Sells(SM,Milk At(SM Sells(SM,Bnns Buy(Drill, HWS s 1 Buy(Milk, SM Buy(Bnns, SM Hve(Drill Hve(Milk Hve(Bnns Finish 16
Exmple (continued The only possile wy to estlish for Finish This cretes unch of threts Strt At(HWS Go(HWS, SM Go(Home,HWS At(HWS Sells(HWS,Drill At(SM Sells(SM,Milk At(SM Sells(SM,Bnns Buy(Drill, HWS s 1 Buy(Milk, SM Buy(Bnns, SM Go(l 3, Home Hve(Drill Hve(Milk Hve(Bnns Finish 17
Exmple (continued To remove the threts to At(SM nd At(HWS, mke them precede Go(l 3,Home This lso removes the other threts Strt At(HWS Go(HWS, SM Go(Home,HWS At(HWS Sells(HWS,Drill At(SM Sells(SM,Milk At(SM Sells(SM,Bnns Buy(Drill, HWS s 1 Buy(Milk, SM Buy(Bnns, SM Go(l 3, Home Hve(Drill Hve(Milk Hve(Bnns Finish 18
Estlish At(l 3 with l 3 =SM Finl Pln Strt At(HWS Go(HWS, SM Go(Home,HWS At(HWS Sells(HWS,Drill At(SM Sells(SM,Milk At(SM Sells(SM,Bnns Buy(Drill, HWS s 1 Buy(Milk, SM Buy(Bnns, SM Hve(Drill Hve(Milk Hve(Bnns Finish Go(SM, Home 19
Discussion How to choose which flw to resolve first nd how to resolve it? We ll return to these questions in Chpter 10 PSP doesn t commit to orderings nd instntitions until necessry Avoids generting serch trees like this one: c Prolem: how to prune infinitely long pths? In stte-spce plnning, loop detection is sed on recognizing sttes we ve seen efore In prtilly ordered pln, we don t know the sttes c c c gol Cn we prune if we see the sme ction more thn once? go(, go(, go(, t( No. Sometimes we might need the sme ction severl times in different sttes of the world (see next slide 20
Exmple 3-digit inry counter strts t 000, wnt to get to 110 s 0 = {d3=0, d2=0, d1=0} g = {d3=1, d2=1, d1=0} Opertors to increment the counter y 1: incr0 Precond: d 1 =0 Effects: d 1 =1 incr01 Precond: d 2 =0, d 1 =1 Effects: d 2 =1, d 1 =0 incr011 Precond: d 3 =0, d 2 =1, d 1 =1 Effects: d 3 =1, d 2 =0, d 1 =0 21
A Wek Pruning Technique Cn prune ll prtil plns of n or more ctions, where n = {ll possile sttes} This doesn t help very much There s no good pruning technique for pln-spce plnning Russell nd Norvig s Artificil Intelligence: A Modern Approch descries preliminry pproch In erly 90 s, reserchers hve looked t lerning pruning rules during PSP plnning 22