lecture 12 example (from slides prepared by prof. j. rosenchein)

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

Upload: mia-welch

Post on 03-Jan-2016

23 views

Category:

Documents


0 download

DESCRIPTION

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…. - PowerPoint PPT Presentation

TRANSCRIPT

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

1

Lecture 12 example

(from slides preparedby Prof. J. Rosenchein)

Page 2: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

2

STRIPS Planning: the basic idea

Place goal on goal stack:

Goal1

Considering top Goal1,place onto it its subgoals:

Goal1

GoalS1-2GoalS1-1

Then try to solve subgoalGoalS1-2, and continue…

Page 3: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

3

Stack Manipulation RulesIf 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

Rule1. Remove rule from stack;2. Update database using rule;3. Keep track of rule (for solution)

Nothing Stop

Page 4: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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:

Page 5: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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):

Page 6: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)stack(c,b)

holding(c) clear(b)

clear(b)on(c,a)clear(c)ontable(a)ontable(b)handempty

Database(unchanged):

Page 7: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)stack(c,b)

holding(c) clear(b)

holding(c)

clear(b)

clear(b)on(c,a)clear(c)ontable(a)ontable(b)handempty

Database(unchanged):

Page 8: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)stack(c,b)

holding(c) clear(b)

holding(c)

clear(b)on(c,a)clear(c)ontable(a)ontable(b)handempty

Database(unchanged):

Page 9: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)stack(c,b)

holding(c) clear(b)

unstack(c)unstack(c)

Database: (unchanged)

Page 10: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)stack(c,b)

holding(c) clear(b)

unstack(c)unstack(c)

Page 11: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)stack(c,b)

holding(c) clear(b)

clear(b)ontable(a)ontable(b)holding(c)clear(a)

Database:

Solution: {unstack(c)}

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

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)stack(c,b)

clear(b)ontable(a)ontable(b)holding(c)clear(a)

Database(unchanged):

Solution: {unstack(c)}

Page 13: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)handemptyclear(a)clear(c)on(c,b)

Database:

Solution: {unstack(c), stack(c,b)}

Page 14: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)stack(a,c)

ontable(a)ontable(b)handemptyclear(a)clear(c)on(c,b)

Database(unchanged):

Solution: {unstack(c), stack(c,b)}

holding(a) clear(c)

Page 15: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)stack(a,c)

ontable(a)ontable(b)handemptyclear(a)clear(c)on(c,b)

Database(unchanged):

holding(a) clear(c)

holding(a)

Solution: {unstack(c), stack(c,b)}

Page 16: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)stack(a,c)

holding(a) clear(c)

pickup(a)pickup(a)

ontable(a) clear(a) handempty

Database: (unchanged)

Solution: {unstack(c), stack(c,b)}

Page 17: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

17

14. Compound goal on top of stack matches data base, so remove it:

Stack:on(a,c) on(c,b)

stack(a,c)stack(a,c)

holding(a) clear(c)

pickup(a)pickup(a)

ontable(a)ontable(b)handemptyclear(a)clear(c)on(c,b)

Database(unchanged):

Solution: {unstack(c), stack(c,b)}

Page 18: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)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)}

Page 19: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

19

16. Compound goal on top of stack matches data base, so remove it:

Stack:on(a,c) on(c,b)

stack(a,c)stack(a,c)

ontable(b)on(c,b)clear(c)holding(a)

Database(unchanged):

Solution: {unstack(c), stack(c,b), pickup(a)}

Page 20: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)}

Page 21: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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.

Page 22: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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).

Page 23: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

23

Sometimes even thisdoesn’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.

Page 24: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

24

The final sequence isinefficient:

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

Page 25: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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

cb

goal

We couldn’t do this using a stack, but we can if we use a set of goals.

start

Page 26: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)handemptyon(b,c)clear(b)

holding(b)clear(c)holding(a)clear(b)

handemptyclear(x)on(x,b)on(b,c)holding(a)

handemptyclear(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

x x xx

preconditions

Page 27: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)

Page 28: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

28

The asumption is thatstack(a,b) doesn’t affecton(b,c), which is correct;but the assumption isn’t

always true:

ontable(a)clear(a)handemptyon(b,c)clear(b)

ontable(a)on(X,a)clear(X)falseon(b,c)clear(b)

unstack(X,a)

There’s no way we can have handempty immediately after an unstack.

Page 29: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)]=trueregression[handempty,pickup(a)]=false

Ex:

Page 30: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

30

General rule forSTRIPS operators (G=goal, O=operator):

G regressed through O is1. true if G is part of O’s add-list2. false if G is part of O’s delete-list3. 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.

Page 31: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

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)

Page 32: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

32

Example of regression planning

Page 33: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

33

Page 34: Lecture 12  example (from slides prepared by Prof. J. Rosenchein)

34