1 Aknowlegements CSC2542 Representtions for Clssil Plnning Sheil MIlrith Deprtment of Computer Siene University of Toronto Winter 2009 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 Quik Review of Clssil Plnning 8 restritive ssumptions req : A0: Finite A1: Fully oservle A2: Deterministi A3: Stti A4: Attinment gols A5: Sequentil plns A6: Impliit time A7: Offline plnning lotion 1 lotion 2 move2 lotion 1 lotion 2 unlo move1 lo s 1 s 3 s 4 put tke put tke move2 move1 lotion 1 lotion 2 move2 move1 lotion 1 lotion 2 lotion 1 lotion 2 lotion 1 lotion 2 s 0 s 2 s 5 4 Representtion: Motivtion for Approh Defult view: represent stte expliitly represent tions s trnsition system (e.g., s n iniene mtrix) Prolem: expliit grph orresponing to trnsition system is huge iret mnipultion of trnsition system is umersome Solution: Provie ompt representtion of trnsition system & inue grph 1. Explite the struture of the sttes e.g., sttes speifie in terms of stte vriles 2. Represent tions not s trnsition system/iniene mtries ut s funtions (e.g., opertors) speifie in terms of the stte vriles An tion is pplile to stte when some stte vriles hve ertin vlues. When pplile, it will hnge the vlues of ertin (other) stte vriles 3. To pln, Just give the initil stte 6 Use the opertors to generte the other sttes s neee Why is this more ompt? Why is this more ompt thn n expliit trnsition system? In n expliit trnsition system, tions re represente s stte-tostte trnsitions. Eh tion will e represente y n iniene mtrix of size S x S In the propose moel, tions re represente only in terms of stte vriles whose vlues they re out, n whose vlue they ffet. (It exploits the struture of the prolem!) Consier stte spe of 1024 sttes. It n e represente y log 2 1024=10 stte vriles. If n tion nees vrile v1 to e true n mkes v7 to e flse, it n e represente y just 2 its (inste of 1024x1024 mtrix) Of ourse, if the tion hs omplite mpping from sttes to sttes, in the worst se the tion rep will e just s lrge The ssumption eing me here is tht the tions will hve effets on smll numer of stte vriles. 8 Outline Representtion shemes 1. Clssil representtion 2. Set-theoreti representtion 3. Stte-vrile representtion Exmples: DWR n the Bloks Worl Comprisons 9
10 1. Clssil Representtion Strt with funtion-free first-orer lnguge Finitely mny preite symols n onstnt symols, ut no funtion symols Exmple: the DWR omin Lotions: l1, l2, Continers: 1, 2, Piles: p1, p2, Root rts: r1, r2, Crnes: k1, k2, Clssil Representtion Atom: preite symol n rgs Use these to represent oth fixe n ynmi ( fluent ) reltions jent(l,l ) tthe(p,l) elong(k,l) oupie(l) t(r,l) loe(r,) unloe(r) holing(k,) empty(k) in(,p) on(, ) top(,p) top(pllet,p) Groun expression: ontins no vrile symols - e.g., in(1,p3) Ungroun expression: t lest one vrile symol - e.g., in(1,x) Sustitution: θ = {x 1 v 1, x 2 v 2,, x n v n } Eh x i is vrile symol; eh v i is term Instne of e: result of pplying sustitution θ to e Reple vriles of e simultneously, not sequentilly 11 Sttes Stte: set s of groun toms The toms represent the things tht re true in one of Σ s sttes Only finitely mny groun toms, so only finitely mny possile sttes Opertors Opertor: triple o=(nme(o), preon(o), effets(o)) nme(o) is syntti expression of the form n(x 1,,x k ) n: opertor symol - must e unique for eh opertor x 1,,x k : vrile symols (prmeters) must inlue every vrile symol in o preon(o): preonitions literls tht must e true in orer to use the opertor effets(o): effets literls the opertor will mke true 12 13 Ations Ation: groun instne (vi sustitution) of n opertor Nottion Let e n opertor or tion. Then E.g., preon + () = {toms tht pper positively in s preonitions} preon () = {toms tht pper negtively in s preonitions} effets + () = {toms tht pper positively in s effets} effets () = {toms tht pper negtively in s effets} effets + (tke(k,l,,,p) = {holing(k,), top(,p)} effets (tke(k,l,,,p) = {empty(k), in(,p), top(,p), on(,)} 14 15
16 Appliility An tion is pplile to stte s if s stisfies preon(), i.e., if preon + () s n preon () s = Here re n tion n stte tht it s pplile to: Result of Performing n Ation If is pplile to s, the result of performing it is γ(s,) = (s effets ()) effets + () Delete negtive effets, n positive ones 17 Opertors for the DWR Domin Plnning omin: lnguge & opertors Opertors orrespons to set of stte-trnsition systems Plnning Prolems Given plnning omin (lnguge L, opertors O) Sttement of plnning prolem: triple P=(O,s 0,g) O is the olletion of opertors s 0 is stte (the initil stte) g is set of literls (the gol formul) The tul plnning prolem: P = (Σ,s 0, g) s 0 n g re s ove Σ = (S,A,γ) is stte-trnsition system S = {ll sets of groun toms in L} A = {ll groun instnes of opertors in O} γ = stte-trnsition funtion etermine y the opertors 18 19 Plns n Solutions Pln: ny sequene of tions σ = 1, 2,, n suh tht eh i is groun instne of n opertor in O The pln is solution for P=(O,s 0,g) if it is exeutle n hieves g i.e., if there re sttes s 0, s 1,, s n suh tht γ (s 0, 1 ) = s 1 γ (s 1, 2 ) = s 2 γ (s n 1, n ) = s n s n stisfies g Exmple Let P 1 = (O, s 1, g 1 ), where O is the set of opertors given erlier g 1 ={loe(r1,3), t(r1,lo2)} 20 21
22 Exmple (ont.) Exmple (ont.) Here re three solutions for P 1 : tke(rne1,lo1,3,1,p1), move(r1,lo2,lo1), move(r1,lo1,lo2), move(r1,lo2,lo1), lo(rne1,lo1,3,r1), move(r1,lo1,lo2) tke(rne1,lo1,3,1,p1), move(r1,lo2,lo1), lo(rne1,lo1,3,r1), move(r1,lo1,lo2) move(r1,lo2,lo1), tke(rne1,lo1,3,1,p1), lo(rne1,lo1,3,r1), move(r1,lo1,lo2) Eh of them proues the stte shown here: First is reunnt: n remove tions n still hve solution tke(rne1,lo1,3,1,p1), move(r1,lo2,lo1), move(r1,lo1,lo2), move(r1,lo2,lo1), lo(rne1,lo1,3,r1), move(r1,lo1,lo2) tke(rne1,lo1,3,1,p1), move(r1,lo2,lo1), lo(rne1,lo1,3,r1), move(r1,lo1,lo2) move(r1,lo2,lo1), tke(rne1,lo1,3,1,p1), lo(rne1,lo1,3,r1), move(r1,lo1,lo2) The 2n n 3r re irreunnt n shortest 23 2. Set-Theoreti Representtion Inste of opertors like this one, Like lssil representtion, ut restrite to propositionl logi Sttes: Inste of olletion of groun toms {on(1,pllet), on(1,r1), on(1,2),, t(r1,l1), t(r1,l2), } use olletion of propositions (oolen vriles): {on-1-pllet, on-1-r1, on-1-2,, t-r1-l1, t-r1-l2, } tke ll of the opertor instnes, e.g., this one, n rewrite groun toms s propositions tke-rne1-lo1-3-1-p1 preon: elong-rne1-lo1, tthe-p1-lo1, empty-rne1, top-3-p1, on-3-1 elete: empty-rne1, in-3-p1, top-3-p1, on-3-p1 : holing-rne1-3, top-1-p1 24 25 Comprison A set-theoreti representtion is equivlent to lssil representtion in whih ll of the toms re groun Prolem: Exponentil lowup If lssil opertor ontins n toms n eh tom hs rity k, then it orrespons to nk tions where = {onstnt symols} 3. Stte-Vrile Representtion Non-fluents (properties tht on t hnge) re groun reltions: e.g., jent(lo1,lo2) Fluents re funtions: i.e., for properties tht n hnge, ssign vlues to stte vriles Clssil n stte-vrile rep ns tke similr mounts of spe eh n e trnslte into the other in low-orer polynomil time {top(p1)=3, pos(3)=1, pos(1)=pllet, holing(rne1)=nil, rlo(r1)=lo2, loe(r1)=nil, } 26 27
28 Exmple: The Bloks Worl Infinitely wie tle, finite numer of hilren s loks Ignore where lok is lote on the tle A lok n sit on the tle or on nother lok Wnt to move loks from one onfigurtion to nother e.g., initil stte e gol Clssil, set-theoreti, n stte-vrile formultions for the se of FIVE BLOCKS follow. 1. Exmple Clssil Representtion Constnt symols: The loks:,,,, e Preites: ontle(x) - lok x is on the tle on(x,y) - lok x is on lok y ler(x) - lok x hs nothing on it holing(x) - the root hn is holing lok x hnempty- the root hn isn t holing nything e 29 Clssil Opertors unstk(x,y) Preon: on(x,y), ler(x), hnempty Effets: ~on(x,y), ~ler(x), ~hnempty, holing(x), ler(y) stk(x,y) Preon: holing(x), ler(y) Effets: ~holing(x), ~ler(y), on(x,y), ler(x), hnempty pikup(x) Preon: ontle(x), ler(x), hnempty Effets: ~ontle(x), ~ler(x), ~hnempty, holing(x) putown(x) Preon: holing(x) Effets: ~holing(x), ontle(x), ler(x), hnempty 30 2. Exmple Set-Theoreti Representtion For five loks, 36 propositions, 50 tions E.g., ontle- - lok is on the tle on-- - lok is on lok ler- - lok hs nothing on it holing- - the root hn is holing lok hnempty - the root hn isn t holing nything (31 more) e 31 Set-Theoreti Ations E.g., unstk-- Pre: on-,, ler-, hnempty Del: on-,, ler-, hnempty A: holing-, ler- stk-- Pre: holing-, ler- Del: holing-, ler- A: on--, ler-, hnempty pikup- Pre: ontle-, ler-, hnempty Del: ontle-, ler-, hnempty A: holing- putown- Pre: holing- Del: holing- A: ontle-, ler-, hnempty 3. Exmple Stte-Vrile Representtion Constnt symols:,,,, e of type lok 0, 1, tle, nil of type other Stte vriles: pos(x) = y if lok x is on lok y e pos(x) = tle if lok x is on the tle pos(x) = nil if lok x is eing hel ler(x) = 1 if lok x hs nothing on it ler(x) = 0 if lok x is eing hel or hs lok on it holing = x if the root hn is holing lok x holing = nil if the root hn is holing nothing... (46 more) 32 33
34 Stte-Vrile Opertors unstk(x : lok, y : lok) Preon: pos(x)=y, ler(y)=0, ler(x)=1, holing=nil Effets: pos(x)=nil, ler(x)=0, holing=x, ler(y)=1 stk(x : lok, y : lok) Preon: holing=x, ler(x)=0, ler(y)=1 Effets: holing=nil, ler(y)=0, pos(x)=y, ler(x)=1 pikup(x : lok) Preon: pos(x)=tle, ler(x)=1, holing=nil Effets: pos(x)=nil, ler(x)=0, holing=x putown(x : lok) Preon: holing=x Effets: holing=nil, pos(x)=tle, ler(x)=1 Representtionl Equivlene Any prolem tht n e represente in one representtion n lso e represente in the other two Cn onvert in liner time n spe, exept when onverting to set-theoreti (where we get n exponentil lowup) Set-theoreti representtion trivil write ll of the groun instnes Clssil representtion P(x 1,,x n ) eomes f P (x 1,,x n )=1 Stte-vrile representtion f(x 1,,x n )=y eomes P f (x 1,,x n,y) 35 Comprison Clssil representtion Most populr for lssil plnning, sis of PDDL Set-theoreti representtion Cn tke muh more spe thn lssil representtion Useful in lgorithms tht mnipulte groun toms iretly e.g., plnning grphs, SAT Useful for ertin kins of theoretil stuies Stte-vrile representtion Equivlent to lssil representtion in expressive power Less nturl for logiins, more nturl for engineers Useful in non-lssil plnning prolems s wy to hnle numers, funtions, time Riher Speifition Lnguges: ADL The previous representtions were so-lle STRIPS representtions. ADL is riher, n thus more ompt, representtion lnguge tht llows for Disjuntion n Quntifition in preonitions n gols Effets tht re Quntifie, n/or Conitionl (effet is onitione on stte) PDDL supports STRIPS n ADL, ut not ll plnners support ADL, n not ll plnners even support so-lle Clssil Representtion 36 50 Compiling to Cnonil Ation Rep n PROS & CONS: It is possile to ompile own ADL tions into STRIPS tions Quntifition is written s onjuntions/isjuntions over finite universes Ations with onitionl effets re ompile into multiple (exponentilly more) tions without onitionl effets Ations with isjuntive effets re ompile into multiple tions, eh of whih tke one of the isjunts s their preonitions (Domin xioms n e ompile own into the iniviul effets of the tions; so ll tions stisfy STRIPS ssumption) Compiltion is not lwys win-win. By ompiling own to nonil form, we n onentrte on highly effiient plnning for nonil tions However, often ompiltion les to n exponentil lowup n mkes it hrer to exploit the struture of the omin By leving tions in non-nonil form, we n often o more ompt enoing of the omins s well s more effiient serh However, we will hve to ontinully exten plnning lgorithms to hnle these representtions 51