Time Constraints in Planning Sudhan Kanitkar

Slides:



Advertisements
Similar presentations
Forward-Chaining Partial-Order Planning Amanda Coles, Andrew Coles, Maria Fox and Derek Long (to appear, ICAPS 2010)
Advertisements

Knowledge Engineering for Planning Domain Design Ron Simpson University of Huddersfield.
REVIEW : Planning To make your thinking more concrete, use a real problem to ground your discussion. –Develop a plan for a person who is getting out of.
In the name of God An Application of Planning An Application of PlanningJSHOP BY: M. Eftekhari and G. Yaghoobi.
Language for planning problems
CSE391 – 2005 NLP 1 Planning The Planning problem Planning with State-space search.
Planning
Planning II: Partial Order Planning
Hierarchical Task Network (HTN) Planning Hai Hoang 4/17/2007.
Planning Module THREE: Planning, Production Systems,Expert Systems, Uncertainty Dr M M Awais.
Causal-link Planning II José Luis Ambite. 2 CS 541 Causal Link Planning II Planning as Search State SpacePlan Space AlgorithmProgression, Regression POP.
Temporal Constraints Time and Time Again: The Many Ways to Represent Time James F Allen.
Planning Module THREE: Planning, Production Systems,Expert Systems, Uncertainty Dr M M Awais.
CLASSICAL PLANNING What is planning ?  Planning is an AI approach to control  It is deliberation about actions  Key ideas  We have a model of the.
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
Exploiting Symmetry in Planning Maria Fox Durham Planning Group University of Durham, UK.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
PLANNING Ivan Bratko Acknowledgement: Some of these slides were adapted from D. Nau’s course on planning.
Classical Planning via Plan-space search COMP3431 Malcolm Ryan.
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
Plan Generation & Causal-Link Planning 1 José Luis Ambite.
Hybrid Systems Presented by: Arnab De Anand S. An Intuitive Introduction to Hybrid Systems Discrete program with an analog environment. What does it mean?
Parallel and Distributed Simulation Lookahead Deadlock Detection & Recovery.
Lookahead. Outline Null message algorithm: The Time Creep Problem Lookahead –What is it and why is it important? –Writing simulations to maximize lookahead.
1 Chapter 16 Planning Methods. 2 Chapter 16 Contents (1) l STRIPS l STRIPS Implementation l Partial Order Planning l The Principle of Least Commitment.
Planning systems and its’ applications in software engineering Saša Tošić, M. Ivanović Risan, 2007.
Artificial Intelligence 2005/06
Classical Planning via State-space search COMP3431 Malcolm Ryan.
Planning Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 11.
Ordering and Consistent Cuts Presented By Biswanath Panda.
Extending Graphplan to handle Resources Presenter: Pham Van Cuong Department of Computer Science New Mexico State University.
Planning Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 11.
Chapter 5 Outline Formal definition of CSP CSP Examples
Universal Plans for Reactive Robots in Unpredictable Environments By M.J. Schoppers Presented by: Javier Martinez.
Automated Planning and HTNs Planning – A brief intro Planning – A brief intro Classical Planning – The STRIPS Language Classical Planning – The STRIPS.
Chapter 3: Arrays, Linked Lists, and Recursion
1 Planning Chapters 11 and 12 Thanks: Professor Dan Weld, University of Washington.
Classical Planning via State-space search COMP3431 Malcolm Ryan.
C o n f i d e n t i a l Developed By Nitendra NextHome Subject Name: Data Structure Using C Title: Overview of Data Structure.
Homework 1 ( Written Portion )  Max : 75  Min : 38  Avg : 57.6  Median : 58 (77%)
State-Space Search and the STRIPS Planner Searching for a Path through a Graph of Nodes Representing World States.
Planning, page 1 CSI 4106, Winter 2005 Planning Points Elements of a planning problem Planning as resolution Conditional plans Actions as preconditions.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Basic Semantics Associating meaning with language entities.
Kurt Jensen Lars M. Kristensen 1 Coloured Petri Nets Department of Computer Science Coloured Petri Nets Modelling and Validation of Concurrent Systems.
RUN-Time Organization Compiler phase— Before writing a code generator, we must decide how to marshal the resources of the target machine (instructions,
1 Chapter 16 Planning Methods. 2 Chapter 16 Contents (1) l STRIPS l STRIPS Implementation l Partial Order Planning l The Principle of Least Commitment.
Automated Planning Dr. Héctor Muñoz-Avila. What is Planning? Classical Definition Domain Independent: symbolic descriptions of the problems and the domain.
AI Lecture 17 Planning Noémie Elhadad (substituting for Prof. McKeown)
Fall 2008Programming Development Techniques 1 Topic 17 Assignment, Local State, and the Environment Model of Evaluation Section 3.1 & 3.2.
1 CMSC 471 Fall 2004 Class #21 – Thursday, November 11.
1 CMSC 471 Fall 2002 Class #24 – Wednesday, November 20.
Planning I: Total Order Planners Sections
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
1 CSC 384 Lecture Slides (c) , C. Boutilier and P. Poupart CSC384: Lecture 16  Last time Searching a Graphplan for a plan, and relaxed plan heuristics.
Simulation Examples And General Principles Part 2
CHAPTER 51 LINKED LISTS. Introduction link list is a linear array collection of data elements called nodes, where the linear order is given by means of.
Classical Planning via State-space search
Discrete Event Simulation
Knowledge Representation
Class #17 – Thursday, October 27
Planning José Luis Ambite.
Graphplan/ SATPlan Chapter
Class #19 – Monday, November 3
Class #20 – Wednesday, November 5
Coloured Petri Nets Modelling and Validation of Concurrent Systems
Graphplan/ SATPlan Chapter
A simple function.
Graphplan/ SATPlan Chapter
Presentation transcript:

Time Constraints in Planning Sudhan Kanitkar

References Fahiem Bacchus, Michael Ady “Planning with Resources and Concurrency A Forward Chaining Approach” Ch. 13 Time for Planning Ch. 14 Temporal Planning

Agenda TLPlan – Practical Approach –Functions, Timestamped States, Queues –Algorithm, Example –Changes needed in the domain A more theoretical but expressive approach described in the textbook.

TLPlan Functions –Similar to state variable representation discussed earlier Timestamped States Queues

Functions In traditional planning States are represented as databases (sets) of predicate instances and operators as making changes to these databases. It is needed to add/delete all the predicates (drive ?t ?l ?l’). (forall (?o) (int ?o ?t) (and (add (at ?o ?l’)) (del (at ?o ?l)))) )

Functions Instead of having predicates for all facts we use functions. Functions seem to analogous to variables in programming languages They represent values Predicate (at ?x ?l) just describes the location of object x. Instead model the location of the object using a function (loc ?x)

Functions (Cont’d) (loc ?x) acts just like a variable which describes the location of the object x. In the drive predicate we make the following changes (drive ?t ?l ?l’). (forall (?o) (in ?o ?t) (add (= (loc ?o) ?l))) ) Recall State-Variable Representation

Functions – More Examples Predicate (refuel ?t) refuels the truck t (capacity ?t) is the fuel capacity of the truck (fuel ?t) is the current level of fuel (fuel-used) is a total fuel used globally (refuel ?t) (and (add (= (fuel-used) (+ (fuel-used) (- (capacity ?t) (fuel ?t))))) (add (= (fuel ?t) (capacity ?t))) )

Forward chaining Planners Forward chaining has proved to be useful for high-performance planners. Domain independent heuristics for search Drawback: They explore only totally ordered sequences of action. Hence, modeling concurrent actions with linear sequences become problematic –e.g. Two trucks in two different locations can travel simultaneously in parallel. –Plans generated by GraphPlan

Why make time explicit ? Model the duration of action Model the effects and conditions of an action at various points along duration Handle goals with relative and absolute temporal constraints To be able to use events happening in the future which are not immediate effects of actions

Principle In classical planners the effects of an action are visible immediately and hence validating the preconditions of further action This approach suppresses the visibility of effects for the duration of action Hence the further actions which use these effects as preconditions cannot be used.

Timestamps Associate with each state a timestamp Timestamp starts with a fixed start time in the initial state Denotes the actual time the state will occur during the execution of a plan Timestamp of a successive state changes only when no other action can be applied and it is necessary to wait for an action that takes some time to finish. The effects which are not delayed still become available instantaneously

Queue State also has an event queue Queue has updates scheduled to occur at some time in the future These updates are predicates and time at which they become effective Each state inherits the pending events of its parent state

Actions s is the current state a is an action which is applicable to s only if it satisfies all the preconditions of s. Applying a to s generates a new successor state s + An action can have two kinds of effects –Instantaneous effects –Delayed effects

Example (def-adl-operator (drive ?t ?l ?l’) (pre (?t) (truck ?t) (?l) (loc ?l) (?l’) (loc ?l’) (at ?t ?l) ) (del (at ?t ?l)) (delayed-effect (/ (dist ?l ?l’) (speed ?t)) (arrived-driving ?t ?l ?l’) (add (at ?t ?l’)) ) Instantaneous Effect Delayed Effect

Why two types of effects ?? Instantaneous effects make sure that objects in question are not reused Delayed effects ensure that the timing constraints are satisfied (add (at ?t ?l’)) Delayed Effect

delayed-action Parameters –delta: the time further from the current time that the action is time stamped with Instantaneous effects change the database of s immediately Delayed effects are added to the queue of the state to be applied later

unqueue-event Action A mechanism is needed which will remove events from the queue when the time is up and update the database A special action Advances the world clock Remove all actions scheduled for current time from the queue and update the database

Planning Algorithm State & Queue pair Advance to new state Record Previous State Record Action New timestamp Apply all updates with current timestamp from the queue Two types of Updates Non-deterministic:Operator or unqueue-event

Notes on Algorithm The non-deterministic choice operator is realized by search. The choice of which action to try is made by heuristic or domain specific control Temporal Control Formula from previous class Instead of a plan the final goal state is returned The sequence of actions leading to the goal can be determined using action and prev pointers

TLPlan support Following actions can be defined for TLPlan –(delayed-action delta tag formula) –(wait-for-next-event) TLPlan Manual link – –Look for section titled “Support for Concurrent Planning”

l1 l0 Example v0 c0 Goal: Get cargo at location l0 (at c0 l0) Plan: move(v0,l0,l1) load(c0,v0,l1) move(v0,l1,l0) unload(c0,v0,l0) State: (at v0 l0) (at c0 l1) Queue:State: (at c0 l1) Queue: (at v0 l1) State: (at c0 l1) (at v0 l1) Queue:State: (at v0 l1) (in c0 v0) State: (in c0 v0) Queue: (at v0 l0) State: (at v0 l0) (in c0 v0) State: (at v0 l0) (at c0 l0) Thanks: Joe Souto

Importance of control Formula 0 (move v0 l0 l1 f2 f1) 20 (event (moving-truck v0 l0 l1 f2 f1)) 20 (load c0 v0 l1 s1 s0) 20 (move v0 l1 l0 f1 f0) 40 (event (moving-truck v0 l1 l0 f1 f0)) 40 (unload c0 v0 l0 s0 s1) 0 (move v0 l0 l1 f1 f0) 0 (move v1 l1 l0 f2 f1) 20 (event (move v0 l1 l0 f1 f0) 20 (load c0 v1 l0 s2 s1) 20 (load c1 v1 l0 s1 s0) 20 (unload c0 v1 l0 s0 s1) 20 (donate l2 l0 f2 f1 f0 f0 f1) 20 (load c0 v1 l0 s1 s0) Note Redundant actions

Changes in Domain File (define (domain mprime-strips) (:types space vehicle cargo) (:predicates (at ?v ?l) (conn ?l1 ?l2) (has-fuel ?l ?f) (fuel-neighbor ?f1 ?f2) (in ?c ?v) (has-space ?v ?s) (space-neighbor ?s1 ?s2) (not-equal ?l1 ?l2) ).. (declare-described-symbol (predicate cargo-at 2) (predicate vehicle-at 2) (predicate conn 2) (predicate has-fuel 2) (predicate fuel-neighbor 2) (predicate in 2) (predicate has-space 2) (predicate space-neighbor 2) (predicate not-equal 2) )..

Changes in Domain File (:action move :parameters ( ?v - vehicle ?l1 ?l2 - location ?f1 ?f2 – fuel) :precondition (and (at ?v ?l1).. (fuel-neighbor ?f2 ?f1)) :effect (and (not (at ?v ?l1)).. (has-fuel ?l1 ?f2))) (def-adl-operator (move ?v ?l1 ?l2 ?f1 ?f2) (pre (?v ?l1) (vehicle-at ?v ?l1) (?l2) (conn ?l1 ?l2) (?f1) (has-fuel ?l1 ?f1) (?f2) (fuel-neighbor ?f2 ?f1)) (del (vehicle-at ?v ?l1) (has-fuel ?l1 ?f1)) (delayed-action 20 (moving-truck ?v ?l1 ?l2 ?f1 ?f2) (add (vehicle-at ?v ?l2) (has-fuel ?l1 ?f2) )))

Changes in Domain File Add operator to unqueue events (def-adl-operator (event) (wait-for-next-event) ) Add to the top of the domain file (enable concurrent-planning))

Changes in Problem File define (problem strips-mprime-..-c4) (:domain mprime-strips) (:objects f0 f1 f2 - fuel.. c0 c1 - cargo) (:init (not-equal l0 l1) (not-equal l0 l2). ) (:goal (and (at c0 l0).. (at c1 l2) )) (define (state0) (not-equal l0 l1) (not-equal l0 l2) (not-equal l1 l0).. ) (define goal0 (cargo-at c0 l0) (cargo-at c1 l2) )

Break After the break we will look at the one theoretical approach

Formal Representation Formal representation of a temporal planning domain has following objects Symbols Relations –Rigid Relations –Flexible Relations Constraints –Temporal Constraints –Binding Constraints

Symbols Constant Symbols –Objects which remain constant over time or state changes –Objects of classes such as robot, crane Variable Symbols –Objects whose value changes over time or state changes –e.g. temporal variables ranging over R

Relations Rigid Relations –Relations which do not change over time or state transitions –e.g. adjacent(loc1,loc2) Flexible Relations –Also called Fluents –Relations which invalidate/validate over a period of time –e.g. at(robot1,loc1)

Constraints Binding constraints Temporal constraints –If t 1 and t 2 are two temporal variables and r is a constraint defined on them –r = 2 P –P = {,=} –2 P ={Φ,{ },{,=},{>,<},P}

Temporally Qualified Expression A temporally qualified expression (tqe) is an expression of the form p(ζ 1,…, ζ k s,t e ] -p is a flexible relation -ζ 1,…, ζ k are constants or object variables -t s,t e are temporal variables such that t s <t e -A tqe asserts that for the time range t s ≤t<t e the relation p(ζ 1,…, ζ k ) holds

Temporal Database A temporal database is a pair Φ = (F,C) -F is a finite set of tqes -C is a finite set of temporal and object constraints

Textbook. Pg: 312

Enabling Conditions In the temporal database shown previously there are two instances of tqe This tqe holds w.r.t to database only if one of the following holds: –{l=loc3, τ 0 ≤ t, t’ ≤ τ 5 } –{l=loc2, τ 6 ≤ t, t’ ≤ τ 7 } These two sets of constraints are called enabling conditions for the tqe to be supported by F One of them has to be consistent with C for the database to support the tqe.

Definitions A set F supports a tqe e = p(ζ 1,…,ζ k 1,t 2 ] iff there is in F a tqe p(ζ 1 ’,…,ζ k 1,τ 2 ] and a substitution σ such that σ(p(ζ 1,…,ζ k )) = σ(p(ζ 1 ’,…,ζ k ’)) and An enabling condition for e in F is conjunction of the temporal constraints τ 1 ≤ t 1 and t 2 ≤ τ 2 with binding constraints of σ. θ(e/F) is set of all the possible enabling conditions for e in F. θ(ε/F) is set of all the possible enabling conditions for a set of tqes ε in F. In this case F is said to support ε. A temporal database Φ=(F,C) supports a set of tqes ε if all the enabling conditions c Є θ(ε/F) are consistent with C. Φ=(F,C) supports another database (F’,C’) when F supports F’ and there is an enabling condition c Є θ(F’/F) such that C’ U c is consistent with C.

Temporal Planning Operators It’s a tuple o = (name(o), precond(o), effects(o), const(o)) name is an expression of form o(x 1,…x k, t s, t e ) such that o is an operator, x 1,…x k are object variables, t s, t e are temporal variables precond(o) and effects(o) are tqes const(o) is a conjunction of constraints

Temporal Planning Operator - Action is a partially instantiated operator - If preconditions and constraints of an action hold then action will run from t s to t e. -effects describe the new tqes that result from an action Textbook. Pg: 315

Applicability of an Action An action a is applicable to a temporal database (F,C) if and only if precond(a) is supported by F and there is an enabling condition c in θ(a/F) for the a such that C U const(a) U c is consistent with the set of constraints Γ(Φ,a) = {(F U effects(a), C U const(a) U c | c Є θ(a/F)} Note that actions are applied to database and the result is a set databases since action can be applied differently at different times.

Domain Axioms The operators described till now do not express the negative effects of the actions The action thus keeps on increasing the size of the database where we might have conflicting statements appearing. Domain axioms is the mechanism used to overcome this shortcoming. Domain axiom is a conditional expression of the form p = cond(p)  disj(p) -cond(p) is a set of tqes -disj(p) is a disjunction of temporal and object constraints

Domain Axiom (Cont’d) Consider a scenario which has two robots r and r’ an two locations l and l’ - s,t e s ’,t e ’)}  (r ≠ r’) v (l = l’) v (t e ≤ t s ’) v (t e ’ ≤ t s ) - 1,t 1 2,t 2 ’)}  (l ≠ l’) v (t 1 ’ ≤ t 2 ) v (t 2 ’ ≤ t 1 )

Domain Axiom Support Let p be an axiom and Φ=(F,C) be a temporal database such that cond(p) is supported by F and θ(p/F) is set of enabling conditions for cond(p) in F. Φ is consistent with p iff for each enabling condition c 1 in θ(p/F) there is atleast one disjunct c 2 in disj(p) such that C U c 1 U c 2 is consistent set of constraints. This means that for every for every tqe to be supported by F, there is needs to be atleast one disjunct in disj(p) which is consistent with Φ or C. A consistency condition for Φ w.r.t a set of axioms X is: A set of all such conditions is denoted by θ(X/F)

Domain Axioms- Actions So for a set of axioms to be applicable the consistency condition needs to satisfied As result we get a new set of databases as Earlier it was mentioned that effect of applying an action a to Φ is a set of databases. Many of these databases may not be consistent with X So we now restrict that definition to only those databases which are consistent with X as follows:

Temporal Planning Domain A temporal Planning domain is the triple D = (Λ Φ, O, X) - Λ Φ is set of all temporal databases that can be defined - O is a set of temporal planning operators - X is a set of domain axioms

Temporal Planning Problem Is the triple P = (D, Φ 0, Φ g ) –D is the planning domain –Φ 0 = ( F,C ) is the initial state of the domain –Φ g = ( G,C g ) is the goal state of the domain The statement of the problem is given by –P = (O, X, Φ 0, Φ g )

TPS Procedure Note the similarity with Plan-space Planning approach

TPS Procedure It maintains the data structure Ω. Ω = { Φ, G, K, π } Φ = { F, C } is the current temporal database G is a set of tqes corresponding to current open goals K = { C 1,…,C 2 } is the set of pending enabling conditions of actions, consistency conditions of axioms π is a set of actions corresponding to current plan

A tqe in F can support a tqe e Є G if there is an enabling condition θ(e/F). Updates are –K  K U {θ(e/F)} –G  G – {e} Updates owing to action a for this goal –π  π U {a} –F  F U effects( a ) –C  C U const( a ) –G  ( G – {e} ) U precond( a ) –K  K U {θ(a/ Φ )} Flaws – Open Goals

Flaws - Axioms and Threat Unsatisfied Axioms –These flaws are possible inconsistencies of instances of Φ w.r.t to the axioms of X. –A resolver is a set of consistency conditions θ(X/ Φ ) –K  K U {θ(X/ Φ )} Threats –Over the period of time we have kept on adding new constraints which are required to be solved to K. –For every Ci in K, the resolver is a constraint c such that: –C  C U c –K  K - {C i }

Thank You

Thank You

Example precond: effects: const: ts < t4 < t2 adjacent(l,l’) Temporal Constraints Binding Constraints

l1 l0 Example v0 c0 Goal: Get cargo at location l0 Plan: move(v0,l0,l1) load(c0,v0,l1) move(v0,l1,l0) unload(c0,v0,l0) State: (at v0 l0) (at c0 l1) Queue:State: (at c0 l1) Queue: (at v0 l1) State: (at c0 l1) (at v0 l1) Queue:State: (at v0 l1) (in c0 v0) State: (in c0 v0) Queue: (at v0 l0) State: (at v0 l0) (in c0 v0) State: (at v0 l0) (at c0 l0)

l1 l0 Example v0 c0 Goal: Get cargo at location l0 move(v0,l0,l1) load(c0,v0,l1) move(v0,l1,l0) unload(c0,v0,l0)