Back to Lecture 9

SAT-Based Planning

Converting planning problems into Boolean satisfiability problems

What is SAT-Based Planning?

The Big Idea

SAT-based planning converts a planning problem into a Boolean satisfiability (SAT) problem, then uses powerful SAT solvers to find a solution.

Instead of searching through states, we encode the planning problem as logical formulas and let a SAT solver determine if a plan exists!

Planning Problem

States, actions, goals

SAT Encoding

Boolean formulas (CNF)

SAT Solver

Find satisfying assignment

Why Use SAT for Planning?
Advantages:
  • ✅ Leverages highly optimized SAT solvers
  • ✅ Can handle complex constraints naturally
  • ✅ Often faster than traditional search
  • ✅ Completeness guaranteed
Challenges:
  • ⚠️ Encoding overhead
  • ⚠️ Large formula size
  • ⚠️ Need to specify plan length
  • ⚠️ Less intuitive than search
Historical Context

SAT-based planning was introduced by Kautz & Selman (1992) in their seminal paper "Planning as Satisfiability". This approach revolutionized automated planning!

Key insight: Modern SAT solvers are incredibly efficient at solving large Boolean formulas, making this approach practical.

Propositionalization Steps

From Planning to Propositional Logic

Propositionalization is the process of converting first-order planning representations into propositional (Boolean) logic that SAT solvers can understand.

1
Choose a Plan Horizon (Length)

First, we decide the maximum plan length T (number of time steps).

Example: For a simple problem, we might try T = 3 steps initially. If no plan exists, we increment T and try again.
2
Create Propositional Variables

For each fluent and action, create Boolean variables for each time step:

Fluent Variables:
Ft = "Fluent F is true at time t"

Example:
At(Spare,Axle)0 = false
At(Spare,Axle)3 = true (goal!)
Action Variables:
At = "Action A is executed at time t"

Example:
Remove(Flat,Axle)0 = true
PutOn(Spare)2 = true
3
Encode Initial State

Assert that all initial fluents are true at time t=0, and all others are false (Closed-World Assumption).

At(Flat,Axle)0 At(Spare,Trunk)0 ¬At(Spare,Axle)0 ...
4
Encode Goal State

Assert that all goal fluents are true at time t=T (final time step).

At(Spare,Axle)T
5
Encode Action Effects & Constraints

Add axioms that encode:

  • Exclusion axioms: Only one action per time step
  • Precondition axioms: Action can only happen if preconditions are met
  • Successor-state axioms: How actions change fluents
Note: We'll explore each axiom type in detail in the next sections!
6
Convert to CNF

Convert all formulas to Conjunctive Normal Form (CNF) - a conjunction of disjunctions (AND of ORs).

(A B) (¬C D) (E ¬F G)
This is the format SAT solvers expect!
7
Feed to SAT Solver

Pass the CNF formula to a SAT solver (e.g., MiniSat, Glucose, Z3).

If SATISFIABLE:
  • ✅ A plan exists!
  • Extract which action variables are true
  • Construct the plan sequence
If UNSATISFIABLE:
  • ❌ No plan of length T exists
  • Increment T and try again
  • Or conclude problem is unsolvable

Exclusion Axioms

Constraint Axiom

What are Exclusion Axioms?

Exclusion axioms ensure that at most one action is executed at each time step. This prevents the plan from executing multiple conflicting actions simultaneously.

General Form

For every pair of different actions Ai and Aj, at every time step t:

¬Ai,t ¬Aj,t

Meaning: "Action i at time t OR action j at time t must be false" (i.e., both cannot be true at the same time)

Example: Spare Tire Problem

Suppose we have three actions:

  • Remove(Flat, Axle)
  • Remove(Spare, Trunk)
  • PutOn(Spare)
Exclusion Axioms at time t=0:
// Can't do Remove(Flat) AND Remove(Spare) at same time ¬Remove(Flat,Axle)0 ¬Remove(Spare,Trunk)0 // Can't do Remove(Flat) AND PutOn(Spare) at same time ¬Remove(Flat,Axle)0 ¬PutOn(Spare)0 // Can't do Remove(Spare) AND PutOn(Spare) at same time ¬Remove(Spare,Trunk)0 ¬PutOn(Spare)0
How Many Exclusion Axioms?

For n actions and T time steps, we need:

C(n,2) × T = n(n-1)/2 × T axioms

Example: With 10 actions and 5 time steps: 10×9/2 × 5 = 225 exclusion axioms!

Precondition Axioms

Constraint Axiom

What are Precondition Axioms?

Precondition axioms ensure that an action can only be executed if its preconditions are satisfied in the current state.

General Form

For an action A with preconditions P₁, P₂, ..., Pₙ at time t:

At (P₁t P₂t ... Pₙt)

Which is equivalent to (converting to CNF):

¬At P₁t
¬At P₂t
...
¬At Pₙt
Example: Remove Action
Action Definition (STRIPS):
Remove(Flat, Axle)
Precond: At(Flat, Axle)
Precondition Axiom:
Remove(Flat,Axle)t At(Flat,Axle)t // In CNF: ¬Remove(Flat,Axle)t At(Flat,Axle)t
Interpretation: "If Remove(Flat,Axle) is executed at time t, then At(Flat,Axle) must be true at time t"
Example: Load Action (Multiple Preconditions)
Action Definition (STRIPS):
Load(C1, P1, RUH)
Precond:
At(C1, RUH)
At(P1, RUH)
Precondition Axioms:
// Both must be true ¬Load(C1,P1,RUH)t At(C1,RUH)t ¬Load(C1,P1,RUH)t At(P1,RUH)t

Successor-State Axioms

State Transition Axiom

What are Successor-State Axioms?

Successor-state axioms (also called explanatory frame axioms) specify when and how fluents change from one time step to the next. They solve the frame problem efficiently!

General Form

For a fluent F at time t+1:

Ft+1 (ActionThatAddsFt) (Ft ¬ActionThatDeletesFt)

Meaning: "F is true at t+1 if either:
1. An action that adds F was executed at t, OR
2. F was already true at t AND no action that deletes F was executed"

The Frame Problem

Challenge: Most fluents stay the same from one time step to the next. We need to specify what doesn't change!

Solution: Successor-state axioms compactly encode both what changes AND what stays the same, avoiding the need for explicit "frame axioms" for every fluent-action pair.

Example: At(Spare, Axle)

Let's build the successor-state axiom for At(Spare, Axle):

Actions that ADD it:
  • PutOn(Spare)
Actions that DELETE it:
  • Remove(Spare, Axle)
Successor-State Axiom:
At(Spare,Axle)t+1 PutOn(Spare)t (At(Spare,Axle)t ¬Remove(Spare,Axle)t)
Explanation: "At(Spare,Axle) is true at t+1 if either:
• We just put the spare on at time t, OR
• It was already on the axle at t AND we didn't remove it at t"
Example: At(C1, JED)
Actions that ADD it:
  • Unload(C1, P1, JED)
  • Unload(C1, P2, JED)
Actions that DELETE it:
  • Load(C1, P1, JED)
  • Load(C1, P2, JED)
Successor-State Axiom:
At(C1,JED)t+1 (Unload(C1,P1,JED)t Unload(C1,P2,JED)t) (At(C1,JED)t ¬Load(C1,P1,JED)t ¬Load(C1,P2,JED)t)
Converting to CNF

The bi-conditional Ft+1 ↔ X is converted to two implications:

// If X then Ft+1 X Ft+1 (equivalently: ¬X Ft+1) // If Ft+1 then X Ft+1 X (equivalently: ¬Ft+1 X)

Then further distribute to get pure CNF clauses!

Modern SAT Solvers

Why SAT Solvers Are So Powerful

Modern SAT solvers can handle formulas with millions of variables and tens of millions of clauses. They use sophisticated algorithms like DPLL, CDCL, and advanced heuristics.

Popular SAT Solvers
  • MiniSat: Simple, fast, widely used
  • Glucose: Enhanced version of MiniSat
  • Lingeling: Award-winning solver
  • Z3: SMT solver (SAT + theories)
  • CryptoMiniSat: Good for crypto problems
  • CaDiCaL: Recent, very efficient
Key Techniques
  • CDCL: Conflict-Driven Clause Learning
  • Unit Propagation: Simplify formulas
  • Backjumping: Smart backtracking
  • Clause Learning: Remember conflicts
  • Restarts: Escape local minima
  • Watched Literals: Efficient checking
Performance Improvements Over Time

SAT solver performance has improved exponentially over the past 30 years:

1992
~100 variables
2000
~10,000 variables
2010
~1M variables
2025
~100M+ variables
DIMACS CNF Format

SAT solvers typically use the DIMACS CNF format:

c This is a comment c Problem with 4 variables and 3 clauses p cnf 4 3 1 -2 0 // (x1 ∨ ¬x2) -1 3 4 0 // (¬x1 ∨ x3 ∨ x4) -3 -4 0 // (¬x3 ∨ ¬x4)

Each line is a clause. Positive numbers = positive literal, negative = negated. 0 marks end of clause.

SAT Competitions

Annual SAT Competitions drive innovation in SAT solving:

  • Started in 2002, held almost every year
  • Benchmark problems from real applications
  • Multiple tracks (random, crafted, industrial)
  • Drives continuous improvement in algorithms

Complete Example: Spare Tire in SAT

Problem Setup

Let's encode the Spare Tire problem with plan length T=3:

  • Fluents: At(Flat,Axle), At(Flat,Ground), At(Spare,Trunk), At(Spare,Ground), At(Spare,Axle)
  • Actions: Remove(Flat,Axle), Remove(Spare,Trunk), PutOn(Spare)
  • Time steps: 0, 1, 2, 3
Step 1: Propositional Variables
Fluent Variables:
FA0 = At(Flat,Axle)0
FG0 = At(Flat,Ground)0
ST0 = At(Spare,Trunk)0
SG0 = At(Spare,Ground)0
SA0 = At(Spare,Axle)0
...and same for t=1,2,3
Action Variables:
R10 = Remove(Flat,Axle)0
R20 = Remove(Spare,Trunk)0
P0 = PutOn(Spare)0
...and same for t=1,2
Step 2: Initial State (t=0)
FA0 ST0 ¬FG0 ¬SG0 ¬SA0
Step 3: Goal State (t=3)
SA3
Step 4: Sample Axioms
Exclusion Axioms (t=0):
¬R10 ¬R20 // Can't do both removes ¬R10 ¬P0 // Can't remove and put-on ¬R20 ¬P0 // Can't remove spare and put-on
Precondition Axioms:
¬R10 FA0 // Remove(Flat) requires At(Flat,Axle) ¬R20 ST0 // Remove(Spare) requires At(Spare,Trunk) ¬P0 SG0 // PutOn(Spare) requires At(Spare,Ground)
Successor-State Axiom for SA (At(Spare,Axle)):
// At(Spare,Axle) at t+1 SA1 P0 (SA0 ¬R10) // In CNF (simplified): ¬P0 SA1 ¬SA0 R10 SA1 ¬SA1 P0 SA0 ¬SA1 P0 ¬R10
SAT Solver Output

The SAT solver returns a satisfying assignment:

R10=true, R21=true, P2=true, (all other actions = false) SA3=true (goal achieved!)

Solution Plan:

  1. Remove(Flat,Axle)
  2. Remove(Spare,Trunk)
  3. PutOn(Spare)

Key Takeaways

✅ SAT-Based Planning Strengths
  • Leverages powerful SAT solvers
  • Completeness guaranteed
  • Handles complex constraints well
  • Often faster than search for hard problems
  • Active research area
⚠️ SAT-Based Planning Challenges
  • Need to specify plan length upfront
  • Large formula encoding overhead
  • Less intuitive than state-space search
  • May struggle with very large problems
  • Difficult to incorporate heuristics
Summary
Encode as Logic

Transform planning → SAT

Add Axioms

Exclusion, precondition, successor-state

Solve Efficiently

Modern SAT solvers are fast!

The Big Picture: SAT-based planning shows how we can leverage advances in one area (SAT solving) to solve problems in another area (planning). This is a powerful example of reducing one problem to another!