340 likes | 439 Views
Lecture 12 example (from slides prepared by Prof. J. Rosenchein). STRIPS Planning: the basic idea. Place goal on goal stack:. Goal1. Considering top Goal1, place onto it its subgoals:. GoalS1-2. GoalS1-1. Goal1. Then try to solve subgoal GoalS1-2, and continue….
E N D
Lecture 12 example(from slides preparedby Prof. J. Rosenchein)
STRIPS Planning: the basic idea Place goal on goal stack: Goal1 Considering top Goal1, place onto it its subgoals: GoalS1-2 GoalS1-1 Goal1 Then try to solve subgoal GoalS1-2, and continue…
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 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. 1. Remove rule from stack; 2. Update database using rule; 3. Keep track of rule (for solution) Rule Nothing Stop
Detailed example start: a goal c c a b b 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:
2. Since top goal is unsatisfied compound goal, list its unsatisfied subgoals on top of it: on(c,b) Stack: on(a,c) on(a,c) on(c,b) clear(b) on(c,a) clear(c) ontable(a) ontable(b) handempty Database (unchanged):
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 holding(c) clear(b) Stack: stack(c,b) on(a,c) on(a,c) on(c,b) clear(b) on(c,a) clear(c) ontable(a) ontable(b) handempty Database (unchanged):
4. Since top goal is unsatisfied compound goal, list its subgoals on top of it: clear(b) holding(c) holding(c) clear(b) Stack: stack(c,b) on(a,c) on(a,c) on(c,b) clear(b) on(c,a) clear(c) ontable(a) ontable(b) handempty Database (unchanged):
5. Single goal on top of stack matches data base, so remove it: holding(c) holding(c) clear(b) Stack: stack(c,b) on(a,c) on(a,c) on(c,b) clear(b) on(c,a) clear(c) ontable(a) ontable(b) handempty Database (unchanged):
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 unstack(c) holding(c) clear(b) Stack: stack(c,b) on(a,c) on(a,c) on(c,b) Database: (unchanged)
7. Compound goal on top of stack matches data base, so remove it: unstack(c) holding(c) clear(b) Stack: stack(c,b) on(a,c) on(a,c) on(c,b) clear(b) on(c,a) clear(c) ontable(a) ontable(b) handempty Database (unchanged):
8. Top item is rule, so: a. Remove rule from stack; b. Update database using rule; c. Keep track of rule (for solution) holding(c) clear(b) Stack: stack(c,b) on(a,c) on(a,c) on(c,b) clear(b) ontable(a) ontable(b) holding(c) clear(a) Database: Solution: {unstack(c)}
9. Compound goal on top of stack matches data base, so remove it: Stack: stack(c,b) on(a,c) on(a,c) on(c,b) clear(b) ontable(a) ontable(b) holding(c) clear(a) Database (unchanged): Solution: {unstack(c)}
10. Top item is rule, so: a. Remove rule from stack; b. Update database using rule; c. Keep track of rule (for solution) on(a,c) Stack: on(a,c) on(c,b) ontable(a) ontable(b) handempty clear(a) clear(c) on(c,b) Database: Solution: {unstack(c), stack(c,b)}
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 holding(a) clear(c) stack(a,c) Stack: on(a,c) on(c,b) ontable(a) ontable(b) handempty clear(a) clear(c) on(c,b) Database (unchanged): Solution: {unstack(c), stack(c,b)}
12. Since top goal is unsatisfied compound goal, list its unsatisfied subgoals on top of it: holding(a) holding(a) clear(c) stack(a,c) Stack: on(a,c) on(c,b) ontable(a) ontable(b) handempty clear(a) clear(c) on(c,b) Database (unchanged): Solution: {unstack(c), stack(c,b)}
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 ontable(a) clear(a) handempty pickup(a) holding(a) clear(c) stack(a,c) Stack: on(a,c) on(c,b) Database: (unchanged) Solution: {unstack(c), stack(c,b)}
14. Compound goal on top of stack matches data base, so remove it: pickup(a) holding(a) clear(c) stack(a,c) Stack: on(a,c) on(c,b) ontable(a) ontable(b) handempty clear(a) clear(c) on(c,b) Database (unchanged): Solution: {unstack(c), stack(c,b)}
15. Top item is rule, so: a. Remove rule from stack; b. Update database using rule; c. Keep track of rule (for solution) holding(a) clear(c) stack(a,c) Stack: on(a,c) on(c,b) ontable(b) on(c,b) clear(c) holding(a) Database: Solution: {unstack(c), stack(c,b), pickup(a)}
16. Compound goal on top of stack matches data base, so remove it: stack(a,c) Stack: on(a,c) on(c,b) ontable(b) on(c,b) clear(c) holding(a) Database (unchanged): Solution: {unstack(c), stack(c,b), pickup(a)}
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)}
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.
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). Example revisited start a goal: c c a b b
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. Sometimes even thisdoesn’t help… a c b a b c on(c,a) ontable(a) ontable(b) armempty on(a,b) on(b,c) i: g:
1. Trying the goals in the other order doesn’t help much. 2. We can remove adjacent operators that undo each other. The final sequence isinefficient: c 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 b start a b c goal
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. What we really want is to: a c b a b c goal start We couldn’t do this using a stack, but we can if we use a set of goals.
Plan from the goal set using STRIPS rules in the backward direction… Backward Nonlinear Planning on(b,c) on(a,b) stack(b,c) stack(a,b) x holding(a) clear(b) on(b,c) holding(b) clear(c) on(a,b) unstack(x,b) pickup(a) unstack(a,b) stack(b,c) x x xx holding(b) clear(c) holding(a) clear(b) ontable(a) clear(a) handempty on(b,c) clear(b) handempty clear(x) on(x,b) on(b,c) holding(a) handempty clear(a) on(a,b) on(b,c) x = impossible condition xx = superset of original set preconditions
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): Eventually we get back to our initial state, having found our plan operators “backwards” But we left out one detail: REGRESSION. ex: clear(b) holding(a) on(b,c) on(a,b) on(b,c) stack(a,b)
ontable(a) on(X,a) clear(X) false on(b,c) clear(b) The asumption is thatstack(a,b) doesn’t affecton(b,c), which is correct;but the assumption isn’talways true: ontable(a) clear(a) handempty on(b,c) clear(b) There’s no way we can have handempty immediately after an unstack. unstack(X,a)
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.” Ex: regression[on(a,b), pickup(c)]=on(a,b) regression[on(a,b), stack(a,b)]=true regression[handempty,pickup(a)]=false
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. General rule forSTRIPS operators (G=goal, O=operator): • 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.
Consider the case of regressing throughunstack(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) Regressing through incompletely instantiated rules unstack(X,Y) P & D: handempty, clear(X), on(X,Y) A: holding(X), clear(Y) Ex: