Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 07 : Planning.

Similar presentations


Presentation on theme: "CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 07 : Planning."— Presentation transcript:

1 CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 07 : Planning

2 2 Planning as Problem Solving Planning: Start state (S) Goal state (G) Set of actions In planning, the idea is that you're given some description of a starting state or states; a goal state or states; and some set of possible actions that the agent can take. And you want to find the sequence of actions that get you from the start state to the goal state.

3 3 Planning as Problem Solving

4 4

5 5 Strips Example Action Buy(x, store) – Pre: At(store), Sells(store, x) – Eff: Have(x) Go(x, y) – Pre: At(x) – Eff: At(y), ¬At(x) Goal Have(Milk)  Have(Banana) Start At(Home)  Sells(SM, Milk)  Sells(SM, Banana) We’re going to start at home and knowing that the supermarket sells milk, and the supermarket sells bananas.

6 6 Planning Algorithms

7 7 Plan-Space Search Situation space – both progressive and regressive planners plan in space of situations Plan space – start with null plan and add steps to plan until it achieves the goal Decouples planning order from execution order Least-commitment – First think of what actions before thinking about what order to do the actions Means-ends analysis – Try to match the available means to the current ends

8 8 Initial Plan Steps: {start, finish} Ordering: {start < finish} start Pre: none Effects: start conditions finish Pre: goal conditions Effects: none

9 9 Plan Example Here’s our initial plan. With the start and finish steps. We’ll draw ordering constraints using dashed red lines. We put the effects of a step below it, and the preconditions of a step above it. We’ll do a simplified version of the whole problem, deleting the requirement for a drill, and just having as our goal that we have milk and bananas.

10 10 We’ll start by adding a step that says we’re going to by milk at some place called x1. It has preconditions at(x1) and sells(x1, milk); and it has the effect have(milk).

11 11 Now, we can add a blue causal link that says we are going to use this effect of have(Milk) to satisfy the precondition have(Milk) in the finish step.

12 12 Every causal link also implies an ordering link, so we’ll add an ordering link as well between this step and finish. And we should also require that this step happen after start.

13 13 Now, let's buy bananas. We add a step to buy bananas at location x2, including its preconditions and effects.

14 14 Now we add a causal link and temporal constraints, just as we did for the buy milk step.

15 15 Now, a relatively straightforward thing to do is satisfy sells(x1,Milk) by constraining x1 to be the supermarket. We add a variable binding constraint, saying that x1 is equal to the supermarket. And that allows us to put a causal link between Sells(SM,M) in the effects of start, and the precondition here on buy.

16 16 Similarly, we can satisfy sells(x2,Bananas) by adding a variable binding constraint that x2 must be the supermarket, and adding a causal link.

17 17 Now, the only preconditions that remain unsatisfied are at(x1) and at(x2). Since x1 and x2 are both constrained to be the supermarket, it seems like we should add a step to go to the supermarket.

18 18 The effect of at(SM) can be used to satisfy both preconditions, so we add causal links to the at preconditions and temporal links to the buy actions.

19 19 And we add another temporal constraint to force this step to come after start.

20 20 Now, the At(x3) precondition can be satisfied by adding a variable binding constraint to force x3 to be home.

21 21 We can add a causal link from the At(home) effect of start to this precondition, and we’re done!

22 22 Block World Example

23 23 Let's do the problem. First we add the start step, which produces the following facts for us: clear(T), on (C, A), on (A, table), on (B, table), clear(C), and clear (B). That's what we know when we wake up. And the finish step requires on (A,B) and on(B,C).

24 24 What would you like to do? Where's a precondition that needs to be made true. Let’s work on making on(A,B) true. It doesn't look like we can just use some fact we already have to make it true, so we have to add another step. It looks like move would be good. And we want to be in sort of least commitment in our moving, so we're going to move A from somewhere to B.

25 25 Let's write out all the postconditions, just so that we're shown all the effects. So, we'll get on(A,B). We'll get not on(A,X1). We'll get clear(X1) and we’ll get not clear(B).

26 26 Our preconditions are on (A,X1), clear(A), clear(B)-- and I'm going to leave the block precondition out, just because it's trivial and tedious. We would have to assert block(A), block(B), and block(C) in the start state.

27 27 Now let’s work on Clear (A); that's going to be a hard one. How can we make A clear? Well, the way we make things clear is by moving something off of them. Right? So, the thing that we're moving off of A, we can either move to some block or to the table. Let me just guide you to the choice of moving it to the table, so this doesn’t take too long (but a computer might very well try moving it somewhere inconvenient, like on to B). So, we can move-table something off of A.

28 28 That will produce On (Y,table), clear(A) and not on(Y,A). So we can add a causal link between this clear(A) and the clear(A) in the precondition of our other move.

29 29 We can satisfy on(y,A) by letting y be C, and adding a causal connection from on(C,A) in the effects of start.

30 30 Since y is bound to C, we need clear C, which we can also find in the effects of start.

31 31 Good. Things are in pretty good shape. We can just tidy up a bit by satisfyingclear(B) with one of the effects of start.

32 32 Now, we have two preconditions left to work on: on(A,x1) and on(B,C). We can satisfy on(A,x1) by using the on(A,T) from start, and letting x1 be the table.

33 33 Now, what's left is on(B,C). To get B to be on C, it means we're going to have to move it. So, we’ll add the step move(B, X2, C).

34 34 That produces on(B,C), not on(B,x2), clear(x2) and not clear( C ). And it has as preconditions on(B,X2), clear(B), and clear(C).

35 35 Now one thing we have to do is to be sure that we haven't introduced any threats. There don’t seem to be any right now, so then we have to just deal with the preconditions of this. So, how about the clears. Maybe they just come for free. It looks like maybe. We get clear B from start and clear C from start as well, And start makes on(B,X2) true if we let X2 be the table.

36 36 Now there are some threats that we have to deal with. First, notice the possibility that we move B onto C before we move C off of A. That is, the Move(B, x2, C) step threatens the causal link between clear(C ) in the start step and the MoveT(C,A) step.

37 37 How can we resolve this threat? We can’t require anything to happen before start, so we’ll have to add an ordering constraint that requires move(B,T,C) to happen after moveTable(C,A).

38 38 There’s still another lurking threat. We’re currently allowed to move A onto B before we move B onto C. That is, the Move(A, x1, B) step threatens the causal link between clear(B) in the start step and the Move(B, x2, C) step.

39 39 Again, we can resolve this one with an ordering constraint, requiring us to move A onto B after we move B onto C.

40 40 At this point, we have a complete and correct plan. We first move C from A to the table, Then we move B onto C. And finally, we move A onto B.


Download ppt "CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 07 : Planning."

Similar presentations


Ads by Google