620 likes | 806 Views
Local Search Methods for SAT. Geoffrey Levine March 11, 2004. Outline. Motivation GSAT Variations Planning Encoding as SAT problems. Motivation. SAT or MAX-SAT Find a satisfying (or near satisfying) set of Boolean assignments for a CNF equation
E N D
Local Search Methods for SAT Geoffrey Levine March 11, 2004
Outline • Motivation • GSAT • Variations • Planning • Encoding as SAT problems
Motivation • SAT or MAX-SAT • Find a satisfying (or near satisfying) set of Boolean assignments for a CNF equation (a \/ b) /\ (Øa \/ c) /\ (Øb \/ c) /\ (Øc \/ Øb)
Motivation • SAT or MAX-SAT • Find a satisfying (or near satisfying) set of Boolean assignments for a CNF equation (a \/ b) /\ (Øa \/ c) /\ (Øb \/ c) /\ (Øc \/ Øb) (T \/ F) /\ (F \/ T) /\ (T \/ T) /\ (F \/ T) = T a = T, b = F, c = T
Motivation • SAT or MAX-SAT • Find a satisfying (or near satisfying) set of Boolean assignments for a CNF equation • NP-Complete, systematic search algorithms scale poorly
Outline • Motivation • GSAT • Variations • Planning • Encoding as SAT problems
GSAT – Selman Kautz ‘93 At each step, in your Truth assignment, T Flip variable in T that results in greatest increase of satisfied clauses
GSAT – Selman Kautz ‘93 T := a randomly generated truth assignment for j := 1 to MAX-FLIPS if T satisfies equation, return T Flip variable in T that results in greatest increase of satisfied clauses
GSAT – Selman Kautz ‘93 For i := 1 to MAX-TRIES T := a randomly generated truth assignment for j := 1 to MAX-FLIPS if T satisfies equation, return T Flip variable in T that results in greatest increase of satisfied clauses
GSAT – Advantages • Scales better than previous systematic solutions • Setting MAX-FLIPS to 10x number of variables is sufficient [1] • Can handle hard randomly-generated 3CNF formulas with 2000 variables compared to 400 [3]
GSAT - Disadvantage • Tends to get stuck at plateaus/local minima
Outline • Motivation • GSAT • Variations • Planning • Encoding as SAT problem
GSAT w/Clause weights • Weight each clause, initially at 1 • At the end of each failed attempt, increase weights of unsatisfied clauses
GSAT w/Clause weights • Works to fill in difficult local minima
GSAT w/Clause weights • Works to fill in difficult local minima
GSAT w/Clause weights • Works to fill in difficult local minima
GSAT w/Clause weights • Works to fill in difficult local minima
GSAT w/Clause weights • Works to fill in difficult local minima
GSAT w/Clause weights • Works to fill in difficult local minima
GSAT w/Clause weights • Works to fill in difficult local minima
GSAT w/Clause weights • Works to fill in difficult local minima
GSAT w/Clause weights • Works to fill in difficult local minima
WalkSAT • Combination of GSAT and Random Walk • At each step, choose an unsatisfied clause at random, and flip a variable in that clause either greedily or randomly.
Outline • Motivation • GSAT • Variations • Planning • Encoding as SAT problems
Planning • Previously considered not amenable to general theorem provers (1969) • Relative success of STRIPS (1971) set the tone for future work in planning • Speed of GSAT algorithms make them a viable option (1996)
Outline • Motivation • GSAT • Variations • Planning • Encoding as SAT problems • Linear Encodings • Parallelized Encodings • Lifted Causal Encodings
Linear Encodings • Introduce time-index to each fluent/action • On(a,b,1), Move(a,b,c,1), On(a,c,2)
Linear Encodings • Introduce time-index to each fluent/action • On(a,b,1), Move(a,b,c,1), On(a,c,2) • Encoded clauses: • Specification of initial/goal states • Initial state must be completely specified • Goal state can be partially specified
Linear Encodings • Introduce time-index to each fluent/action • On(a,b,1), Move(a,b,c,1), On(a,c,2) • Encoded clauses: • Specification of initial/goal states • Actions imply their preconditions and effects • Move(a,b,c,1) => On(a,b,1) /\ Clear(a,1) /\ Clear(c,1) • Move(a,b,c,1) => Clear(b,2) /\ On(a,c,2) /\ ØClear(c,1)
Linear Encodings • Introduce time-index to each fluent/action • On(a,b,1), Move(a,b,c,1), On(a,c,2) • Encoded clauses: • Specification of initial/goal states • Actions imply their preconditions and effects • Actions imply their frame conditions • On(d,e,1) /\ Move(a,b,c,1) => On(d,e,2)
Linear Encodings • Introduce time-index to each fluent/action • On(a,b,1), Move(a,b,c,1), On(a,c,2) • Encoded clauses: • Specification of initial/goal states • Actions imply their preconditions and effects • Actions imply their frame conditions • Only one action occurs at each time • ØMove(a,b,c,1) \/ ØMove(a,b,d,1)
Linear Encodings • Total Number of variables is O(n |A| + n |F|) • |A| = number of actions = |Ops| |Objs|Aops • |Ops| = number of operations • |Objs| = number of domain objects • Aops = Arity of the operators = max # of arguments • |F| = number of fluents = |Pred| |Objs|Apreds • |Pred| = number of predicates • Apreds = Arity of predicates = max # of arguments
Linear Encodings • Number of literals in the CNF formula • O(n |A|^2 + n |A| |F|) ^ ^ | | | Due to Frame Axioms | Due to Exclusiveness (one action at a time)
Linear Encodings • Number of actions exponential in Aops • |A| = |Ops| |Objs|Aops • Reducing Arity can dramatically reduce length of formula • Operator Splitting • Move(a,b,c,i) becomes Object(a,i) /\ Source(b,i) /\ Destination(c,i) • Reduces size of exclusiveness axioms to O(n Aops2 |Ops|2 |Dom|2)
Linear Encodings • Explanatory Frame Axioms • Enforce that if a fluent changes, there is an action accounting for it • fi /\ Øfi+1 => \/ {ai | f ε Del(ai)} • Øfi /\ fi+1 => \/ {ai | f ε Add(ai)} • Reduces size of frame axioms to O(n k |F|) where at most k actions can account for the change in value of a fluent
Outline • Motivation • GSAT • Variations • Planning • Encoding as SAT problems • Linear Encodings • Parallelized Encodings • Lifted Causal Encodings
Parallelized Encodings • Lots of the CNF formula is devoted to frame axioms • Dependant on number of time slices in the encoding • Allow more than one action per time slice • Solutions to the SAT problem correspond to partial order plans
Graphplan-based Encodings • Allow for multiple operations per layer
Graphplan-based Encodings • Allow for multiple operations per layer
Graphplan-based Encodings • Can be translated into CNF formulas • Resulting Clauses: • Initial state holds at layer 1, goal state at layer n • a1, Ø b1, Ø c1, bn, cn
Graphplan-based Encodings • Can be translated into CNF formulas • Resulting Clauses: • Initial state holds at layer 1, goal state at layer n • Operators imply their preconditions • add b1 => a1 /\ Ø b1
Graphplan-based Encodings • Can be translated into CNF formulas • Resulting Clauses: • Initial state holds at layer 1, goal state at layer n • Operators imply their preconditions • Each fact at level i implies the disjunction of all operators at level i-1 with it as ad add-effect • b2 => (add b1 \/ maintain b1)
Graphplan-based Encodings • Can be translated into CNF formulas • Resulting Clauses: • Initial state holds at layer 1, goal state at highest • Operators imply their preconditions • Each fact at level i implies the disjunction of all operators at level i-1 with it as ad add-effect • Conflicting actions are mutually exclusive • Ø maintain (Ø b1) \/ Ø add b1
Graphplan-based Encodings • Resulting formula has size O(nm|A| + n|A|2 + nk|F|) ^ ^ ^ | | Explanation frames | Conflicting Actions Actions => Preconditions (m = max # of preconditions for an action)
Graphplan-Based Encodings • If we only know the state layers or action layers, we can perceive the other. • Perform resolution to compile away action or state layers • Compiling away actions can result in exp blowup a1 => f, a2 => f, a3 => f a1 => (p1 /\ p2), a2 => (p3 /\ p4), a3 => (p5 /\ p6) f => (p1 \/ p3 \/ p5) /\ (p2 \/ p3 \/ p5) /\ ….
Graphplan-Based Encodings • If we only know the state layers or action layers, we can perceive the other. • Perform resolution to compile away action or state layers • Compiling away actions can result in exp blowup • Compiling away states does not result in the same problem, as the resulting formula is still in CNF