A Temporally Expressive Planner Based on ASP with Constraints Preliminary Design Forrest Sheng Bao Sandeep Chintabathina Ricardo Morales Nelson Rushton Richard Watson Yuanlin Zhang KR Lab, CS, Texas Tech 12/08/2010 Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 1 / 23 A Running Example: The Two-faucet World Tank 1 Tank 2 faucet 1 faucet 2 Sink Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner Vol 12/08/2010 2 / 23 Introduction Temporally expressive planning requires concurrency among actions. Previous approaches cannot handle temporal expressiveness or cannot handle well. We try to translate temporally expressive planning problems in PDDL2.1 into ACC programs and find the plan using ACC solvers. Our approach can solve drawbacks of existing other approaches. Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 3 / 23 1 Introduction 2 An Abstract PDDL Syntax Building Blocks Continuous Durative Actions PDDL Planning Problems 3 Translation from PDDL to ACC Building Blocks Continuous Durative Actions Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 4 / 23 Signatures constants –N I I f 1: faucet 1 f 2: faucet 2 fluents – P I I opened(F ): faucet F is opened. stuck(F ): faucet F is stuck. variables – X I I Sink: amount of water in the sink Tank (F ): amount of water in tank above faucet F Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 5 / 23 Signatures constants –N I I f 1: faucet 1 f 2: faucet 2 fluents – P I I opened(F ): faucet F is opened. stuck(F ): faucet F is stuck. variables – X I I Sink: amount of water in the sink Tank (F ): amount of water in tank above faucet F Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 5 / 23 Signatures constants –N I I f 1: faucet 1 f 2: faucet 2 fluents – P I I opened(F ): faucet F is opened. stuck(F ): faucet F is stuck. variables – X I I Sink: amount of water in the sink Tank (F ): amount of water in tank above faucet F Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 5 / 23 1 Introduction 2 An Abstract PDDL Syntax Building Blocks Continuous Durative Actions PDDL Planning Problems 3 Translation from PDDL to ACC Building Blocks Continuous Durative Actions Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 6 / 23 Continuous Durative Actions Example (a durative action) h open(F ), h?duration ≤ Tank (F )/flowRate(F )i, h ¬opened(F ) ∧ ¬stuck(F ), Tank(F ) > 0, ¬stuck (F ) ∧ opened(F ) i, h opened(F ), Sink increase flowRate(F ) ∗ ∆t ∧ Tank (F ) decrease flowRate(F ) ∗ ∆t, ¬opened(F ) i i Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 7 / 23 Continuous Durative Actions Example (a durative action) h open(F ), h?duration ≤ Tank (F )/flowRate(F )i, h ¬opened(F ) ∧ ¬stuck (F ), Tank(F ) > 0, ¬stuck (F ) ∧ opened(F ) i, h opened(F ), Sink increase flowRate(F ) ∗ ∆t ∧ Tank (F ) decrease flowRate(F ) ∗ ∆t, ¬opened(F ) i i Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 7 / 23 Continuous Durative Actions Example (a durative action) h open(F ), h?duration ≤ Tank (F )/flowRate(F )i, h ¬opened(F ) ∧ ¬stuck (F ), Tank(F ) > 0, ¬stuck (F ) ∧ opened(F ) i, h opened(F ), Sink increase flowRate(F ) ∗ ∆t ∧ Tank (F ) decrease flowRate(F ) ∗ ∆t, ¬opened(F ) i i Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 7 / 23 Continuous Durative Actions Example (a durative action) h open(F ), h?duration ≤ Tank (F )/flowRate(F )i, h ¬opened(F ) ∧ ¬stuck (F ), Tank(F ) > 0, ¬stuck (F ) ∧ opened(F ) i, h opened(F ), Sink increase flowRate(F ) ∗ ∆t ∧ Tank (F ) decrease flowRate(F ) ∗ ∆t, ¬opened(F ) i i Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 7 / 23 Continuous Durative Actions Example (a durative action) h open(F ), h?duration ≤ Tank (F )/flowRate(F )i, h ¬opened(F ) ∧ ¬stuck (F ), Tank(F ) > 0, ¬stuck (F ) ∧ opened(F ) i, h opened(F ), Sink increase flowRate(F ) ∗ ∆t ∧ Tank (F ) decrease flowRate(F ) ∗ ∆t, ¬opened(F ) i i Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 7 / 23 Continuous Durative Actions Example (a durative action) h open(F ), h?duration ≤ Tank (F )/flowRate(F )i, h ¬opened(F ) ∧ ¬stuck (F ), Tank(F ) > 0, ¬stuck (F ) ∧ opened(F ) i, h opened(F ), Sink increase flowRate(F ) ∗ ∆t ∧ Tank (F ) decrease flowRate(F ) ∗ ∆t, ¬opened(F ) i i Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 7 / 23 Continuous Durative Actions Example (a durative action) h open(F ), h?duration ≤ Tank (F )/flowRate(F )i, h ¬opened(F ) ∧ ¬stuck (F ), Tank(F ) > 0, ¬stuck (F ) ∧ opened(F ) i, h opened(F ), Sink increase flowRate(F ) ∗ ∆t ∧ Tank (F ) decrease flowRate(F ) ∗ ∆t, ¬opened(F ) i i Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 7 / 23 Continuous Durative Actions Example (a durative action) h open(F ), h?duration ≤ Tank (F )/flowRate(F )i, h ¬opened(F ) ∧ ¬stuck (F ), Tank(F ) > 0, ¬stuck (F ) ∧ opened(F ) i, h opened(F ), Sink increase flowRate(F ) ∗ ∆t ∧ Tank (F ) decrease flowRate(F ) ∗ ∆t, ¬opened(F ) i i Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 7 / 23 1 Introduction 2 An Abstract PDDL Syntax Building Blocks Continuous Durative Actions PDDL Planning Problems 3 Translation from PDDL to ACC Building Blocks Continuous Durative Actions Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 8 / 23 PDDL Planning Problems A PDDL planning problem consists of: A set of actions. An initial state, a conjunction of ground fluents and numeric constraints Example (An initial state) {Sink = 0, Tank(f 1, 0) = 5, Tank(f , 0) = 5, ¬opened(f 1), ¬opened(f 2), ¬stuck (f 1), ¬stuck(f 2), flowRate(f 1) = 2, flowRate(f 2) = 3} A goal state, a conjunction of ground fluents and numeric constraints. Example (A goal state) {Sink = 5} Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 9 / 23 PDDL Planning Problems A PDDL planning problem consists of: A set of actions. An initial state, a conjunction of ground fluents and numeric constraints Example (An initial state) {Sink = 0, Tank(f 1, 0) = 5, Tank(f , 0) = 5, ¬opened(f 1), ¬opened(f 2), ¬stuck (f 1), ¬stuck(f 2), flowRate(f 1) = 2, flowRate(f 2) = 3} A goal state, a conjunction of ground fluents and numeric constraints. Example (A goal state) {Sink = 5} Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 9 / 23 PDDL Planning Problems A PDDL planning problem consists of: A set of actions. An initial state, a conjunction of ground fluents and numeric constraints Example (An initial state) {Sink = 0, Tank(f 1, 0) = 5, Tank(f , 0) = 5, ¬opened(f 1), ¬opened(f 2), ¬stuck (f 1), ¬stuck(f 2), flowRate(f 1) = 2, flowRate(f 2) = 3} A goal state, a conjunction of ground fluents and numeric constraints. Example (A goal state) {Sink = 5} Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 9 / 23 Plans A plan is a set of timed pairs of either the form (t, a[t 0 ]) or (t, a) where t is a time, a an action name and t 0 a time specifying the duration of a durative action. A valid plan for “two-faucet” example is h(0, open(f 1)[1]), (0, open(f 2)[1])i. Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 10 / 23 Plans A plan is a set of timed pairs of either the form (t, a[t 0 ]) or (t, a) where t is a time, a an action name and t 0 a time specifying the duration of a durative action. A valid plan for “two-faucet” example is h(0, open(f 1)[1]), (0, open(f 2)[1])i. Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 10 / 23 1 Introduction 2 An Abstract PDDL Syntax Building Blocks Continuous Durative Actions PDDL Planning Problems 3 Translation from PDDL to ACC Building Blocks Continuous Durative Actions Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 11 / 23 Predicates Example (Predicates for the “two-faucet” world) opened(F ) =⇒ opened(F , S) stuck (F ) =⇒ stuck (F , S) (introduced) =⇒ occurs(A, S) More will be added later. Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 12 / 23 Numeric Variables and Functions Example (Functions for the “two-faucet” world) Sink =⇒ Sink(S) ∈ R Tank(F ) =⇒ Tank(F , S) ∈ R (introduced) =⇒ at(S) ∈ the domain of time More will be added later. Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 13 / 23 Initial States Example (A set of facts representing an initial state) ¬opened(f 1, 0). ¬opened(f 2, 0). ¬stuck (f 1, 0). ¬stuck (f 2, 0). Sink(0) = 0. Tank(f 1, 0) = 5. Tank(f 2, 0) = 5. Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 14 / 23 Goal States Example (A set of rules representing a goal state) goal ← Sink(S) = 5. ← not goal. Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 15 / 23 1 Introduction 2 An Abstract PDDL Syntax Building Blocks Continuous Durative Actions PDDL Planning Problems 3 Translation from PDDL to ACC Building Blocks Continuous Durative Actions Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 16 / 23 Divide and Conquer Original action h open(F ), h?duration ≤ tank(F )/flowRate(F )i, h ¬opened(F ) ∧ ¬stuck (F ), Tank (F ) > 0, ¬stuck (F ) ∧ opened(F ) i, h opened(F ), Sink increase flowRate(F ) ∗ ∆t ∧ Tank(F ) decrease flowRate(F ) ∗ ∆t, ¬opened(F ) i i Now it becomes A new action for “at start”: h opens (F ), ¬opened(F ) ∧ ¬stuck(F ), opened(F )i and a new action for “at end”: h opene (F ), ¬stuck(F ) ∧ opened(F ), ¬opened(F )i Later we will discuss about invariant monitoring and constinuous assignment. Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 17 / 23 Divide and Conquer Original action h open(F ), h?duration ≤ tank(F )/flowRate(F )i, h ¬opened(F ) ∧ ¬stuck (F ), Tank (F ) > 0, ¬stuck (F ) ∧ opened(F ) i, h opened(F ), Sink increase flowRate(F ) ∗ ∆t ∧ Tank(F ) decrease flowRate(F ) ∗ ∆t, ¬opened(F ) i i Now it becomes A new action for “at start”: h opens (F ), ¬opened(F ) ∧ ¬stuck(F ), opened(F )i and a new action for “at end”: h opene (F ), ¬stuck(F ) ∧ opened(F ), ¬opened(F )i Later we will discuss about invariant monitoring and constinuous assignment. Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 17 / 23 Divide and Conquer Original action h open(F ), h?duration ≤ tank(F )/flowRate(F )i, h ¬opened(F ) ∧ ¬stuck (F ), Tank (F ) > 0, ¬stuck (F ) ∧ opened(F ) i, h opened(F ), Sink increase flowRate(F ) ∗ ∆t ∧ Tank(F ) decrease flowRate(F ) ∗ ∆t, ¬opened(F ) i i Now it becomes A new action for “at start”: h opens (F ), ¬opened(F ) ∧ ¬stuck(F ), opened(F )i and a new action for “at end”: h opene (F ), ¬stuck(F ) ∧ opened(F ), ¬opened(F )i Later we will discuss about invariant monitoring and constinuous assignment. Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 17 / 23 Divide and Conquer Original action h open(F ), h?duration ≤ tank(F )/flowRate(F )i, h ¬opened(F ) ∧ ¬stuck (F ), Tank (F ) > 0, ¬stuck (F ) ∧ opened(F ) i, h opened(F ), Sink increase flowRate(F ) ∗ ∆t ∧ Tank(F ) decrease flowRate(F ) ∗ ∆t, ¬opened(F ) i i Now it becomes A new action for “at start”: h opens (F ), ¬opened(F ) ∧ ¬stuck(F ), opened(F )i and a new action for “at end”: h opene (F ), ¬stuck(F ) ∧ opened(F ), ¬opened(F )i Later we will discuss about invariant monitoring and constinuous assignment. Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 17 / 23 Precondition Satisfaction Example (Encoding preconditions for opens (F )) ← opens (F , S), not ¬stuck(F , S). ← opens (F , S), not ¬opened(F , S). Basic idea: If a precondition is not known as satisfied, then the action cannot execute. Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 18 / 23 Effects on Fluents of Simple Actions Example (Encoding Effects on Fluents for opene (F )) ¬opened(F , S + 1) ← occurs(opene (F ), S) opened(F , S + 1) ← opened(F , S), not ¬opened(F , S + 1) ¬opened(F , S + 1) ← ¬opened(F , S), not opened(F , S + 1) Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 19 / 23 Continuous Variable Assignment I 1 2 Introduce a new predicate action on(A, S) to mark whether action S is on at step S. We then introduce a function delta. Example (Contribution of each action to Sink(S)) delta(Sink (S), open(F ), S, T ) = ← delta(Sink (S), open(F ), S, T ) = ← Bao et al. (KR Lab, CS, Texas Tech) flowRate(F ) ∗ T action on(open(F ), S). 0 not action on(open(F ), S). ACC based temporally expressive planner 12/08/2010 20 / 23 Continuous Variable Assignment II 3 Finally, we introduce a function f to sum up the contribution of actions on variables Example (Summing up contribution on Sink(S)) f (Sink(S), T ) = + + ← Bao et al. (KR Lab, CS, Texas Tech) Sink(S) delta(Sink(S), open(f 1), S, T ) delta(Sink (S), open(f 2), S, T ) at(S + 1) = T 1, at(S) = T 0, 0 ≤ T ≤ T 1 − T 0. ACC based temporally expressive planner 12/08/2010 21 / 23 Invariant Monitoring Example (Invariant Monitoring for open(S) action) violated(open(F ), Ss, Se) ← duration(open(F ), Ss, Se), at(S) = T 1, at(S + 1) = T 2, Ss ≤ S ≤ Se, T 1 ≤ T ≤ T 2, f (Tank (F ), S, T − T 1) = X , not (X > 0). ← violated(open(F ), Ss, Se). Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 22 / 23 Potluck What time? What food? Bao et al. (KR Lab, CS, Texas Tech) ACC based temporally expressive planner 12/08/2010 23 / 23