CSC2542 Stte-Spe Plnning Sheil MIlrith Deprtment of Computer Siene University of Toronto Fll 2010 1 Aknowlegements Some the slies use in this ourse re moifitions of Dn Nu s leture slies for the textook Automte Plnning, liense uner the Cretive Commons Attriution-NonCommeril-ShreAlike Liense: http://retiveommons.org/lienses/y-n-s/2.0/ Other slies re moifitions of slies evelope y Mlte Helmert, Bernhr Neel, n Jussi Rintnen. I hve lso use some mteril prepre y P@trik Hslum n Ro Kmhmpti. I woul like to grtefully knowlege the ontriutions of these reserhers, n thnk them for generously permitting me to use spets of their presenttion mteril. 2
Motivtion Nerly ll plnning proeures re serh proeures Different plnning proeures hve ifferent serh spes Two exmples: Stte-spe plnning Pln-spe plnning Stte-spe plnning Eh noe represents stte of the worl A pln is pth through the spe Pln-spe plnning Eh noe is set of prtilly-instntite opertors, plus some onstrints Impose more n more onstrints, until we get pln 3 Outline Stte-spe plnning Forwr serh Bkwr serh Lifting STRIPS Blok-stking 4
Forwr Serh tke 3 tke 2 move r1 5 Properties Forwr-serh is soun for ny pln returne y ny of its noneterministi tres, this pln is gurntee to e solution Forwr-serh lso is omplete if solution exists then t lest one of Forwrserh s noneterministi tres will return solution. 6
Deterministi Implementtions Some eterministi implementtions of forwr serh: reth-first serh s 1 1 epth-first serh 4 est-first serh (e.g., A*) s 0 s 2 2 greey serh 5 s 4 s 5 s g Breth-first n est-first serh re soun n omplete But they usully ren t prtil, requiring too muh memory Memory requirement is exponentil in the length of the solution In prtie, more likely to use epth-first serh or greey serh Worst-se memory requirement is liner in the length of the solution In generl, soun ut not omplete But lssil plnning hs only finitely mny sttes Thus, n mke epth-first serh omplete y oing loop-heking 3 s 3 7 Brnhing Ftor of Forwr Serh 1 1 2 3 50 initil stte 2 3 gol Forwr serh n hve very lrge rnhing ftor Cn hve mny pplile tions tht on t progress towr gol Why this is : Deterministi implementtions n wste time trying lots of irrelevnt tions Nee goo heuristi funtion n/or pruning proeure (This will e fous of lter isussion) 8
Bkwr Serh For forwr serh, we strte t the initil stte n ompute stte trnsitions new stte = γ(s,) For kwr serh, we strt t the gol n ompute inverse stte trnsitions new set of sugols = γ 1 (g,) To efine γ -1 (g,), must first efine relevne: An tion is relevnt for gol g if mkes t lest one of g s literls true g effets() oes not mke ny of g s literls flse g + effets () = n g effets + () = 9 Inverse Stte Trnsitions If is relevnt for g, then γ 1 (g,) = (g effets()) preon() Otherwise γ 1 (g,) is unefine Exmple: suppose tht g = {on(1,2), on(2,3)} = stk(1,2) Wht is γ 1 (g,)? 10
g 1 1 g 4 4 s 0 g 5 5 g 2 2 g 0 3 g 3 11 Effiieny of Bkwr Serh 1 1 2 3 50 initil stte gol Bkwr serh n lso hve very lrge rnhing ftor E.g., n opertor o tht is relevnt for g my hve mny groun instnes 1, 2,, n suh tht eh i s input stte might e unrehle from the initil stte As efore, eterministi implementtions n wste lots of time trying ll of them 12
Lifting foo(x,y) preon: p(x,y) effets: q(x) p( 1, 1 ) p( 1, 2 ) foo( 1, 1 ) foo( 1, 2 ) p( 1, 3 ) foo( 1, 3 ) q( 1 ) p(1, 50 )... foo( 1, 50 ) Cn reue the rnhing ftor of kwr serh if we prtilly instntite the opertors this is lle lifting foo( 1,y) q( 1 ) p( 1,y) 13 Lifte Bkwr Serh Bsi Ie: Dely grouning of opertors until neessry in orer to in vriles with those require to relize gol or sugol More omplite thn Bkwr-serh Must keep trk of wht sustitutions were performe But it hs muh smller rnhing ftor 14
Lifte Bkwr Serh 15 The Serh Spe is Still Too Lrge Lifte-kwr-serh genertes smller serh spe thn Bkwr-serh, ut it still n e quite lrge Suppose tions,, n re inepenent, tion must preee ll of them, n there s no pth from s 0 to s input stte We ll try ll possile orerings of,, n efore relizing there is no solution Pln-spe plnning n help with this prolem s 0 gol 16
Pruning the Serh Spe Pruning the serh spe n relly help. Two tehniques we will isuss: Soun pruning using rnh-n-oun heuristi serh Domin ustomiztion tht prunes tions n sttes For now, just two exmples: STRIPS Blok stking 17 STRIPS One of the first plnning lgorithms (Shkey the root) π the empty pln o moifie kwr serh from g ** eh new sugol is preon() (inste of γ -1 (s,)) when you fin n tion tht s exeutle in the urrent stte, then go forwr on the urrent serh pth s fr s possile, exeuting tions n ppening them to π repet until ll gols re stisfie π = 6, 4 s= γ(γ(s 0, 6 ), 4 ) g 6 stisfie in s 0 6 g 4 g5 g 3 4 5 g 1 g 2 1 2 g 3 urrent serh pth g 3 3 18
Quik Review of Bloks Worl unstk(x,y) Pre: on(x,y), ler(x), hnempty Eff: ~on(x,y), ~ler(x), ~hnempty, holing(x), ler(y) stk(x,y) Pre: holing(x), ler(y) Eff: ~holing(x), ~ler(y), on(x,y), ler(x), hnempty pikup(x) Pre: ontle(x), ler(x), hnempty Eff: ~ontle(x), ~ler(x), ~hnempty, holing(x) putown(x) Pre: holing(x) Eff: ~holing(x), ontle(x), ler(x), hnempty 19 Limittions of STRIPS Exmple 1. The Sussmn Anomly Initil stte gol On this prolem, STRIPS nnot proue n irreunnt solution. Try it n see. Strt with the gol {on(,), on(,)}. 20
Exmple 2. Register Assignment Prolem Stte-vrile formultion: Initil stte: Gol: Opertor: {vlue(r1)=3, vlue(r2)=5, vlue(r3)=0} {vlue(r1)=5, vlue(r2)=3} ssign(r,v,r',v') preon: vlue(r)=v, vlue(r')=v' effets: vlue(r)=v' STRIPS nnot solve this prolem t ll 21 How to Hnle Prolems like These? Severl wys: Do something other thn stte-spe serh e.g., Chpters 5 8 Use forwr or kwr stte-spe serh, with omin-speifi knowlege to prune the serh spe Cn solve oth prolems quite esily this wy Exmple: lok stking using forwr serh 22
Domin-Speifi Knowlege A loks-worl plnning prolem P = (O,s 0,g) is solvle if s 0 n g stisfy some simple onsisteny onitions g shoul not mention ny loks not mentione in s 0 lok nnot e on two other loks t one et. Cn hek these in time O(n log n) If P is solvle, n esily onstrut solution of length O(2m), where m is the numer of loks Move ll loks to the tle, then uil up stks from the ottom Cn o this in time O(n) With itionl omin-speifi knowlege n o even etter 23 Aitionl Domin-Speifi Knowlege A lok x nees to e move if ny of the following is true: s ontins ontle(x) n g ontins on(x,y) - see elow s ontins on(x,y) n g ontins ontle(x) - see elow s ontins on(x,y) n g ontins on(x,z) for some y z - see elow s ontins on(x,y) n y nees to e move - see e elow e initil stte gol 24
Domin-Speifi Algorithm loop if there is ler lok x suh tht x nees to e move n x n e move to ple where it won t nee to e move then move x to tht ple else if there is ler lok x suh tht x nees to e move then move x to the tle else if the gol is stisfie then return the pln else return filure repet e initil stte gol 25 Esily Solves the Sussmn Anomly loop if there is ler lok x suh tht x nees to e move n x n e move to ple where it won t nee to e move then move x to tht ple else if there is ler lok x suh tht x nees to e move then move x to the tle else if the gol is stisfie then return the pln else return filure repet initil stte gol 26
Properties The lok-stking lgorithm: Soun, omplete, gurntee to terminte Runs in time O(n 3 ) Cn e moifie to run in time O(n) Often fins optiml (shortest) solutions But sometimes only ner-optiml 27