CSE 3402: Intro to Artificial Intelligence CSE 3402: Intro to Artificial Intelligence CWA CWA Planning Planning ● Readings: Russell & Norvig 3 rd edition ● “Classical Planning”. No incomplete or Chapter 10 (in 2 nd edition, Sections 11.1, uncertain knowledge. 11.2, and 11.4) ● Use the “Closed World Assumption” in our knowledge representation and reasoning. ■ The Knowledge base used to represent a state of the world is a list of positive ground atomic facts list of positive ground atomic facts. ■ CWA is the assumption that a) if a ground atomic fact is not in our list of “known” facts, its negation must be true. b) the constants mentioned in KB are all the domain objects. 1 1 2 2 CSE 3402 W10 Fahiem Bacchus & Yves Lesperance CSE 3402 W10 Fahiem Bacchus & Yves Lesperance CWA CWA CWA Example CWA Example ● CWA makes our knowledge base much like KB = {handempty a database: if employed(John,CIBC) is not in clear(c), clear(b), on(c,a), the database, we conclude that ontable(a), ontable(b)} ¬ employed(John, CIBC) is true. 1. clear(c) ∧ clear(b)? C 2. ¬ on(b,c)? 3. on(a,c) ∨ on(b,c)? A B 4. ∃ X.on(X,c)? (D = {a,b,c}) 5. ∀ X.ontable(X) → X = a ∨ X = b? 3 3 4 4 CSE 3402 W10 Fahiem Bacchus & Yves Lesperance CSE 3402 W10 Fahiem Bacchus & Yves Lesperance 1
Querying a Closed World KB Querying a Closed World KB Querying A CW KB Querying A CW KB ● With the CWA, we can evaluate the truth or Query(F, KB) /*return whether or not KB |= F */ falsity of arbitrarily complex first-order formulas. if F is atomic return(F ∈ KB) ● This process is very similar to query evaluation in databases. ● Just as databases are useful, so are CW KB’s. 5 5 6 6 CSE 3402 W10 Fahiem Bacchus & Yves Lesperance CSE 3402 W10 Fahiem Bacchus & Yves Lesperance Querying A CW KB Querying A CW KB Querying A CW KB Querying A CW KB if F = F 1 ∧ F 2 if F = ∃ X.F 1 return(Query(F 1 ) && Query(F 2 )) for each constant c ∈ KB if (Query(F 1 {X=c})) return(true) if F = F 1 ∨ F 2 return(false). return(Query(F 1 ) || Query(F 2 )) if F = ∀ X.F 1 if F = ¬ F 1 for each constant c ∈ KB return(! Query(F 1 )) if (!Query(F 1 {X=c})) return(false) if F = F 1 → F 2 return(true). return(!Query(F 1 ) || Query(F 2 )) 7 7 8 8 CSE 3402 W10 Fahiem Bacchus & Yves Lesperance CSE 3402 W10 Fahiem Bacchus & Yves Lesperance 2
Querying A CW KB Querying A CW KB Querying A CW KB Querying A CW KB Guarded quantification (for efficiency). Guarded quantification (for efficiency). ∀ X:[p(X)] F 1 ↔ ∀ X: p(X) → F 1 if F = ∀ X.F 1 for each constant c s.t. p(c) for each constant c ∈ KB if (!Query(F 1 {X=c})) if (!Query(F 1 {X=c})) return(false) return(false) return(true). return(true). ∃ X:[p(X)]F 1 ↔ ∃ X: p(X) ∧ F 1 E.g., consider checking for each constant c s.t. p(c) ∀ X. apple(x) → sweet(x) if (Query(F 1 {X=c})) return(true) we already know that the formula is true for all “non- return(false). apples” 9 9 10 10 CSE 3402 W10 Fahiem Bacchus & Yves Lesperance CSE 3402 W10 Fahiem Bacchus & Yves Lesperance STRIPS representation. STRIPS representation. Sequences of Worlds Sequences of Worlds ● STRIPS (Stanford Research Institute Problem ● In the situation calculus where in one logical Solver.) is a way of representing actions. sentence we could refer to two different situations at the same time. ● Actions are modeled as ways of modifying the world. ■ on(a,b,s 0 ) ∧ ¬ on(a,b,s 1 ) ■ since the world is represented as a CW-KB, a ● In STRIPS, we would have two separate CW- STRIPS action represents a way of updating the KB’s. One representing the initial state, and CW-KB. another one representing the next state (much ■ Now actions yield new KB’s, describing the new like search where each state was represented in world—the world as it is once the action has a separate data structure). been executed. 11 11 12 12 CSE 3402 W10 Fahiem Bacchus & Yves Lesperance CSE 3402 W10 Fahiem Bacchus & Yves Lesperance 3
STRIPS Actions STRIPS Actions STRIPS Actions: Example STRIPS Actions: Example ● STRIPS represents actions using 3 lists. pickup(X): 1. A list of action preconditions. Pre: {handempty, clear(X), ontable(X)} 2. A list of action add effects. Adds: {holding(X)} 3. A list of action delete effects. Dels: {handempty, clear(X), ontable(X)} ● These lists contain variables, so that we can represent a whole class of actions with one “pickup(X)” is called a STRIPS operator. specification. a particular instance e.g. ● Each ground instantiation of the variables “pickup(a)” is called an action. yields a specific action. 13 13 14 14 CSE 3402 W10 Fahiem Bacchus & Yves Lesperance CSE 3402 W10 Fahiem Bacchus & Yves Lesperance Operation of a STRIPS action. Operation of a STRIPS action. Operation of a Strips Action: Example Operation of a Strips Action: Example ● For a particular STRIPS action (ground instance) to be applicable to a state (a CW-KB) B pickup(b) C C ■ every fact in its precondition list must be true in KB. A ● This amounts to testing membership since we A B have only atomic facts in the precondition list. add = {holding(b)} ● If the action is applicable, the new state is pre = {handmpty, del = {handmpty, clear(b), clear(b), generated by ontable(b)} ontable(b)} ■ removing all facts in Dels from KB, then KB = { holding(b), KB = {handempty ■ adding all facts in Adds to KB. clear(c), clear(b), clear(c), on(c,a), on(c,a), ontable(a), ontable(a)} ontable(b)} 15 15 16 16 CSE 3402 W10 Fahiem Bacchus & Yves Lesperance CSE 3402 W10 Fahiem Bacchus & Yves Lesperance 4
STRIPS Blocks World Operators. STRIPS Blocks World Operators. STRIPS Blocks World Operators. STRIPS Blocks World Operators. ● pickup(X) ● unstack(X,Y) Pre: {clear(X), ontable(X), handempty} Pre: {clear(X), on(X,Y), handempty} Add: {holding(X)} Add: {holding(X), clear(Y)} Del: {clear(X), ontable(X), handempty} Del: {clear(X), on(X,Y), handempty} ● putdown(X) ● stack(X,Y) Pre: {holding(X)} Pre: {holding(X),clear(Y)} Add: {clear(X), ontable(X), handempty} Add: {on(X,Y), handempty, clear(X)} Del: {holding(X)} Del: {holding(X),clear(Y)} 17 17 18 18 CSE 3402 W10 Fahiem Bacchus & Yves Lesperance CSE 3402 W10 Fahiem Bacchus & Yves Lesperance STRIPS has no Conditional Effects STRIPS has no Conditional Effects Conditional Effects Conditional Effects ● putdown(X) ● Since STRIPS has no conditional effects, we Pre: {holding(X)} must sometimes utilize extra actions: one for Add: {clear(X), ontable(X), handempty} each type of condition. Del: {holding(X)} ● stack(X,Y) ■ We embed the condition in the precondition, and Pre: {holding(X),clear(Y)} then alter the effects accordingly. Add: {on(X,Y), handempty, clear(X)} Del: {holding(X),clear(Y)} ● The table has infinite space, so it is always clear. If we “stack(X,Y)” if Y=Table we cannot delete clear(Table), but if Y is an ordinary block “c” we must delete clear(c). 19 19 20 20 CSE 3402 W10 Fahiem Bacchus & Yves Lesperance CSE 3402 W10 Fahiem Bacchus & Yves Lesperance 5
Other Example Domains Other Example Domains 8-Puzzle 8-Puzzle ● 8 Puzzle as a planning problem ● at(T,P) tile T is at position P. ■ A constant representing each position, P1,…,P9 at(T1,P1), at(T2,P2), 1 2 5 at(T5,P3), … P1 P2 P3 7 8 P4 P5 P6 6 4 3 P7 P8 P9 ● adjacent(P1,P2) P1 is next to P2 (i.e., we can slide the blank from P1 to P2 in one move. ■ A constant for each tile. B,T1, …, T8. ■ adjacent(P5,P2), adjacent(P5,P8), … 21 21 22 22 CSE 3402 W10 Fahiem Bacchus & Yves Lesperance CSE 3402 W10 Fahiem Bacchus & Yves Lesperance 8-Puzzle 8-Puzzle Elevator Control Elevator Control slide(T,X,Y) Pre: {at(T,X), at(B,Y), adjacent(X,Y)} Add: {at(B,X), at(T,Y)} Del: {at(T,X), at(B,Y)} at(T1,P1), at(T5,P3), at(T1,P1), at(T5,P3), at(B,P5), at(T8,P6), …, at(T8,P5), at(B,P6), …, 1 2 5 1 2 5 7 8 7 8 slide(T8,P5,P6) 6 4 3 6 4 3 23 23 24 24 CSE 3402 W10 Fahiem Bacchus & Yves Lesperance CSE 3402 W10 Fahiem Bacchus & Yves Lesperance 6
Recommend
More recommend