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

Slides:



Advertisements
Similar presentations
1 Knowledge and reasoning – second part Knowledge representation Logic and representation Propositional (Boolean) logic Normal forms Inference in propositional.
Advertisements

Constraint Satisfaction Problems
Department of Computer Science Undergraduate Events More
Logic & Critical Reasoning
1 University of Utah – School of Computing Computer Science 1021 "Thinking Like a Computer"
Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)
Decision Theory: Sequential Decisions Computer Science cpsc322, Lecture 34 (Textbook Chpt 9.3) Nov, 28, 2012.
Local Search Jim Little UBC CS 322 – CSP October 3, 2014 Textbook §4.8
CPSC 322, Lecture 14Slide 1 Local Search Computer Science cpsc322, Lecture 14 (Textbook Chpt 4.8) Oct, 5, 2012.
Scheduling Planning with Actions that Require Resources.
CPSC 322, Lecture 5Slide 1 Uninformed Search Computer Science cpsc322, Lecture 5 (Textbook Chpt 3.5) Sept, 14, 2012.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
Slide 1 Planning: Representation and Forward Search Jim Little UBC CS 322 October 10, 2014 Textbook §8.1 (Skip )- 8.2)
CPSC 322, Lecture 16Slide 1 Stochastic Local Search Variants Computer Science cpsc322, Lecture 16 (Textbook Chpt 4.8) February, 9, 2009.
CPSC 322, Lecture 21Slide 1 Bottom Up: Soundness and Completeness Computer Science cpsc322, Lecture 21 (Textbook Chpt 5.2) February, 27, 2009.
CPSC 322, Lecture 23Slide 1 Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from.
CPSC 322, Lecture 19Slide 1 Propositional Logic Intro, Syntax Computer Science cpsc322, Lecture 19 (Textbook Chpt ) February, 23, 2009.
CPSC 322, Lecture 18Slide 1 Planning: Heuristics and CSP Planning Computer Science cpsc322, Lecture 18 (Textbook Chpt 8) February, 12, 2010.
CPSC 322, Lecture 11Slide 1 Constraint Satisfaction Problems (CSPs) Introduction Computer Science cpsc322, Lecture 11 (Textbook Chpt 4.0 – 4.2) January,
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
CPSC 322, Lecture 23Slide 1 Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
CPSC 322, Lecture 13Slide 1 CSPs: Arc Consistency & Domain Splitting Computer Science cpsc322, Lecture 13 (Textbook Chpt 4.5,4.8) February, 02, 2009.
CPSC 322, Lecture 14Slide 1 Local Search Computer Science cpsc322, Lecture 14 (Textbook Chpt 4.8) February, 4, 2009.
Boolean Algebra Computer Science AND (today is Monday) AND (it is raining) (today is Monday) AND (it is not raining) (today is Friday) AND (it is.
CPSC 322, Lecture 17Slide 1 Planning: Representation and Forward Search Computer Science cpsc322, Lecture 17 (Textbook Chpt 8.1 (Skip )- 8.2) February,
CPSC 322, Lecture 17Slide 1 Planning: Representation and Forward Search Computer Science cpsc322, Lecture 17 (Textbook Chpt 8.1 (Skip )- 8.2) February,
CPSC 322, Lecture 22Slide 1 Logic: Domain Modeling /Proofs + Top-Down Proofs Computer Science cpsc322, Lecture 22 (Textbook Chpt 5.2) March, 8, 2010.
CPSC 322, Lecture 24Slide 1 Reasoning under Uncertainty: Intro to Probability Computer Science cpsc322, Lecture 24 (Textbook Chpt 6.1, 6.1.1) March, 15,
Intro to Discrete Structures
Planning: Wrap up CSP Planning. Logic: Intro CPSC 322 – Planning 3 Textbook §8.4, §5.1 March 2, 2011.
Computer Science CPSC 502 Lecture 5 SLS: wrap-up Planning (Ch 8)
Slide 1 CSPs: Arc Consistency & Domain Splitting Jim Little UBC CS 322 – Search 7 October 1, 2014 Textbook §
Slide 1 Constraint Satisfaction Problems (CSPs) Introduction Jim Little UBC CS 322 – CSP 1 September 27, 2014 Textbook §
CPSC 322, Lecture 22Slide 1 Logic: Domain Modeling /Proofs + Top-Down Proofs Computer Science cpsc322, Lecture 22 (Textbook Chpt 5.2) Oct, 26, 2010.
Computer Science CPSC 322 Lecture 18 Heuristics for Forward Planning.
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
Computer Science CPSC 322 Lecture 13 Arc Consistency (4.5, 4.6 ) Slide 1.
Logic: Intro & Propositional Definite Clause Logic CPSC 322 – Logic 1 Textbook §5.1 March 4, 2011.
Boolean Algebra. Logical Statements A proposition that may or may not be true:  Today is Monday  Today is Sunday  It is raining.
CPSC 322, Lecture 6Slide 1 Planning + Intro Logics Computer Science cpsc322, Lecture 6 (Textbook Chpt , 8.4) May, 23, 2012.
LOGIC Lesson 2.1. What is an on-the-spot Quiz  This quiz is defined by me.  While I’m having my lectures, you have to be alert.  Because there are.
CPSC 322, Lecture 18Slide 1 Planning: Heuristics and CSP Planning Jim Little UBC CS 322 October 15, 2014 Textbook §8.
Chapter 3 Object Interaction.  To construct interesting applications it is not enough to build individual objects  Objects must be combined so they.
CPSC 322, Lecture 19Slide 1 (finish Planning) Propositional Logic Intro, Syntax Computer Science cpsc322, Lecture 19 (Textbook Chpt – 5.2) Oct,
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Oct, 30, 2015 Slide credit: some slides adapted from Stuart.
Computer Science CPSC 322 Lecture 22 Logical Consequences, Proof Procedures (Ch 5.2.2)
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
Slide 1 Propositional Logic Intro, Syntax Jim Little UBC CS 322 – CSP October 17, 2014 Textbook § – 5.2.
Robust Planning using Constraint Satisfaction Techniques Daniel Buettner and Berthe Y. Choueiry Constraint Systems Laboratory Department of Computer Science.
Logic: Proof procedures, soundness and correctness CPSC 322 – Logic 2 Textbook §5.2 March 7, 2011.
Computer Science CPSC 322 Lecture 12 SLS wrap up, Forward Planning, Planning as CSP (Ch 8.2, 8.4) Slide 1.
Computer Science CPSC 322 Lecture 14 Intro to Logic (5.1, 5.1.1) 1.
Constraint Satisfaction Problems (CSPs) Introduction
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Propositional Logic Intro, Syntax Computer Science cpsc322, Lecture 19
Propositional Logic Intro, Syntax Computer Science cpsc322, Lecture 19
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Planning: Forward Planning and CSP Planning
Constraint Satisfaction Problems (CSPs) Introduction
Planning: Representation and Forward Search
Planning + Intro Logics Computer Science cpsc322, Lecture 6
Boolean logic Taken from notes by Dr. Neil Moore
Planning: Heuristics and CSP Planning
Planning: Heuristics and CSP Planning
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Planning: Representation and Forward Search
Planning: Heuristics and CSP Planning
Boolean logic Taken from notes by Dr. Neil Moore
Planning: Representation and Forward Search
Presentation transcript:

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

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

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

“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

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

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

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

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

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

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

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.

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

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

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

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

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

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

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

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 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 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 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 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?

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

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

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,

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,

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

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

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

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

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

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

West North East South 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 ….

You know the key ideas! Ghallab, Nau, and Traverso Automated Planning: Theory and Practice Web site: Also has lecture notes 35 You know You know a little