Accelerating Random Walks Wei Wei and Bart Selman
Introduction – local search Local Search methods have become viable alternative to backtrack style methods For SAT, the first local methods are based on greedy hill-climbing search Later, random walk style methods (WalkSat and its variants) provide great improvements — these methods combine a random walk strategy with a greedy bias
Introduction – theory On theory side, Papadimitriou (1991) shows unbiased random walk reach a satisfying assignment in O(N 2 ) on an arbitrary satisfiable 2SAT formula Schoening (1999) shows a series of short unbiased random walk on a 3-SAT problem will find a solution in O(1.334 N ) flips Parkes (CP 2002) shows empirically for random 3-sat, when clause/variable <2.65, unbiased RW finds a solution in linear flips. Otherwise, it appears to take greater than polynomial time
Introduction - practice Random walk style methods are successful in randomly generated instances, as well as in a bunch of real-world domains However, they are generally less effective in highly structured domains compared to DPLL One of the reasons is random walk needs O(N 2 ) flips to propagate dependencies among variables, while in DPLL, unit-propagation takes linear time
Overview Introduction Random Walk Strategies - unbiased random walk 1. on 2SAT formulas 2. on 3SAT formulas - biased random walk 1. RWF 2. WalkSat Chain Formulas - binary chains - ternary chains Practical Problems Conclusion and Future Directions
Unbiased (Pure) Random Walk Strategy Procedure RW Repeat c:= an unsatisfied clause chosen at random x:= a variable in c chosen at random flip the value of x Until a satisfying assignment is found
Unbiased RW on any satisfiable 2SAT Formula If a 2SAT formula of n variables is satisfiable, a satisfying assignment will be reached by Unbiased RW in O(n 2 ) steps with high probability (Papadimitriou, 1991)
Unbiased RW on any satisfiable 2SAT Formula T T’ Reach T in O(n 2 ) time with probability going to 1
Unbiased RW on 3SAT Formulas
RW is heavily biased away from the solution under consideration Exponential number of flips required to reach the solution In practice, pure RW performs poorly on hard random 3SAT formula (Parkes, CP2002)
Biased Random Walk Procedure RWF Repeat c:= an unsatisfied clause chosen at random if there exist a variable x in c with break value = 0 flip the value of x (freebie move) else x:= a variable in c chosen at random flip the value of x Until a satisfying assignment is found
Biased Random Walk Procedure WalkSat Repeat c:= an unsatisfied clause chosen at random if there exist a variable x in c with break value = 0 flip the value of x (freebie move) else with probability p x:= a variable in c chosen at random flip the value of x with probability (1-p) x:= a variable in c with smallest break value flip the value of x Until a satisfying assignment is found
Chain Formulas To understand the behavior of pure and biased RW procedures on SAT instances, we introduce Chain Formulas These formulas have long chains of dependencies between variables They demonstrate the extreme properties of RW style algorithms
Binary Chains Consider formulas F 2chain x 1 x 2 x 2 x 3 … x n-1 x n x n x 1
Binary Chains
We obtain the following theorem Theorem 1. The RW procedure takes n 2 ) steps to find a satisfying assignment of F 2chain. DPLL algorithm’s unit propagation mechanism finds an assignment for F 2chain in linear time. Our experiments and theoretic analysis show that adding a greedy bias to random walk does not help in this case: both RWF and WalkSat takes n 2 ) flips to reach a satisfying assignment on these formulas
Speeding up Random Walks on Binary Chains Pure binary chain BCR
Speeding up Random Walks on Binary Chains * : empirical results ** : theoretical proof available Pure binary chain BCR RW (n 2 ) ** RWF (n 2 ) ** (n 1.2 ) * WalkSat (n 2 ) * (n 1.1 ) *
Formulas of Different Sizes and Redundancy Rates Redundant rate = # redundant clauses / n
WalkSat vs. RWF
Empirically Determine Optimal Redundancy Rate
Ternary Chains
Consider formulas F 3chain, low(i) x 1 x 2 x 1 x 2 x 3 … x low(i) x i-1 x i … x low(n) x n-1 x n *These formulas are inspired by Prestwich [2001]
Ternary Chains
Theoretical Results Function low(i)Expected Running time of pure RW i-2~ Fib(n) i/2 O(n. n log n ) log i O(n 2. (log n) 2 ) 1O(n 2 )
Proof The proofs of these claims are quite involved, and are available at But the intuition behind the proofs are simple. Namely, each RW process on these formulas can be decomposed into a bunch of components, which are in turn solved by solving a series of recurrence relations
Decomposition of RW
Recurrence Relations Therefore, we have E(f(z i )) = (E(f(z low(i) ) + E(f(z i ) + 1)/3 + (E(f(z i-1 ) + E(f(z i ) + 1)/3 + 1/3 E(f(z i )) = E(f(z low(i) ) + E(f(z i-1 ) + 3
Recurrence Relations Solving this recurrence for different low(i)’s, we get Function low(i)E(f(z i )) i-2 Fib(i) i/2 i log i log i i. (log i) 2 1 i i From this table, it is easy to get the complexity results shown
Theoretical Results Function low(i)Expected Running time of pure RW i-2~ Fib(n) i/2 O(n. n log n ) log i O(n 2. (log n) 2 ) 1O(n 2 )
Empirical Results: Unbiased Random Walks
Empirical Results: Biased and Unbiased Random Walks
Practical Problems Brafman’s 2-Simplify method is an ideal tool to help us discover long-range dependencies It simplifies a CNF formula in the following steps: 1.It constructs an implication graph from binary clauses, and collapses strongly connected components in this graph 2.It generates transitive closure of the graph, deduces through binary and hyper-resolutions, and removes assigned variables 3.It removes transitively redundant links to keep the number of edge minimal 4.It translates the graph back to binary clauses
Practical Problems 1.constructs an implication graph from binary clauses, and collapses strongly connected components in this graph 2.generates transitive closure of the graph, deduces through binary and hyper-resolutions, and removes assigned variables 3.steps through the redundancy removal steps, and removes each implied link with probability (1- ) 4.translates the graph back to binary clauses
Practical Problems Number of instance WalkSat (noise = 0.5) solved (SSS-SAT-1.0 by Velev) Formulas<40 sec<400 sec<4000 sec = = =
Optimal Redundancy Rate Time vs Redundancy Rate Flips vs Redundancy Rate WalkSat(noise=50) on dlx2_cc_bug01.cnf from SAT-1.0 Suite
Related Work Cha and Iwama (1996) studied the effect of adding clauses during local search process. But they focus on resolvents of unsat clauses at local minima, and their selected neighbors. Our results suggested long range dependencies may be more important to uncover
Conclusions We show how to speed up random walk style algorithms – introduce constraints that capture long range dependencies In our formal analysis of ternary chains, we show performance of RW varies from exponential to polynomial depending on the range of dependency links. We identify a sub-case that is solvable in poly-time by unbiased RW In binary chain, we show with added implied clauses, biased RW becomes almost as effective as unit-propagation We use practical problems to validate our approach
Future Directions It should be possible to develop preprocessor to uncover other type of dependencies, for example, in graph coloring problem, etc x 1 x 4, x 2 x 5, x 3 x 6, … x 1 x 4 x 7 x 10, …