Planning: Wrap up CSP Planning Logic: Intro

Similar documents
Lecture 9 Arc Consistency

CSPs: Arc Consistency & Domain Splitting

Arc Consistency and Domain Splitting in CSPs

Local Search for CSPs

Logic: TD as search, Datalog (variables)

Domain Splitting CPSC 322 CSP 4. Textbook 4.6. February 4, 2011

Regression Planning. CPSC 322 Lecture 17. February 14, 2007 Textbook 11.2 and Regression Planning CPSC 322 Lecture 17, Slide 1

Constraint Satisfaction Problems (CSPs)

Branch & Bound (B&B) and Constraint Satisfaction Problems (CSPs)

Decision Theory: Single & Sequential Decisions. VE for Decision Networks.

CSPs: Search and Arc Consistency

Search. (Textbook Chpt ) Computer Science cpsc322, Lecture 2. May, 10, CPSC 322, Lecture 2 Slide 1

CS-171, Intro to A.I. Mid-term Exam Fall Quarter, 2014

Homework #6 (Constraint Satisfaction, Non-Deterministic Uncertainty and Adversarial Search) Out: 2/21/11 Due: 2/29/11 (at noon)

Artificial Intelligence

Uninformed Search Strategies

Search with Costs and Heuristic Search

Acknowledgements. Outline

CS-171, Intro to A.I. Mid-term Exam Winter Quarter, 2014

Problem 1 Zero: 11% (~20 students), Partial: 66% (~120 students), Perfect: 23% (~43 students)

ˆ The exam is closed book, closed calculator, and closed notes except your one-page crib sheet.

Exam Topics. Search in Discrete State Spaces. What is intelligence? Adversarial Search. Which Algorithm? 6/1/2012

Heuristic Search for Planning

Principles of AI Planning. Principles of AI Planning. 7.1 How to obtain a heuristic. 7.2 Relaxed planning tasks. 7.1 How to obtain a heuristic

The exam is closed book, closed calculator, and closed notes except your one-page crib sheet.

What is Search For? CS 188: Artificial Intelligence. Constraint Satisfaction Problems

Announcements. Homework 4. Project 3. Due tonight at 11:59pm. Due 3/8 at 4:00pm

Constraint Satisfaction Problems

CS 4100 // artificial intelligence

Search in discrete and continuous spaces

Reductions and Satisfiability

Activity Planning and Execution I: Operator-based Planning and Plan Graphs. Assignments

Foundations of Artificial Intelligence

Introduction to Fall 2008 Artificial Intelligence Midterm Exam

CS-171, Intro to A.I. Mid-term Exam Fall Quarter, 2017

Constraint Satisfaction Problems

Name: UW CSE 473 Midterm, Fall 2014

Recap Datalog Datalog Syntax Datalog Semantics. Logic: Datalog. CPSC 322 Logic 6. Textbook Logic: Datalog CPSC 322 Logic 6, Slide 1

Fundamentals of Digital System Design ECE 3700, CPSC 3700

CS 343: Artificial Intelligence

A* optimality proof, cycle checking

CS W4701 Artificial Intelligence

CS 188: Artificial Intelligence Fall 2011

Planning. Introduction

CS 343: Artificial Intelligence

Midterm I. Introduction to Artificial Intelligence. CS 188 Fall You have approximately 3 hours.

Constraint Satisfaction Problems Part 2

Announcements. CS 188: Artificial Intelligence Fall 2010

Midterm I. Introduction to Artificial Intelligence. CS 188 Fall You have approximately 3 hours.

Logik für Informatiker Logic for computer scientists

Lecture 3 - States and Searching

CS-171, Intro to A.I. Mid-term Exam Fall Quarter, 2013

Uninformed Search. (Textbook Chpt 3.5) Computer Science cpsc322, Lecture 5. May 18, CPSC 322, Lecture 5 Slide 1

Announcements. Homework 1: Search. Project 1: Search. Midterm date and time has been set:

Set 5: Constraint Satisfaction Problems Chapter 6 R&N

Chapter 2 & 3: Representations & Reasoning Systems (2.2)

Introduction to Fall 2014 Artificial Intelligence Midterm Solutions

Constraint Satisfaction Problems. Chapter 6

Recap A Search Optimality of A. Search: A. CPSC 322 Search 5. Textbook 3.6. Search: A CPSC 322 Search 5, Slide 1

Dipartimento di Elettronica Informazione e Bioingegneria. Cognitive Robotics. SATplan. Act1. Pre1. Fact. G. Gini Act2

Textbook. Topic 5: Repetition. Types of Loops. Repetition

Warm-Up Problem. Let L be the language consisting of as constant symbols, as a function symbol and as a predicate symbol. Give an interpretation where

Abstractions and small languages in synthesis CS294: Program Synthesis for Everyone

Shared Variables and Interference

CS 188: Artificial Intelligence. What is Search For? Constraint Satisfaction Problems. Constraint Satisfaction Problems

10/11/2017. Constraint Satisfaction Problems II. Review: CSP Representations. Heuristic 1: Most constrained variable

Artificial Intelligence. Chapters Reviews. Readings: Chapters 3-8 of Russell & Norvig.

CS188 Fall 2018 Section 2: Graph Search + CSPs

Notes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 9 Notes. Class URL:

CS 188: Artificial Intelligence

Recap Randomized Algorithms Comparing SLS Algorithms. Local Search. CPSC 322 CSPs 5. Textbook 4.8. Local Search CPSC 322 CSPs 5, Slide 1

CS 343: Artificial Intelligence

Section Marks Pre-Midterm / 32. Logic / 29. Total / 100

Introduction to Spring 2007 Artificial Intelligence Midterm Solutions

Chapter 27. Other Approaches to Reasoning and Representation

COMP108 Algorithmic Foundations

Introduction to AI Spring 2006 Dan Klein Midterm Solutions

Midterms Save the Dates!

6.034 Quiz 1, Spring 2004 Solutions

(Due to rounding, values below may be only approximate estimates.) We will supply these numbers as they become available.

Chapter 10 Part 1: Reduction

Agent Design Example Problems State Spaces. Searching: Intro. CPSC 322 Search 1. Textbook Searching: Intro CPSC 322 Search 1, Slide 1

CMU-Q Lecture 7: Searching in solution space Constraint Satisfaction Problems (CSPs) Teacher: Gianni A. Di Caro

CSE 417 Network Flows (pt 3) Modeling with Min Cuts

Midterm Examination CS540-2: Introduction to Artificial Intelligence

Validating Plans with Durative Actions via Integrating Boolean and Numerical Constraints

Announcements. CS 188: Artificial Intelligence Spring Today. Example: Map-Coloring. Example: Cryptarithmetic.

INF Kunstig intelligens. Agents That Plan. Roar Fjellheim. INF5390-AI-06 Agents That Plan 1

Principles of AI Planning. Principles of AI Planning. 8.1 Parallel plans. 8.2 Relaxed planning graphs. 8.3 Relaxation heuristics. 8.

implementing the breadth-first search algorithm implementing the depth-first search algorithm

Chapter 6 Constraint Satisfaction Problems

CS 540: Introduction to Artificial Intelligence

Probabilistic Belief. Adversarial Search. Heuristic Search. Planning. Probabilistic Reasoning. CSPs. Learning CS121

Week 8: Constraint Satisfaction Problems

Formal Methods in Software Engineering. Lecture 07

CSC2542 Planning-Graph Techniques

Set 9: Planning Classical Planning Systems. ICS 271 Fall 2013

Consistency and Set Intersection

Artificial Intelligence

CS-171, Intro to A.I. Mid-term Exam Winter Quarter, 2016

Transcription:

Planning: Wrap up CSP Planning Logic: Intro Alan Mackworth UBC CS 322 Planning 3 ebruary 25, 2013 Textbook 8.4, 5.1

GAC vs. AC GAC = Generalized Arc Consistency (for k-ary constraints) AC = Arc Consistency for Binary Arcs In class we focused on AC, text covers GAC (You are responsible for text sections covered.) 2

Arc consistency algorithm (for binary constraints) Procedure GAC(V,dom,C) Inputs V: a set of variables dom: a function such that dom(x) is the domain of variable X C: set of constraints to be satisfied Output arc-consistent domains for each variable Local D X is a set of values for each variable X TDA is a set of arcs 1: for each variable X do 2: D X dom(x) 3: TDA { X,c X V, c C and X scope(c)} 4: while (TDA {}) 5: select X,c TDA 6: TDA TDA \ { X,c } 7: ND X {x x D X and y D Y s.t. (x, y) satisfies c} 8: if (ND X D X ) then 9: TDA TDA { Z,c' X scope(c'), c' c, Z scope(c') \ {X} } 10: D X ND X 11: return {D X X is a variable} 3

GAC for k-ary constraints (P&M, Section 4.5) 1: Procedure GAC(V,dom,C) 2: Inputs 3: V: a set of variables 4: dom: a function such that dom(x) is the domain of variable X 5: C: set of constraints to be satisfied 6: Output 7: arc-consistent domains for each variable 8: Local 9: D X is a set of values for each variable X 10: TDA is a set of arcs 11: for each variable X do 12: D X dom(x) 13: TDA { X,c c C and X scope(c)} 14: while (TDA {}) 15: select X,c TDA; 16: TDA TDA \ { X,c }; 17: ND X {x x D X and some {X=x,Y 1 =y 1,...,Y k =y k } c where y i D Yi for all i} 18: if (ND X D X ) then 19: TDA TDA { Z,c' X scope(c'), c' is not c, Z scope(c') \ {X} } 20: D X ND X 21: return {D X X is a variable} igure 4.3: Generalized arc consistency algorithm 4

Lecture Overview Recap: STRIPS, forward planning & heuristics Recap: CSP planning More CSP planning - Details on CSP representation - Solving the CSP planning problem Time permitting: Intro to Logic 5

Problem Type Static Sequential Constraint Satisfaction Logic Planning We re here: deterministic & sequential Course Overview Deterministic Arc Consistency Variables + Search Constraints Logics STRIPS Search Environment Search As CSP (using arc consistency) Stochastic Bayesian Networks Variable Elimination Decision Networks Variable Elimination Markov Processes Value Iteration Course Module Representation Reasoning Technique Uncertainty Decision Theory 6

STRIPS Definition: A STRIPS problem instance consists of: a set of variables (features)v a domain dom(v) for each variable V V - Let X be the space of partial assignments of a set of variables to values from their domains a set of actions A - Each action a A has A set of preconditions P(a) X A set of effects E(a) X a start condition s X a goal condition g X Example for an action in robot example: pick up coffee preconditions Loc = cs and RHC = effects RHC = rhc 7

orward planning: search in state space graph Goal: Solution: a sequence of actions that gets us from the start to a goal What is a solution to this planning problem? (puc, mc, dc) 8

Planning as Standard Search Constraint Satisfaction (Problems): State: assignments of values to a subset of the variables Successor function: assign values to a free variable Goal test: set of constraints Solution: possible world that satisfies the constraints Heuristic function: none (all solutions at the same distance from start) Planning : State: full assignment of values to features Successor function: states reachable by applying valid actions Goal test: partial assignment of values to features Solution: a sequence of actions Heuristic function: relaxed problem! E.g. ignore delete lists Inference State Successor function Goal test Solution Heuristic function 9

Example for domain-independent heuristics Let s stay in the robot domain But say our robot has to bring coffee to Bob, Sue, and Steve: G = {bob_has_coffee, sue_has_coffee, steve_has_coffee} They all sit in different offices Admissible heuristic 1: ignore preconditions: Basically counts how many subgoals are not achieved yet Can simply apply DeliverCoffee(person) action for each person Admissible heuristic 2: ignore delete lists Rewrite effects as add and delete lists, e.g.: Add list for pick-up coffee : rhc Delete list for deliver coffee : rhc Here: Ignore delete lists once you have coffee you keep it Problem gets easier: only need to pick up coffee once, navigate to the right locations, and deliver Admissible, but typically more realistic than ignoring preconditions 10

Lecture Overview Recap: STRIPS, forward planning & heuristics Recap: CSP planning More CSP planning - Details on CSP representation - Solving the CSP planning problem Time permitting: Intro to Logic 11

Planning as a CSP Idea: reformulate a STRIPS model as a set of variables and constraints What are variables in the CSP? (more than one answer is correct) The STRIPS variables The values of the STRIPS variables The STRIPS actions The STRIPS preconditions We have CSP variables for both - STRIPS variables and - STRIPS actions 12

Planning as a CSP: General Idea Both features and actions are CSP variables One CSP variable for each STRIPS feature for each time step One (Boolean) CSP variable for each time step for each action Main Constraints: Between actions at time t and previous state variables (time t) When does an action apply? (precondition constraints) Between actions at time t and following state variables (time t+1) How does an action change the variables? (effect constraints) 13

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) Truth table for this constraint: list allowed combinations of values RLoc 0 RHC 0 PUC 0 cs cs cs T T mr * Need to allow for the option of *not* taking an action even when it is valid lab * off * 14

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 T T T T T T T T T T T T T 15

Planning as a CSP What gives rise to constraints in the CSP? (more than one answer is correct) The STRIPS preconditions The STRIPS effects The STRIPS start state The STRIPS goal condition All of them! Plus, constraints between each variable V at time t and t+1: - If no action changes V, it stays the same - Called a frame constraint 16

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 E.g. start condition: Sam wants coffee E.g. goal condition: Sam doesn t want coffee true false

Lecture Overview Recap: STRIPS, forward planning & heuristics Recap: CSP planning More CSP planning - Details on CSP representation - Solving the CSP planning problem Time permitting: Intro to Logic 18

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 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 DelM i T DelC i T 19

Handling mutex constraints in orward 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?) Via the actions effects (how?) No need to enforce this constraint in orward Planning None of the above DelM i T DelC i T 20

Handling mutex constraints in orward 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? DelM i T DelC i T No need to enforce this constraint in orward Planning Because forward planning gives us a sequence of actions: only one action is carried out at a time anyways 21

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 T RHM i T 22

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

Handling state constraints in orward Planning RHC i How could we handle these constraints in STRIPS for forward planning? T RHM i T 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

Lecture Overview Recap: STRIPS, forward planning & heuristics Recap: CSP planning More CSP planning - Details on CSP representation - Solving the CSP planning problem Time permitting: Intro to Logic 25

CSP Planning: Solving the problem Map STRIPS Representation into CSP for horizon 0,1, 2, 3, Solve CSP for horizon 0, 1, 2, 3, until solution found at the lowest possible horizon K = 0 Is there a solution for this horizon? If yes, DONE! If no, continue 26

CSP Planning: Solving the problem Map STRIPS Representation into CSP for horizon 0,1, 2, 3, Solve CSP for horizon 0, 1, 2, 3, until solution found at the lowest possible horizon K = 1 Is there a solution for this horizon? If yes, DONE! If no, continue 27

CSP Planning: Solving the problem Map STRIPS Representation into CSP for horizon 0,1, 2, 3, Solve CSP for horizon 0, 1, 2, 3, until solution found at the lowest possible horizon K = 2: Is there a solution for this horizon? If yes, DONE! If no.continue 28

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 Search Arc consistency + domain splitting Not SLS! SLS cannot determine that no solution exists! 29

STRIPS to CSP Conversion applet 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 Take it for a spin on sample problems! Assignment #3. 30

Learning Goals for Planning STRIPS Represent a planning problem with the STRIPS representation Explain the STRIPS assumption orward 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 31

Some applications of planning Emergency Evacuation Robotics Space Exploration Manufacturing Analysis Games (e.g. Bridge) Product Recommendations North " Q " 9 " J " 7 " 6 " 5 " A " A " K " 9 " 5 " 3 West " 6 " 2 " Q " 8 East South

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

Lecture Overview Recap: STRIPS, forward planning & heuristics Recap: CSP planning More CSP planning - Details on CSP representation - Solving the CSP planning problem Time permitting: Intro to Logic 34

Problem Type Static Sequential Constraint Satisfaction Logic Planning Back to static problems, but with richer representation Course Overview Deterministic Arc Consistency Variables + Search Constraints Logics STRIPS Search Environment Search As CSP (using arc consistency) Stochastic Bayesian Networks Variable Elimination Decision Networks Variable Elimination Markov Processes Value Iteration Course Module Representation Reasoning Technique Uncertainty Decision Theory 35

Logics in AI: Similar slide to the one for planning Propositional Definite Clause Logics Semantics and Proof Theory Propositional Logics irst-order Logics Satisfiability Testing (SAT) Description Logics Ontologies Production Systems Cognitive Architectures Hardware Verification Software Verification Product Configuration Semantic Web Information Extraction Video Games Summarization Applications Tutoring Systems 36

Logics in AI: Similar slide to the one for planning Propositional Definite Clause Logics Semantics and Proof Theory Propositional Logics irst-order Logics Satisfiability Testing (SAT) Description Logics Production Systems Hardware Verification Software Verification Ontologies Semantic Web Information Extraction Cognitive Architectures Video Games Summarization Tutoring Systems Product Configuration You will know You will know a little Applications 37

What you already know about logic... rom programming: Some logical operators If ((amount > 0) && (amount < 1000))!(age < 30)... You know what they mean in a procedural way Logic is the language of Mathematics. To define formal structures (e.g., sets, graphs) and to prove statements about those (x)triangle(x) " " [A = B = C " α = β = γ] We use logic as a Representation and Reasoning System that can be used to formalize a domain and to reason about it 38

Logic: a framework for representation & reasoning When we represent a domain about which we have only partial (but certain) information, what are some of the things we need to represent? 39

Logic: a framework for representation & reasoning When we represent a domain about which we have only partial (but certain) information, we need to represent. Objects, properties, sets, groups, actions, events, time, space, All these can be represented as Objects Relationships between objects Logic is the language to express knowledge about the world this way http://en.wikipedia.org/wiki/john_mccarthy (1927-2011) Logic and AI The Advice Taker Coined Artificial Intelligence. Dartmouth W shop (1956) 40

Why Logics? Natural to express knowledge about the world (more natural than a flat set of variables & constraints) e.g. Every 101 student will pass the course Course (c1) Name-of (c1, 101) (z)student(z)& registered(z, c1) " " will _ pass(z, c1) It is easy to incrementally add knowledge It is easy to check and debug knowledge Provides language for asking complex queries Well understood formal properties 41

Learning Goals for Planning STRIPS Represent a planning problem with the STRIPS representation Explain the STRIPS assumption orward 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 Assignment 3 is available Due in 2 weeks. Do the planning part early Useful to do practice exercise 7 before the assignment 42