Planning and Optimization
A7. Invariants, Mutexes and Task Reformulation
Malte Helmert and Thomas Keller
Universit¨at Basel
September 30, 2019
M. Helmert, T. Keller (Universit¨at Basel) Planning and Optimization September 30, 2019 1 / 24
Planning and Optimization
September 30, 2019 — A7. Invariants, Mutexes and Task Reformulation
A7.1 Invariants A7.2 Mutexes A7.3 Reformulation A7.4 Summary
M. Helmert, T. Keller (Universit¨at Basel) Planning and Optimization September 30, 2019 2 / 24
Content of this Course
Planning
Classical
Foundations Logic Heuristics Constraints
Probabilistic
Explicit MDPs Factored MDPs
A7. Invariants, Mutexes and Task Reformulation Invariants
A7.1 Invariants
A7. Invariants, Mutexes and Task Reformulation Invariants
Invariants
I When we as humans reason about planning tasks,
we implicitly make use of “obvious” properties of these tasks.
I Example: we are never in two places at the same time I We can represent such properties as formulas ϕ
that are true in all reachable states.
I Example: ϕ=¬(at-uni∧at-home)
I Such formulas are calledinvariantsof the task.
M. Helmert, T. Keller (Universit¨at Basel) Planning and Optimization September 30, 2019 5 / 24
A7. Invariants, Mutexes and Task Reformulation Invariants
Invariants: Definition
Definition (Invariant)
Aninvariant of a planning task Π with state variablesV
is a formulaϕover V with s |=ϕfor all reachable states s of Π.
M. Helmert, T. Keller (Universit¨at Basel) Planning and Optimization September 30, 2019 6 / 24
A7. Invariants, Mutexes and Task Reformulation Invariants
Computing Invariants
How does an automated planner come up with invariants?
I Theoretically, testing if a formulaϕis an invariant isas hard as planning itself.
proof idea: a planning task isunsolvableiff the negation of its goal is an invariant
I Still, many practical invariant synthesis algorithms exist.
I To remain efficient (= polynomial-time), these algorithms only compute a subsetof all useful invariants.
sound, but notcomplete
I Empirically, they tend to at least find the “obvious”
invariants of a planning task.
A7. Invariants, Mutexes and Task Reformulation Invariants
Invariant Synthesis Algorithms
Most algorithms for generating invariants are based on the generate-test-repairapproach:
I Generate: Suggest some invariant candidates, e.g., by enumerating all possible formulas ϕof a certain size.
I Test: Try to prove thatϕis indeed an invariant.
Usually done inductively:
1 Test thatinitial statesatisfiesϕ.
2 Test that ifϕis true in the current state, it remains true after applying a single operator.
I Repair: If invariant test fails, replace candidate ϕ
by aweakerformula, ideally exploiting whythe proof failed.
A7. Invariants, Mutexes and Task Reformulation Invariants
Invariant Synthesis: References
We will not cover invariant synthesis algorithms in this course.
Literature on invariant synthesis:
I DISCOPLAN (Gerevini & Schubert, 1998) I TIM (Fox & Long, 1998)
I Edelkamp & Helmert’s algorithm (1999) I Bonet & Geffner’s algorithm (2001) I Rintanen’s algorithm (2008)
M. Helmert, T. Keller (Universit¨at Basel) Planning and Optimization September 30, 2019 9 / 24
A7. Invariants, Mutexes and Task Reformulation Invariants
Exploiting Invariants
Invariants have many uses in planning:
I Regression search:
Prune subgoals that violate (are inconsistent with) invariants.
I Planning as satisfiability:
Add invariantsto a SAT encoding of a planning task to get tighter constraints.
I Proving unsolvability:
If ϕis an invariant such that ϕ∧γ is unsatisfiable, the planning task with goal γ is unsolvable.
I Finite-Domain Reformulation:
Derive a more compactFDR representation (equivalent, but with fewer states) from a given propositional planning task.
We now discuss the last point because it connects
to our discussion of propositional vs. FDR planning tasks.
M. Helmert, T. Keller (Universit¨at Basel) Planning and Optimization September 30, 2019 10 / 24
A7. Invariants, Mutexes and Task Reformulation Mutexes
A7.2 Mutexes
A7. Invariants, Mutexes and Task Reformulation Mutexes
Reminder: Blocks World (Propositional Variables)
Example
s(A-on-B) =F s(A-on-C) =F s(A-on-table) =T s(B-on-A) =T s(B-on-C) =F s(B-on-table) =F s(C-on-A) =F s(C-on-B) =F s(C-on-table) =T
A B
C
A7. Invariants, Mutexes and Task Reformulation Mutexes
Reminder: Blocks World (Finite-Domain Variables)
Example
Use three finite-domain state variables:
I below-a: {b,c,table}
I below-b: {a,c,table}
I below-c: {a,b,table}
s(below-a) = table s(below-b) = a s(below-c) = table
33= 27 states
A B
C
M. Helmert, T. Keller (Universit¨at Basel) Planning and Optimization September 30, 2019 13 / 24
A7. Invariants, Mutexes and Task Reformulation Mutexes
Task Reformulation
I Common modeling languages (like PDDL) often give uspropositional tasks.
I More compact FDR tasks are often desirable.
I Can we do an automatic reformulation?
M. Helmert, T. Keller (Universit¨at Basel) Planning and Optimization September 30, 2019 14 / 24
A7. Invariants, Mutexes and Task Reformulation Mutexes
Mutexes
Invariants that take the form of binary clausesare called mutexes because they express that certain variable assignments
cannot be simultaneously true (are mutually exclusive).
Example (Blocks World)
The invariant ¬A-on-B∨ ¬A-on-C states that A-on-B andA-on-Care mutex.
We say that a set of literalsis a mutex group if every subset of two literals is a mutex.
Example (Blocks World)
{A-on-B,A-on-C,A-on-table} is a mutex group.
A7. Invariants, Mutexes and Task Reformulation Mutexes
Encoding Mutex Groups as Finite-Domain Variables
LetG ={`1, . . . , `n} be a mutex group overn different propositional state variablesVG ={v1, . . . ,vn}.
Then a singlefinite-domain state variablevG with
dom(vG) ={`1, . . . , `n,none}can replace then variablesVG: I s(vG) =`i represents situations where (exactly)`i is true I s(vG) = none represents situations where all `i are false Note: We can omit the “none” value if`1∨ · · · ∨`n is an invariant.
A7. Invariants, Mutexes and Task Reformulation Mutexes
Mutex Covers
Definition (Mutex Cover)
A mutex coverfor a propositional planning task Π
is a set of mutex groups{G1, . . . ,Gn}where each variable of Π occurs in exactly one group Gi.
A mutex cover is positive if all literals in all groups are positive.
Note: always exists (use trivial group{v}ifv otherwise uncovered)
M. Helmert, T. Keller (Universit¨at Basel) Planning and Optimization September 30, 2019 17 / 24
A7. Invariants, Mutexes and Task Reformulation Mutexes
Positive Mutex Covers
In the following, we stick to positivemutex covers for simplicity.
If we have¬v inG for some group G in the cover, we can reformulate the task to use an “opposite” variable ˆv instead, as in the conversion to positive normal form (Chapter A6).
M. Helmert, T. Keller (Universit¨at Basel) Planning and Optimization September 30, 2019 18 / 24
A7. Invariants, Mutexes and Task Reformulation Reformulation
A7.3 Reformulation
A7. Invariants, Mutexes and Task Reformulation Reformulation
Mutex-Based Reformulation of Propositional Tasks
Given aconflict-freepropositional planning task Π with positive mutex cover{G1, . . . ,Gn}:
I In allconditions where variable v ∈Gi occurs, replace v with vGi =v.
I In all effects e where variablev ∈Gi occurs, I Replace allatomic add effects v withvGi :=v I Replace allatomic delete effects¬v with
(vGi =v∧ ¬W
v0∈Gi\{v}effcond(v0,e))BvGi := none This results in an FDR planning task Π0 that is equivalent to Π (without proof).
Note: the conditional effects can often be simplified away to an unconditional or empty effect.
A7. Invariants, Mutexes and Task Reformulation Reformulation
And Back?
I It can also be useful to reformulate an FDR task into a propositional task.
I For example, we might want positive normal form, which requires a propositional task.
I Key idea: each variable/value combinationv =d becomes a separate propositional state variablehv,di
M. Helmert, T. Keller (Universit¨at Basel) Planning and Optimization September 30, 2019 21 / 24
A7. Invariants, Mutexes and Task Reformulation Reformulation
Converting FDR Tasks into Propositional Tasks
Definition (Induced Propositional Planning Task)
Let Π =hV,I,O, γibe a conflict-freeFDR planning task.
Theinduced propositional planning taskΠ0
is the propositional planning task Π0 =hV0,I0,O0, γ0i, where I V0={hv,di |v ∈V,d ∈dom(v)}
I I0(hv,di) =Tiff I(v) =d
I O0 andγ0 are obtained fromO andγ by
I replacing each atomic formulav=d by the propositionhv,di I replacing each atomic effectv:=d by the effect
hv,di ∧V
d0∈dom(v)\{d}¬hv,d0i.
Notes:
I Again, simplifications are often possible to avoid introducing so many delete effects.
I SAS+ tasks induce STRIPS tasks
M. Helmert, T. Keller (Universit¨at Basel) Planning and Optimization September 30, 2019 22 / 24
A7. Invariants, Mutexes and Task Reformulation Summary
A7.4 Summary
A7. Invariants, Mutexes and Task Reformulation Summary
Summary
I Invariants are common properties of all reachable states, expressed as formulas.
I Mutexes are invariants that express that certain literals are mutually exclusive.
I Mutex coversprovide a way to express the information in a set of propositional state variables in a (potentially much smaller) set of finite-domain state variables.
I Using mutex covers, we can reformulate propositional tasks as more compact FDR tasks.
I Conversely, we can reformulate FDR tasksas propositional tasks by introducing propositions for each variable/value pair.