Planning and Optimization — B5. SAT Planning: Core Idea and Sequential Encoding B5.1 Introduction Planning and Optimization B5. SAT Planning: Core Idea and Sequential Encoding B5.2 Formula Overview B5.3 Initial State, Goal, Operator Selection Malte Helmert and Gabriele R¨ oger Universit¨ at Basel B5.4 Transitions B5.5 Summary M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 1 / 28 M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 2 / 28 B5. SAT Planning: Core Idea and Sequential Encoding Introduction Content of this Course Foundations Logic Classical B5.1 Introduction Heuristics Constraints Planning Explicit MDPs Probabilistic Factored MDPs M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 3 / 28 M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 4 / 28
B5. SAT Planning: Core Idea and Sequential Encoding Introduction B5. SAT Planning: Core Idea and Sequential Encoding Introduction SAT Solvers Complexity Mismatch ◮ SAT solvers (algorithms that find satisfying assignments to CNF formulas) are one of the major success stories ◮ The SAT problem is NP-complete, in solving hard combinatorial problems. while PlanEx is PSPACE-complete. ◮ Can we leverage them for classical planning? � one-shot polynomial reduction from PlanEx to SAT � SAT planning (a.k.a. planning as satisfiability) not possible (unless NP = PSPACE) background on SAT Solvers: � Foundations of Artificial Intelligence Course, Ch. 31–32 M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 5 / 28 M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 6 / 28 B5. SAT Planning: Core Idea and Sequential Encoding Introduction B5. SAT Planning: Core Idea and Sequential Encoding Introduction Solution: Iterative Deepening SAT Planning: Main Loop basic SAT Planning algorithm: ◮ We can generate a propositional formula that tests SAT Planning if task Π has a plan with horizon (length bound) T def satplan(Π): in time O ( � Π � k · T ) ( � pseudo-polynomial reduction). for T ∈ { 0 , 1 , 2 , . . . } : ◮ Use as building block of algorithm that probes ϕ := build sat formula(Π , T ) increasing horizons (a bit like IDA ∗ ). I = sat solver( ϕ ) ⊲ returns a model or none ◮ Can be efficient if there exist plans if I is not none : that are not excessively long. return extract plan(Π , T , I ) Termination criterion for unsolvable tasks? M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 7 / 28 M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 8 / 28
B5. SAT Planning: Core Idea and Sequential Encoding Formula Overview B5. SAT Planning: Core Idea and Sequential Encoding Formula Overview SAT Formula: CNF? ◮ SAT solvers require conjunctive normal form (CNF), i.e., B5.2 Formula Overview formulas expressed as collection of clauses. ◮ We will make sure that our SAT formulas are in CNF when our input is a STRIPS task. ◮ We do allow fully general propositional tasks, but then the formula may need additional conversion to CNF. M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 9 / 28 M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 10 / 28 B5. SAT Planning: Core Idea and Sequential Encoding Formula Overview B5. SAT Planning: Core Idea and Sequential Encoding Formula Overview SAT Formula: Variables Formulas with Time Steps ◮ given propositional planning task Π = � V , I , O , γ � Definition (Time-Stamped Formulas) ◮ given horizon T ∈ N 0 Let ϕ be a propositional logic formula over the variables V . Let 0 ≤ i ≤ T . Variables of the SAT Formula We write ϕ i for the formula obtained from ϕ ◮ propositional variables v i for all v ∈ V , 0 ≤ i ≤ T by replacing each v ∈ V with v i . encode state after i steps of the plan ◮ propositional variables o i for all o ∈ O , 1 ≤ i ≤ T Example: (( a ∧ b ) ∨ ¬ c ) 3 = ( a 3 ∧ b 3 ) ∨ ¬ c 3 encode operator(s) applied in i -th step of the plan M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 11 / 28 M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 12 / 28
B5. SAT Planning: Core Idea and Sequential Encoding Formula Overview B5. SAT Planning: Core Idea and Sequential Encoding Initial State, Goal, Operator Selection SAT Formula: Motivation We want to express a formula whose models are exactly the plans/traces with T steps. For this, the formula must express four things: B5.3 Initial State, Goal, Operator ◮ The variables v 0 ( v ∈ V ) define the initial state. Selection ◮ The variables v T ( v ∈ V ) define a goal state. ◮ We select exactly one operator variable o i ( o ∈ O ) for each time step 1 ≤ i ≤ T . ◮ If we select o i , then variables v i − 1 and v i ( v ∈ V ) describe a state transition from the ( i − 1)-th state of the plan to the i -th state of the plan (that uses operator o ). The final formula is the conjunction of all these parts. M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 13 / 28 M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 14 / 28 B5. SAT Planning: Core Idea and Sequential Encoding Initial State, Goal, Operator Selection B5. SAT Planning: Core Idea and Sequential Encoding Initial State, Goal, Operator Selection SAT Formula: Initial State SAT Formula: Goal SAT Formula: Goal SAT Formula: Initial State goal clauses: initial state clauses: ◮ γ T ◮ v 0 for all v ∈ V with I ( v ) = T ◮ ¬ v 0 for all v ∈ V with I ( v ) = F For STRIPS, this is a conjunction of unit clauses. For general goals, this may not be in clause form. M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 15 / 28 M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 16 / 28
B5. SAT Planning: Core Idea and Sequential Encoding Initial State, Goal, Operator Selection B5. SAT Planning: Core Idea and Sequential Encoding Transitions SAT Formula: Operator Selection Let O = { o 1 , . . . , o n } . B5.4 Transitions SAT Formula: Operator Selection operator selection clauses: o i 1 ∨ · · · ∨ o i for all 1 ≤ i ≤ T ◮ n operator exclusion clauses: ¬ o i j ∨ ¬ o i for all 1 ≤ i ≤ T , 1 ≤ j < k ≤ n ◮ k M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 17 / 28 M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 18 / 28 B5. SAT Planning: Core Idea and Sequential Encoding Transitions B5. SAT Planning: Core Idea and Sequential Encoding Transitions SAT Formula: Transitions Simplifications and Abbreviations ◮ Let us pick the last formula apart to understand it better We now get to the interesting/challenging bit: (and also get a CNF representation along the way). encoding the transitions. ◮ Let us call the formula τ (“transition”): τ = o i → ( v i ↔ regr ( v , eff ( o )) i − 1 ). Key observations: if we apply operator o at time i , ◮ its precondition must be satisfied at time i − 1: ◮ First, some abbreviations: o i → pre ( o ) i − 1 ◮ Let e = eff ( o ). ◮ Let ρ = regr ( v , e ) (“regression”). ◮ variable v is true at time i iff its regression is true at i − 1: o i → ( v i ↔ regr ( v , eff ( o )) i − 1 ) We have ρ = effcond ( v , e ) ∨ ( v ∧ ¬ effcond ( ¬ v , e )). ◮ Let α = effcond ( v , e ) (“added”). ◮ Let δ = effcond ( ¬ v , e ) (“deleted”). Question: Why regr ( v , eff ( o )), not regr ( v , o )? � τ = o i → ( v i ↔ ρ i − 1 ) with ρ = α ∨ ( v ∧ ¬ δ ) M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 19 / 28 M. Helmert, G. R¨ oger (Universit¨ at Basel) Planning and Optimization 20 / 28
Recommend
More recommend