520 likes | 750 Views
Survey Propagation: an Algorithm for Satisfiability. A. Braunstein, M. Mezard, R. Zecchina. Hannaneh Hajishirzi : hajishir@uiuc.edu. Content. SAT Problem Warning Passing Survey Propagation Belief Propagation. SAT Problem. CNF Clause a = (z i1 z i2 … z ik )
E N D
Survey Propagation: an Algorithm for Satisfiability A. Braunstein, M. Mezard, R. Zecchina Hannaneh Hajishirzi : hajishir@uiuc.edu
Content • SAT Problem • Warning Passing • Survey Propagation • Belief Propagation
SAT Problem • CNF • Clause a = (zi1 zi2 … zik) And: Jair = 1 if zir= ~xir Jair = -1 if zir = xir
Factor Graph • Bipartite Graph • Variables Variable nodes • Clauses Function nodes Edge(a - i): variable “i” appears in clause “a”
Variable Node Function Node
Some Notions • V(i): neighbors of variable i • V+(i): clauses that i appears un-negated • V- (i): clauses that i appears negated • V(i)\b: set V(i) without a node b
Warning Passing j hja uai a = (i j k l) k a i hka hla l uai can be a warning
Formulae hja : Cavity Field uai : Cavity Bias [1]
WP algorithm • T = 0: Randomly initialize cavity bias(uai ) • For t = 1 to t = tmax 2.1 Update all uai(t) sequentially. (update method) 2.2 If uai(t) = uai(t-1) for all edges, u*ai = uai(t). Goto 3. • If t = tmax Return UN-CONVERGED. else output cavity biases u*ai.
Update Method • Update(uai ) • For every j V(a) \ i, compute hja • Using hja, compute uai
Convergence • Local Field: Hi • Contradiction Number: ci
b a 1 1 0 0 1 2 0 0 c 0 0 3 d
b a 1 1 1 2 1 0 0 c 0 0 0 3 d
b a 1 1 1 2 -1 0 0 c 0 0 0 3 d
b a 1 1 1 2 1 -1 0 0 c 0 1 1 0 3 d
WP on Tree • If Factor graph: Tree • WP converges • i: ci > 0 UNSAT • Otherwise: SAT
1. Remove edge a-i2. Level of ‘a’ = 0u = 13. Level of ‘a’ = 1 u = 04. Level of ‘a’ = r can be determined from u’s at level r-2
Solving SAT with WP 1. Run WP. 2. Check if there are conflicts. 3. Fix all constrained variables Clean the graph. 4. Choose randomly an un-biased variable,Fix it to one value (0, 1), Clean the graph. 5. Run again WP on the new instance.
Example x1 = 1, x2 = 0 x3 = 1, x4 = 1 x7 {0, 1}
Example x1 = 1, x2 = 0 x3 = 1, x4 = 1 x7 {0, 1} x5 = 1 x6 = 1 1 1 [3]
Clustering • Random SAT with M = N • < d = 3.921 Set of all satisfying assignmentsis connected (1 cluster) Local Search
Clustering • d < < c = 4.267 (hard-SAT region) - Set of all satisfying assignmentsbecomes divided into subsets (clusters) - Proliferation of meta-stable clusters Difficult for Local Search Methods
Clustering • = c Number of Clusters = 0 • > c Almost unsatisfiable Survey Propagation tries to solve SAT problem in hard-SAT region.
Definition of Surveys • Survey uai uai in cluster l Ncl :Number of clusters (x, y) = 1 if x = y,otherwise = 0
Surveys u {0, 1} Binomial Distribution For any set of cavity biases: Q(u, v, w,…): Joint Probability
Jaj = 1: [2] Jaj = -1:V+(i) & V-(i) exchange
Factorized Form Normalization Factor Constraint All values for all ubj
Compute C • Class u: ubj = 1, b Vua(j) 2. Class s: ubj = 1, b Vsa(j)
Compute C • 3. Class 0: ubj = 0, b V(j)
SP Algorithm 1. T = 0: Randomly initialize cavity bias(ai ) 2. For t = 1 to t = tmax 2.1 Update all ai(t) sequentially. (update method) 2.2 If |ai(t) - ai(t-1)| < for all edges, *ai = ai(t). Goto 3. 3. If t = tmax Return UN-CONVERGED. else output cavity biases *ai.
Discussion on SP • If factor-graph = tree, the same as WP • No proof of convergence • Experimental: converges where WP doesn’t • Useful for large N
Find SAT Assignment • Simple Algorithm (at most 2N SP calls) • Fix one variable • Run SP for size N-1 • If sub-problem is SAT keep the assignment • Otherwise change the value • Drawbacks • Imprecision of determining if problem is Satisfiable or not • Not using information from “surveys”
Properties of Variables Fraction of clusters that xj is positive:
Categories of Variables • Under-constrained: Fix it: Affects internal structure of clusters • Biased: Fix it: Few clusters are eliminated • Balanced: Fix it: Enormous effect or and
Search Algorithm 1. Run SP 2. Evaluate all Wi+,Wi-,Wi0. 3. Simplify & Search 3.1 If (exists <> 0) , fix with largest |Wi+ - Wi-| 3.2 If (all = 0) , Run WalkSAT 3.3 SP doesn’t converge, “Probably UNSAT” 4. If Done, output “SAT” If no contradiction goto 1
BP in SAT Problem • ia(xi): variable takes xi, in the absence of clause “a” • ai(xi): Clause “a” becomes satisfied, given value for xi For all values of variables xj 1 if X={xi} satisfies “a”Otherwise 0
BP in SAT Problem • ia(xi): Probability that variable takes xi and violates clause “a” • ai: Probability that all variables in “a” except “i”, violate “a” i appears un-negated
BP in SAT Problem Probability that xj = 1
Example 1 = 1, 2 = 0 3 = 1, 4 = 1 7 =3/4 ai ia 5 = 1/2 6 = 3/4 [3]
Null Message • Null message onto a variable means: • Receives no warning • Under-constrained • 3 states for a variable • 0, 1, * (joker state)
New BP • No warning from Vua(i) & Vsa(i) • No warning from Vsa(i), but at least 1 from Vua(i)
New BP • No warning from Vua(i), but at least 1 from Vsa(i) • At least 1 warning from Vsa(i), and 1 from Vua(i) New Formula:
Loopy Factor Graph 2 possible solutions for WP,2 generalized assignments (1, 1, *), (0, 0, 1) In SP:a1 = b2 = x a2 = b1= yc1 = c2= 0c3= (1-x)2y2 / (1-xy)2
When is SP useful? • Maybe in small cases WP is better • Useful in difficult cases for WP • When messages are sent according to different clusters = • When graph is not well connected SP performs better
Conclusion • Message Passing Methods for SAT • Advantage of SP • More theoretical & empirical work needed