Last update: May 1, 2020 Chapter 2 Deliberation with Deterministic Models 2.3: Heuristic Functions Automated Planning 2.4: Backward Search and Acting 2.5: Plan-Space Search Malik Ghallab, Dana Nau and Paolo Traverso Dana S. Nau http://www.laas.fr/planning University of Maryland Nau – Lecture slides for Automated Planning and Acting Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License 1
Outline 2.1 State-variable representation 2.2 Forward state-space search 2.6 Incorporating planning into an actor 2.3 Heuristic functions How to guide a forward state-space search 2.4 Backward search 2.5 Plan-space search Nau – Lecture slides for Automated Planning and Acting 2
Problem Relaxation ● Given: planning problem P in domain Σ ● One way to create a heuristic function: ▸ Weaken some of the constraints, get additional solutions ▸ Relaxed planning domain Σ′ and relaxed problem P′ = ( Σ′,s 0 ,g′ ) such that • every solution for P is also a solution for P′ • additional solutions with lower cost ▸ Suppose we have an algorithm A for solving planning problems in Σ′ • Heuristic function h A ( s ) for P : ▸ Find a solution π′ for (Σ′, s , g′ ); return cost(π′) ▸ Useful if A runs quickly • If A always finds optimal solutions, then h A is admissible Nau – Lecture slides for Automated Planning and Acting 3
Example ● Relaxation: let vehicle travel in a straight line between any pair of cities ▸ straight-line-distance ≤ distance by road ⇒ additional solutions with lower cost straight-line dist. Oradea from s to Bucharest 71 Arad 366 Neamt 87 Zerind Bucharest 0 151 75 Craiova 160 Iasi Dobreta 242 Arad 140 Fagaras 176 92 Sibiu Fagaras 99 Iasi 226 118 Lugoj 244 Vaslui 80 Mehadia 241 Rimnicu Vilcea Timisoara Neamt 234 142 Oradea 380 211 Pitesti 100 111 PitesF 97 Lugoj Rimnicu Vilcea 193 70 85 Sibiu 253 Urziceni 146 Mehadia Timisoara 329 75 138 Urziceni 80 Bucharest Vaslui 199 120 Dobreta Zerind 374 Craiova Nau – Lecture slides for Automated Planning and Acting 4
Domain-independent Heuristics ● Heuristic functions that can be used in any classical planning problem ▸ Additive-cost heuristic In the book, but I’ll skip them ▸ Max-cost heuristic ▸ Delete-relaxation heuristics • Optimal relaxed solution • Fast-forward heuristic ▸ Landmark heuristics Nau – Lecture slides for Automated Planning and Acting 5
2.3.2 Delete-Relaxation ● Relaxation: ▸ A state variable can have more than one value at the same time ▸ When assigning a new value, keep the old one too ● Suppose state s includes an atom x=v , action a has effect x ← w ▸ γ + ( s,a ) is a relaxed state ▸ Includes both x=v and x=w r1 r1 d3 d3 c1 c1 d1 d2 d1 d2 s 0 = { loc(r1) = d3, ŝ 1 = γ + ( s 0 , move ( r1,d3,d1 )) move ( r1, d3, d1 ) cargo(r1) = nil, = { loc(r1) = d3, loc(r1) = d1, pre: loc(r1) = d3 loc(c1) = d1 } cargo(r1) = nil, eff: loc(r1) ← d1 loc(c1) = d1 } Nau – Lecture slides for Automated Planning and Acting 6
Relaxed States ● Relaxed state (or r-state ): ▸ a set ŝ of ground atoms that includes at least 1 value for each state variable ▸ represents {all states that are subsets of ŝ } ● Note: every state s is also a relaxed state that represents { s } r1 d3 { loc(r1) = d1, loc(r1) = d3, cargo(r1) = nil, loc(c1) = d1 } c1 d1 d2 r1 { loc(r1)=d1, loc(r1)=d3, d3 cargo(r1)=nil , loc(c1)=r1, loc(c1)=d1, cargo(r1)=c1 } c1 d1 d2 Nau – Lecture slides for Automated Planning and Acting 7
Relaxed States ● Relaxed state (or r-state ): ▸ a set ŝ of ground atoms that includes at least 1 value for each state variable ▸ represents {all states that are subsets of ŝ } ● Note: every state s is also a relaxed state that represents { s } Poll : would the following definition be equivalent? ● Action a is r-applicable in ŝ if • Action a is r-applicable in ŝ if ŝ contains a subset that ŝ satisfies a ’s preconditions satisfies a ’s preconditions 1. Yes ▸ If a is r-applicable then γ + ( ŝ,a ) = ŝ ∪ γ ( s,a ) 2. No ● π = ⟨ a 1 , …, a n ⟩ is r-applicable in ŝ 0 if there are r-states ŝ 1 , ŝ 2 , …, ŝ n such that • a 1 is r-applicable in ŝ 0 and γ + ( ŝ 0 ,a 1 ) = ŝ 1 • a 2 is r-applicable in ŝ 1 and γ + ( ŝ 1 ,a 2 ) = ŝ 2 • … ▸ In this case, γ + ( ŝ,π ) = ŝ n Nau – Lecture slides for Automated Planning and Acting 8
Example r1 d3 ŝ 0 = s 0 = { loc(r1)=d3, cargo(r1)=nil, loc(c1)=d1 } move ( r1, d3, d1 ) load ( r, c, l ) c1 d1 d2 pre: loc(r1) = d3 pre: cargo ( r )= nil , loc ( c )= l , loc ( r )= l eff: loc(r1) ← d1 eff: cargo ( r )← c , loc ( c )← r r1 ŝ 1 = γ + ( s 0 , move ( r1,d3,d1 )) move ( r, d, e ) d3 = { loc(r1) = d1, loc(r1) = d3, pre: loc ( r )= d cargo(r1) = nil, loc(c1) = d1 } eff: loc ( r )← e c1 d1 d2 load ( r1,c1,d1 ) unload ( r, c, l ) pre: cargo(r1)=nil , loc(c1)=d1 , loc ( r1)=d1 eff: cargo(r1) ← c1 , loc(c1) ← r1 pre: loc ( c )= r , loc ( r )= l eff: cargo ( r )← nil , loc ( c )← l r1 ŝ 2 = γ + ( s 1 , load ( r1,c1,d1 )) d3 = { loc(r1)=d1, loc(r1)=d3, cargo(r1)=nil , loc(c1)=r1, c1 loc(c1)=d1, cargo(r1)=c1 } d1 d2 Nau – Lecture slides for Automated Planning and Acting 9
Relaxed Solution Why a subset, rather than ŝ itself? ● Planning problem P = (Σ, s 0 , g ) ▸ An r-state ŝ r-satisfies g if a subset of ŝ satisfies g ● π is a relaxed solution for P = (Σ, s 0 , g ) if γ + ( s 0 ,π) r-satisfies g s 0 = { loc(r1)=d3, move ( r1, d3, d1 ) cargo(r1)=nil, r1 c1 pre: loc(r1) = d3 r1 eff: loc(r1) ← d1 loc(c1)=d1 } d3 d3 g = { loc(r1)=d3, loc(c1)=r1 } load ( r1,c1,d1 ) c1 d1 d2 pre: cargo(r1)=nil , loc(c1)=d1 , loc ( r1)=d1 eff: cargo(r1) ← c1 , loc(c1) ← r1 π = ⟨ move ( r1,d3,d1 ), load ( r1,c1,d1 ) ⟩ r1 d3 γ + ( s 0 , π ) = { loc(r1)=d1, loc(r1)=d3, c1 cargo(r1)=nil , loc(c1)=r1, d1 d2 loc(c1)=d1, cargo(r1)=c1 } Nau – Lecture slides for Automated Planning and Acting 10
Optimal Relaxed Solution Heuristic ● Planning problem P = (Σ, s 0 , g ) ● Optimal relaxed solution heuristic: ▸ h + ( s ) = minimum cost of all relaxed solutions for (Σ, s , g ) s 0 = { loc(r1)=d3, move ( r1, d3, d1 ) cargo(r1)=nil, r1 c1 pre: loc(r1) = d3 r1 eff: loc(r1) ← d1 loc(c1)=d1 } d3 d3 g = { loc(r1)=d3, loc(c1)=r1 } load ( r1,c1,d1 ) c1 d1 d2 pre: cargo(r1)=nil , loc(c1)=d1 , loc ( r1)=d1 eff: cargo(r1) ← c1 , loc(c1) ← r1 Poll : is h + admissible? ▸ π = ⟨ move ( r1,d3,d1 ), load ( r1,c1,d1 ) ⟩ 1. Yes • cost(π) = 2 2. No ▸ No less-costly relaxed solution, so h + ( s 0 ) = 2 Nau – Lecture slides for Automated Planning and Acting 11
Example Poll : What is h + ( s 1 )? 1. 1 4. 4 r1 r1 c1 2. 2 5. other s 0 = { loc(r1)=d3, d3 d3 3. 3 cargo(r1)=nil, g = { loc(r1)=d3, loc(c1)=r1 } loc(c1)=d1 } c1 d1 d2 load ( r, c, l ) a 1 = move(r1,d3,d1) ● Two applicable actions pre: cargo ( r )= nil , loc ( c )= l , s 1 = γ( s 0 , a 1 ) loc ( r )= l Ø a 1 , a 2 = { loc(r1) = d1, d3 ● Resulting states: eff: cargo ( r )← c , loc ( c )← r cargo(r1) = nil, r1 loc(c1) = d1 } Ø s 1 , s 2 c1 d1 d2 move ( r, d, e ) ● Run GBFS with h + pre: loc ( r )= d a 2 = move(r1,d3,d2) Ø Choose a 1 eff: loc ( r )← e s 2 = γ( s 0 , a 2 ) if h + ( s 1 ) < h + ( s 2 ) d3 = { loc(r1) = d2, Ø Choose a 2 unload ( r, c, l ) cargo(r1) = nil, r1 if h + ( s 2 ) < h + ( s 1 ) loc(c1) = d1 } pre: loc ( c )= r , loc ( r )= l c1 d1 d2 eff: cargo ( r )← nil , loc ( c )← l Nau – Lecture slides for Automated Planning and Acting 12
Example Poll : What is h + ( s 2 )? r1 r1 c1 s 0 = { loc(r1)=d3, 1. 1 4. 4 d3 d3 cargo(r1)=nil, 2. 2 5. other g = { loc(r1)=d3, loc(c1)=r1 } loc(c1)=d1 } 3. 3 c1 d1 d2 load ( r, c, l ) a 1 = move(r1,d3,d1) ● Two applicable actions pre: cargo ( r )= nil , loc ( c )= l , s 1 = γ( s 0 , a 1 ) loc ( r )= l Ø a 1 , a 2 = { loc(r1) = d1, d3 ● Resulting states: eff: cargo ( r )← c , loc ( c )← r cargo(r1) = nil, r1 loc(c1) = d1 } Ø s 1 , s 2 c1 d1 d2 move ( r, d, e ) ● Run GBFS with h + pre: loc ( r )= d a 2 = move(r1,d3,d2) Ø Choose a 1 eff: loc ( r )← e s 2 = γ( s 0 , a 2 ) if h + ( s 1 ) < h + ( s 2 ) d3 = { loc(r1) = d2, Ø Choose a 2 unload ( r, c, l ) cargo(r1) = nil, r1 if h + ( s 2 ) < h + ( s 1 ) loc(c1) = d1 } pre: loc ( c )= r , loc ( r )= l c1 d1 d2 eff: cargo ( r )← nil , loc ( c )← l Nau – Lecture slides for Automated Planning and Acting 13
Example Poll : What action does GBFS choose? r1 r1 c1 1. a 1 s 0 = { loc(r1)=d3, d3 d3 cargo(r1)=nil, 2. a 2 g = { loc(r1)=d3, loc(c1)=r1 } loc(c1)=d1 } 3. don’t know c1 d1 d2 load ( r, c, l ) a 1 = move(r1,d3,d1) ● Two applicable actions pre: cargo ( r )= nil , loc ( c )= l , s 1 = γ( s 0 , a 1 ) loc ( r )= l Ø a 1 , a 2 = { loc(r1) = d1, d3 ● Resulting states: eff: cargo ( r )← c , loc ( c )← r cargo(r1) = nil, r1 loc(c1) = d1 } Ø s 1 , s 2 c1 d1 d2 move ( r, d, e ) ● Run GBFS with h + pre: loc ( r )= d a 2 = move(r1,d3,d2) Ø Choose a 1 eff: loc ( r )← e s 2 = γ( s 0 , a 2 ) if h + ( s 1 ) < h + ( s 2 ) d3 = { loc(r1) = d2, Ø Choose a 2 unload ( r, c, l ) cargo(r1) = nil, r1 if h + ( s 2 ) < h + ( s 1 ) loc(c1) = d1 } pre: loc ( c )= r , loc ( r )= l c1 d1 d2 eff: cargo ( r )← nil , loc ( c )← l Nau – Lecture slides for Automated Planning and Acting 14
Recommend
More recommend