Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Lecture 12 example (from slides prepared by Prof. J. Rosenchein)

Similar presentations


Presentation on theme: "1 Lecture 12 example (from slides prepared by Prof. J. Rosenchein)"— Presentation transcript:

1 1 Lecture 12 example (from slides prepared by Prof. J. Rosenchein)

2 2 STRIPS Planning: the basic idea Place goal on goal stack: Goal1 Considering top Goal1, place onto it its subgoals: Goal1 GoalS1-2 GoalS1-1 Then try to solve subgoal GoalS1-2, and continue…

3 3 Stack Manipulation Rules If on top of goal stack:Then do: Compound or single goal matching the current state description. Remove it. Compound goal not matching the current state description. 1. Keep original compound goal on stack; 2. List the unsatisfied component goals on the stack in some new order. Single-literal goal not matching the current state description. Find rule whose instantiated add-list includes the goal, and 1. Replace the goal with the instantiated rule; 2. Place the rule’s instantiated precondition formula on top of stack Rule 1. Remove rule from stack; 2. Update database using rule; 3. Keep track of rule (for solution) NothingStop

4 4 Detailed example a c b a c b start: goal 1. Place on stack original goal: Stack: on(a,c) on(c,b) clear(b) on(c,a) clear(c) ontable(a) ontable(b) handempty Database:

5 5 2. Since top goal is unsatisfied compound goal, list its unsatisfied subgoals on top of it: Stack: on(a,c) on(c,b) on(a,c) on(c,b) clear(b) on(c,a) clear(c) ontable(a) ontable(b) handempty Database (unchanged):

6 6 3. Since top goal is unsatisfied single- literal goal, find rule whose instantiated add-list includes the goal, and: a. Replace the goal with the instantiated rule; b. Place the rule’s instantiated precondition formula on top of stack Stack: on(a,c) on(c,b) on(a,c) stack(c,b) holding(c) clear(b) clear(b) on(c,a) clear(c) ontable(a) ontable(b) handempty Database (unchanged):

7 7 4. Since top goal is unsatisfied compound goal, list its subgoals on top of it: Stack: on(a,c) on(c,b) on(a,c) stack(c,b) holding(c) clear(b) holding(c) clear(b) on(c,a) clear(c) ontable(a) ontable(b) handempty Database (unchanged):

8 8 5. Single goal on top of stack matches data base, so remove it: Stack: on(a,c) on(c,b) on(a,c) stack(c,b) holding(c) clear(b) holding(c) clear(b) on(c,a) clear(c) ontable(a) ontable(b) handempty Database (unchanged):

9 9 6. Since top goal is unsatisfied single- literal goal, find rule whose instantiated add-list includes the goal, and: a. Replace the goal with the instantiated rule; b. Place the rule’s instantiated precondition formula on top of stack on(c,a)  clear(c)  handempty Stack: on(a,c) on(c,b) on(a,c) stack(c,b) holding(c) clear(b) unstack(c) Database: (unchanged)

10 10 7. Compound goal on top of stack matches data base, so remove it: clear(b) on(c,a) clear(c) ontable(a) ontable(b) handempty Database (unchanged): Stack: on(a,c) on(c,b) on(a,c) stack(c,b) holding(c) clear(b) unstack(c)

11 11 8. Top item is rule, so: a. Remove rule from stack; b. Update database using rule; c. Keep track of rule (for solution) Stack: on(a,c) on(c,b) on(a,c) stack(c,b) holding(c) clear(b) clear(b) ontable(a) ontable(b) holding(c) clear(a) Database: Solution: {unstack(c)}

12 12 9. Compound goal on top of stack matches data base, so remove it: Stack: on(a,c) on(c,b) on(a,c) stack(c,b) clear(b) ontable(a) ontable(b) holding(c) clear(a) Database (unchanged): Solution: {unstack(c)}

13 13 10. Top item is rule, so: a. Remove rule from stack; b. Update database using rule; c. Keep track of rule (for solution) Stack: on(a,c) on(c,b) on(a,c) ontable(a) ontable(b) handempty clear(a) clear(c) on(c,b) Database: Solution: {unstack(c), stack(c,b)}

14 14 11. Since top goal is unsatisfied single- literal goal, find rule whose instantiated add-list includes the goal, and: a. Replace the goal with the instantiated rule; b. Place the rule’s instantiated precondition formula on top of stack Stack: on(a,c) on(c,b) stack(a,c) ontable(a) ontable(b) handempty clear(a) clear(c) on(c,b) Database (unchanged): Solution: {unstack(c), stack(c,b)} holding(a) clear(c)

15 15 12. Since top goal is unsatisfied compound goal, list its unsatisfied subgoals on top of it: Stack: on(a,c) on(c,b) stack(a,c) ontable(a) ontable(b) handempty clear(a) clear(c) on(c,b) Database (unchanged): holding(a) clear(c) holding(a) Solution: {unstack(c), stack(c,b)}

16 16 13. Since top goal is unsatisfied single-literal goal, find rule whose instantiated add-list includes the goal, and: a. Replace the goal with the instantiated rule; b. Place the rule’s instantiated precondition formula on top of stack Stack: on(a,c) on(c,b) stack(a,c) holding(a) clear(c) pickup(a) ontable(a)  clear(a)  handempty Database: (unchanged) Solution: {unstack(c), stack(c,b)}

17 17 14. Compound goal on top of stack matches data base, so remove it: Stack: on(a,c) on(c,b) stack(a,c) holding(a) clear(c) pickup(a) ontable(a) ontable(b) handempty clear(a) clear(c) on(c,b) Database (unchanged): Solution: {unstack(c), stack(c,b)}

18 18 15. Top item is rule, so: a. Remove rule from stack; b. Update database using rule; c. Keep track of rule (for solution) Stack: on(a,c) on(c,b) stack(a,c) holding(a) clear(c) ontable(b) on(c,b) clear(c) holding(a) Database: Solution: {unstack(c), stack(c,b), pickup(a)}

19 19 16. Compound goal on top of stack matches data base, so remove it: Stack: on(a,c) on(c,b) stack(a,c) ontable(b) on(c,b) clear(c) holding(a) Database (unchanged): Solution: {unstack(c), stack(c,b), pickup(a)}

20 20 17. Top item is rule, so: a. Remove rule from stack; b. Update database using rule; c. Keep track of rule (for solution) Stack: on(a,c) on(c,b) ontable(b) on(c,b) on(a,c) clear(a) handempty Database: Solution: {unstack(c), stack(c,b), pickup(a), stack(a,c)}

21 21 18. Compound goal on top of stack matches data base, so remove it: Stack: ontable(b) on(c,b) on(a,c) clear(a) handempty Database (unchanged): Solution: {unstack(c), stack(c,b), pickup(a), stack(a,c)} 19. Stack is empty, so stop.

22 22 Example revisited a c b a c b start goal: In solving this problem, we took some shortcuts—we branched in the right direction every time. In practice, searching can be guided by: 1. Heuristic information (e.g., try to achieve “holding(X)” last) 2. Detecting unprofitable paths (e.g., when the newest goal set has become a superset of the original goal set) 3. Considering useful operator side effects (by scanning down the stack).

23 23 Sometimes even this doesn’t help… a c b a c b i:g: on(c,a) ontable(a) ontable(b) armempty on(a,b) on(b,c) It could try on(b,c) first, then on(a,b) —but it will find that the first goal has been undone. So the first goal will be added back onto the stack and solved.

24 24 The final sequence is inefficient: a c b start pickup(b) stack(b,c) unstack(b,c) putdown(b) unstack(c,a) putdown(c) pickup(a) stack(a,b) unstack(a,b) putdown(a) pickup(b) stack(b,c) pickup(a) stack(a,b) a c b 1. Trying the goals in the other order doesn’t help much. 2. We can remove adjacent operators that undo each other. goal

25 25 What we really want is to: 1. Begin work on on(a,b) by clearing a (i.e., putting c on table) 2. Achieve on(b,c) by stacking b on c 3. Achieve [finish] on(a,b) by stacking a on b. a c b a c b goal We couldn’t do this using a stack, but we can if we use a set of goals. start

26 26 Backward Nonlinear Planning Plan from the goal set using STRIPS rules in the backward direction… on(b,c) on(a,b) holding(a) clear(b) on(b,c) holding(b) clear(c) on(a,b) ontable(a) clear(a) handempty on(b,c) clear(b) holding(b) clear(c) holding(a) clear(b) handempty clear(x) on(x,b) on(b,c) holding(a) handempty clear(a) on(a,b) on(b,c) stack(b,c) stack(a,b) pickup(a) stack(b,c) unstack(x,b) unstack(a,b) x = impossible condition xx = superset of original set x xxxx preconditions

27 27 Eventually we get back to our initial state, having found our plan operators “backwards” But we left out one detail: REGRESSION. What we had been doing was copying the whole goal set to the new node (with just one goal being replaced by the operator’s preconditions): ex: on(a,b) on(b,c) clear(b) holding(a) on(b,c) stack(a,b)

28 28 The asumption is that stack(a,b) doesn’t affect on(b,c), which is correct; but the assumption isn’t always true: ontable(a) clear(a) handempty on(b,c) clear(b) ontable(a) on(X,a) clear(X) false on(b,c) clear(b) unstack(X,a) There’s no way we can have handempty immediately after an unstack.

29 29 So instead of directly copying the “non-selected” goals into the goal set, we apply REGRESSION. “When we regress a goal through an operator, we are trying to determine what must be true before the operator is performed in order for the goal to be satisfied afterward.” regression[on(a,b), pickup(c)]=on(a,b) regression[on(a,b), stack(a,b)]=true regression[handempty,pickup(a)]=false Ex:

30 30 General rule for STRIPS operators (G=goal, O=operator): G regressed through O is 1. true if G is part of O’s add-list 2. false if G is part of O’s delete-list 3. G otherwise. If using G’s and O’s with uninstantiated variables, replace G by G[u] and O by O[u] above, where u is a substitution instance. Goal sets with false can never be satisfied. A specific goal that regresses to true can be removed from the goal set.

31 31 Regressing through incompletely instantiated rules Ex: unstack(X,Y) P & D: handempty, clear(X), on(X,Y) A: holding(X), clear(Y) Consider the case of regressing through unstack(b,Y): 1. Regressing holding(b) yields true 2. Regressing handempty yields false 3. Regressing ontable(c) yields ontable(c) 4. Regressing clear(Y) yields (Y= c) clear(c); i.e., we produce two alternative sub-goal expressions, one with the preconditions of unstack(b,c), the other with the uninstantiated preconditions of unstack(b,Y) conjoined with ~(Y = c)

32 32 Example of regression planning

33 33

34 34


Download ppt "1 Lecture 12 example (from slides prepared by Prof. J. Rosenchein)"

Similar presentations


Ads by Google