Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Science CPSC 322 Lecture 22 Finish Planning as CSP and Planning Wrap-up (Ch 8.4)

Similar presentations


Presentation on theme: "Computer Science CPSC 322 Lecture 22 Finish Planning as CSP and Planning Wrap-up (Ch 8.4)"— Presentation transcript:

1 Computer Science CPSC 322 Lecture 22 Finish Planning as CSP and Planning Wrap-up (Ch 8.4)

2 Announcements Take flyer on volunteering for cool UBC CS event Assignment 3 will be available by Monday at the latest Useful to do practice Exercise 7 before Assignment 3. Midterm solutions available in Vista Midterm marks available early next week 2

3 Lecture Overview Recap Lecture 21 CSP planning - Details on CSP representation - Solving the CSP planning problem Time permitting: Intro to Logic 3

4 “Open-up” the representation of states, goals and actions –States and goals as set of features –Actions as preconditions and effects defined on state features STRIPS representation: an action has two parts: 1. Preconditions: a set of assignments to features that must be satisfied in order for the action to be legal 2. Effects: a set of assignments to features that are caused by the action Key Idea of Planning

5 STRIPS lends itself to solve planning problems either As pure search problems As CSP problems We looked at Forward Planning as a basic technique to solve planning problems as pure search problems We started looking at Planning as CSP Solving planning problems

6 Planning as a CSP An alternative approach to planning is to set up a planning problem as a CSP We simply reformulate a STRIPS model as a set of variables and constraints

7 Planning as a CSP: General Idea Action preconditions and effects are virtually constraints between the action, the states in which it can be applied the states that it can generate Thus, we can make both states and actions into the variables of our CSP formulations However, constraints based on action preconditions and effects relate to states at a given time t, the corresponding valid actions and the resulting states at t +1 need to have as many state and action variables as there are planning steps

8 Lecture Overview Recap Lecture 21 CSP planning - Details on CSP representation - Solving the CSP planning problem Time permitting: Intro to Logic 8

9 Planning as a CSP: General Idea Both features and actions are CSP variables Action preconditions and effects are constraints among the action, the states in which it can be applied the states that it can generate

10 Planning as a CSP: General Idea These action constraints relate to states at a given time t, the corresponding valid actions and the resulting states at t +1 we need to have as many state and action variables as we have planning steps

11 Planning as a CSP: Variables We need to ‘unroll the plan’ for a fixed number of steps: this is called the horizon k To do this with a horizon of k: construct a CSP variable for each STRIPS state variable at each time step from 0 to k construct a boolean CSP variable for each STRIPS action at each time step from 0 to k - 1.

12 Initial State(s) and Goal(s) How can we represent the initial state(s) and the goal(s) with this representation? e.g. Initial state with Sam wanting coffee and Rob at the coffee shop, with no coffee and no mail Goal: Sam does not want coffee

13 Slide 13 Initial and Goal Constraints initial state constraints: goal constraints:

14 Initial and Goal Constraints initial state constraints: unary constraints on the values of the state variables at time 0 goal constraints: unary constraints on the values of the state variables at time k

15 CSP Planning: Precondition Constraints precondition constraints between state variables at time t and action variables at time t specify when actions may be taken E.g. robot can only pick up coffee when Loc=cs (coffee shop) and RHC = false (don’t have coffee already) RLoc 0 RHC 0 PUC 0 csT F F mr* lab* off* Need to allow for the option of *not* taking an action even when it is valid F F F F F T Truth table for this constraint: list allowed combinations of values

16 CSP Planning: Effect Constraints Effect constraints Between action variables at time t and state variables at time t+1 Specify the effects of an action Also depends on state variables at time t (frame rule!) E.g. let’s consider RHC at time t and t+1 Let’s fill in a few rows in this table RHC t DelC i PUC i RHC t+1 TTT TTF TFT TFF FTT FTF FFT FFF 16

17 Effect Constraints For each row in the constraint table, the value of a state variable at t+1 is computed considering that all actions = T in that row Action sequencing depends on both the value of that state variable at t, as well as the actions preconditions and effects For instance, in the row below When RHC = T, only DecC can apply, with the effect of making RHC = T At this point, PUC can apply, with the effect of making RHC = T again RHC t DelC i PUC i RHC t+1 TTT

18 CSP Planning: Effect Constraints Effect constraints Between action variables at time t and state variables at time t+1 Specify the effects of an action Also depends on state variables at time t (frame rule!) E.g. let’s consider RHC at time t and t+1 Let’s fill in a few rows in this table RHC t DelC i PUC i RHC t+1 TTTT TTFF TFTT TFFT FTT FTF FFT FFF 18 F T F F

19 Additional constraints in CSP Planning Other constraints we may want are action constraints: specify which actions cannot occur simultaneously these are often called mutual exclusion (mutex) constraints DelM i DelC i E.g. in the Robot domain DelM and DelC can occur in any sequence (or simultaneously) But we can enforce that they do not happen simultaneously 19

20 20 Handling mutex constraints in Forward Planning E.g., let’s say we don’t want DelM and DelC to occur simultaneously How would we encode this into STRIPS for forward planning? Via the actions’ preconditions (how?) No need to enforce this constraint in Forward Planning Via the actions’ effects (how?) None of the above DelM i DelC i TF TF FF

21 21 Handling mutex constraints in Forward Planning E.g., let’s say we don’t want DelM and DelC to occur simultaneously How would we encode this into STRIPS for forward planning? Because forward planning gives us a sequence of actions: only one action is carried out at a time anyways No need to enforce this constraint in Forward Planning DelM i DelC i TF TF FF

22 22 Additional constraints in CSP Planning Other constraints we may want are state constraints hold between variables at the same time step they can capture physical constraints of the system (e.g., robot cannot hold coffee and mail) RHC i RHM i

23 23 Handling state constraints in Forward Planning RHC i RHM i TF FT FF Via the actions’ preconditions (how?) No need to enforce this constraint in Forward Planning (why?) Via the actions’ effects (how?) None of the above How could we handle these constraints in STRIPS for forward planning?

24 We need to use preconditions Robot can pick up coffee only if it does not have coffee and it does not have mail Robot can pick up mail only if it does not have mail and it does not have coffee 24 Handling state constraints in Forward Planning RHC i RHM i TF FT FF

25 Lecture Overview Recap Lecture 21 CSP planning - Details on CSP representation - Solving the CSP planning problem Time permitting: Intro to Logic 25

26 CSP Planning: Solving the problem 26 Map STRIPS Representation for horizon 1, 2, 3, …, until solution found Run arc consistency and search or stochastic local search! k = 0 Is State 0 a goal? If yes, DONE! If no,

27 CSP Planning: Solving the problem 27 Map STRIPS Representation for horizon k =1 Run arc consistency and search or stochastic local search! k = 1 Is State 1 a goal If yes, DONE! If no,

28 CSP Planning: Solving the problem 28 Map STRIPS Representation for horizon k = 2 Run arc consistency, search, stochastic local search! k = 2: Is State 2 a goal If yes, DONE! If no….continue

29 Solve Planning as CSP: pseudo code 29 solved = false horizon = 0 While solved = false map STRIPS into CSP with horizon solve CSP -> solution if solution then solved = T else horizon = horizon + 1 Return solution

30 Solving Planning as CSP: pseudo code solved = false for horizon h=0,1,2,… map STRIPS into a CSP csp with horizon h solve that csp if solution exists then return solution else horizon = horizon + 1 end Which method would you use to solve each of these CSPs? Stochastic Local SearchArc consistency + domain splitting

31 Solving Planning as CSP: pseudo code 31 solved = false for horizon h=0,1,2,… map STRIPS into a CSP csp with horizon h solve that csp if solution exists then return solution else horizon = horizon + 1 end Which method would you use to solve each of these CSPs? Not SLS! SLS cannot determine that no solution exists! Arc consistency + domain splitting

32 STRIPS to CSP Conversion applet 32 Allows you: to specify a planning problem in STRIPS to map it into a CSP for a given horizon the CSP translation is automatically loaded into the CSP applet where it can be solved Under “Main Tools” in the AISpace Home Page We will try it out on the “Coffee delivery” Problem (simplified version of the Coffee and Mail delivery problem we saw earlier) Also used in Assignment 3

33 Learning Goals for Planning STRIPS Represent a planning problem with the STRIPS representation Explain the STRIPS assumption Forward planning Solve a planning problem by search (forward planning). Specify states, successor function, goal test and solution. Construct and justify a heuristic function for forward planning CSP planning Translate a planning problem represented in STRIPS into a corresponding CSP problem (and vice versa) Solve a planning problem with CSP by expanding the horizon

34 West North East South 6 2 8 Q Q  J 6  5  9  7  A K 5 3 A  9   Some applications of planning Emergency Evacuation Robotics Space Exploration Manufacturing Analysis Games (e.g., Bridge)? Generating Natural language Product Recommendations ….

35 You know the key ideas! Ghallab, Nau, and Traverso Automated Planning: Theory and Practice Web site: http://www.laas.fr/planning Also has lecture notes 35 You know You know a little


Download ppt "Computer Science CPSC 322 Lecture 22 Finish Planning as CSP and Planning Wrap-up (Ch 8.4)"

Similar presentations


Ads by Google