Streamlining Variational Inference for Constraint Satisfaction Problems
Abstract
Several algorithms for solving constraint satisfaction problems are based on survey propagation, a variational inference scheme used to obtain approximate marginal probability estimates for variable assignments. These marginals correspond to how frequently each variable is set to true among satisfying assignments, and are used to inform branching decisions during search; however, marginal estimates obtained via survey propagation are approximate and can be selfcontradictory. We introduce a more general branching strategy based on streamlining constraints, which sidestep hard assignments to variables. We show that streamlined solvers consistently outperform decimationbased solvers on random SAT instances for several problem sizes, shrinking the gap between empirical performance and theoretical limits of satisfiability by on average for .
Streamlining Variational Inference for Constraint Satisfaction Problems
Aditya Grover, Tudor Achim, Stefano Ermon Computer Science Department Stanford University {adityag, tachim, ermon}@cs.stanford.edu
noticebox[b]32nd Conference on Neural Information Processing Systems (NIPS 2018), Montréal, Canada.\end@float
1 Introduction
Constraint satisfaction problems (CSP), such as boolean satisfiability (SAT), are useful modeling abstractions for many artificial intelligence and machine learning problems, including planning [13], scheduling [27], and logicbased probabilistic modeling frameworks such as Markov Logic Networks [30]. More broadly, the ability to combine constraints capturing domain knowledge with statistical reasoning has been successful across diverse areas such as ontology matching, information extraction, entity resolution, and computer vision [15, 4, 32, 29, 33]. Solving a CSP involves finding an assignment to the variables that renders all of the problem’s constraints satisfied, if one exists. Solvers that explore the search space exhaustively do not scale since the state space is exponential in the number of variables; thus, the selection of branching criteria for variable assignments is the central design decision for improving the performance of these solvers [5].
Any CSP can be represented as a factor graph, with variables as nodes and the constraints between these variables (known as clauses in the SAT case) as factors. With such a representation, we can design branching strategies by inferring the marginal probabilities of each variable assignment. Intuitively, the variables with more extreme marginal probability for a particular value are more likely to assume that value across the satisfying assignments to the CSP. In fact, if we had access to an oracle that could perform exact inference, one could trivially branch on variable assignments with nonzero marginal probability and efficiently find solutions (if one exists) to hard CSPs such as SAT in time linear in the number of variables. In practice however, exact inference is intractable for even moderately sized CSPs and approximate inference techniques are essential for obtaining estimates of marginal probabilities.
Variational inference is at the heart of many such approximate inference techniques. The key idea is to cast inference over an intractable joint distribution as an optimization problem over a family of tractable approximations to the true distribution [6, 34, 38]. Several such approximations exist, e.g., mean field, belief propagation etc. In this work, we focus on survey propagation. Inspired from statistical physics, survey propagation is a messagepassing algorithm that corresponds to belief propagation in a “lifted” version of the original CSP and underlines many stateoftheart solvers for random CSPs [24, 22, 21].
Existing branching rules for survey propagation iteratively pick variables with the most confident marginals and fix their values (by adding unary constraints on these variables) in a process known as decimation. This heuristic works well in practice, but struggles with a high variance in the success of branching, as the unary constraints leave the survey inspired decimation algorithm unable to recover in the event that a contradictory assignment (i.e., one that cannot be completed to form a satisfying assignment) is made. Longer branching predicates, defined over multiple variables, have lower variance and are more effective both in theory and practice [14, 1, 2, 36, 19, 18].
In this work, we introduce improved branching heuristics for survey propagation by extending this idea to CSPs; namely, we show that branching on more complex predicates than singlevariable constraints greatly improves survey propagation’s ability to find solutions to CSPs. Appealingly, the more complex, multivariable predicates which we refer to as streamlining constraints, can be easily implemented as additional factors (not necessarily unary anymore) in messagepassing algorithms such as survey propagation. For this reason, branching on more complex predicates is a natural extension to survey propagation.
Using these new branching heuristics, we develop an algorithm and empirically benchmark it on families of random CSPs. Random CSPs exhibit sharp phase transitions between satisfiable and unsatisfiable instances and are an important model to analyze the average hardness of CSPs, both in theory and practice [25, 26]. In particular, we consider two such CSPs: SAT where constraints are restricted to disjunctions involving exactly (possibly negated) variables [3] and XORSAT which substitutes disjunctions in SAT for XOR constraints of fixed length. On both these problems, our proposed algorithm outperforms the competing survey inspired decimation algorithm that branches based on just single variables, increasing solver success rates.
2 Preliminaries
Every CSP can be encoded as a boolean SAT problem expressed in Conjunctive Normal Form (CNF), and we will use this representation for the remainder of this work. Let and denote index sets for Boolean variables and clauses respectively. A literal is a variable or its negation; a clause is a disjunction of literals. A CNF formula is a conjunction of clauses, and is written as . Each is a clause with literals. For notational convenience, the variables will be indexed with letters and the clauses will be indexed with letters . Each variable is Boolean, taking values . A formula is satisfiable is there exists an assignment to the variables such that all the clauses are satisfied, where a clause is satisfied if at least one literal evaluates to true.
Any SAT instance can be represented as an undirected graphical model where each clause corresponds to a factor, and is connected to the variables in its scope. Given an assignment to the variables in its scope, a factor evaluates to if the corresponding clause evaluates to True, and otherwise. The corresponding joint probability distribution is uniform over the set of satisfying assignments. An example factor graph illustrating the use of our notation is given in Figure 1.
SAT formulas are ones where all clauses have exactly literals, i.e., for . Random SAT instances are generated by choosing each literal’s variable and negation independently and uniformly at random in each of the clauses. It has been shown that these instances have a very distinctive behavior where the probability of an instance having a solution has a phase transition explained as a function of the constraint density, , for a problem with clauses and variables for large enough . These instances exhibit a sharp crossover at a threshold density : they are almost always satisfiable below this threshold, and they become unsatisfiable for larger constraint densities [12, 10]. Empirically, random instances with constraint density close to the satisfiability threshold are difficult to solve [23].
2.1 Survey propagation
The base algorithm used in many stateoftheart solvers for constraint satisfaction problems such as random SAT is survey inspired decimation [7, 24, 16, 23]. The algorithm employs survey propagation, a message passing procedure that computes approximate singlevariable marginal probabilities for use in a decimation procedure. Our approach uses the same message passing procedure, and we review it here for completeness.
Survey propagation is an iterative procedure for estimating variable marginals in a factor graph. In the context of a factor graph corresponding to a Boolean formula, these marginals represent approximately the probability of a variable taking on a particular assignment when sampling uniformly from the set of satisfying assignments of the formula. Survey propagation considers three kinds of assignments for a variable: , , or unconstrained (denoted by ). A high value for marginals corresponding to either of the first two assignments indicates that the variables assuming the particular assignment make it likely for the overall formula to be satisfiable, whereas a high value for the unconstrained marginal indicates that satisfiablility is likely regardless of the variable assignment.
In order to estimate these marginals from a factor graph, we follow a message passing protocol where we first compute survey messages for each edge in the graph. There are two kinds of survey messages: messages from variable nodes to clauses , and messages from clauses to variables. These messages can be interpreted as warnings of unsatisfiability.

If we let to be the set of variables appearing in clause , then the message sent from a clause to variable , , is intuitively the probability that all variables in are in the state that violates clause . Hence, clause is issuing a warning to variable .

The reverse message from variable to clause for some value , , is interpreted as the probability of variable assuming the value that violates clause .
As shown in Algorithm 1, the messages from factors (clauses) to variables are initialized randomly [Line 2] and updated until a predefined convergence criteria [Lines 57]. Once the messages converge to , we can estimate the approximate marginals for each variable . In case survey propagation does not converge even after repeated runs, or a contradiction is found, the algorithm output is UNSAT. The message passing updates SPUpdate [Line 6] and the marginalization procedure Marginalize [Line 9] are deferred to Appendix A for ease of presentation. We refer the reader to [24] and [7] for a detailed analysis of the algorithm and connections to statistical physics.
2.2 Decimation and Simplification
The magnetization of a variable , defined as , is used as a heuristic bias to determine how constrained the variable is to take a particular value. The magnetization can be a maximum of one which occurs when either of the marginals is one and a minimum of zero when the estimated marginals are equal.^{1}^{1}1Other heuristic biases are also possible. For instance, [23] use the bias . The decimation procedure involves setting the variable(s) with the highest magnetization(s) to their most likely values based on the relative magnitude of vs. [Lines 1213].
The algorithm then branches on these variable assignments and simplifies the formula by unit propagation [Line 15]. In unit propagation, we recursively iterate over all the clauses that the decimated variable appears in. If the polarity of the variable in a literal matches its assignment, the clause is satisfied and hence, the corresponding clause node and all its incident variable edges are removed from the factor graph. If the polarity in the literal does not match the assignment, only the edge originating from this particular variable node incident to the clause node is removed from the graph. For example, setting variable to 0 in Figure 1 leads to removal of edges incident to from and , as well as all outgoing edges from (because is satisfied).
2.3 Survey Inspired Decimation
The full iterative process of survey propagation (on the simplified graph from the previous iteration) followed by decimation is continued until a satisfying assignment is found, or a stopping condition is reached beyond which the instance is assumed to be sufficiently easy for local search using a standard algorithm such as WalkSAT [31]. Note that when the factor graph is a tree and survey propagation converges to the exact warning message probabilities, Algorithm 1 is guaranteed to select good variables to branch on and to find a solution (assuming one exists).
However, the factor graphs for CSPs are far from treelike in practice and thus, the main factor affecting the success of survey inspired decimation is the quality of the estimated marginals. If these estimates are inaccurate, it is possible that the decimation procedure chooses to fix variables in contradictory configurations. To address this issue, we propose to use streamlining constraints.
3 Streamlining survey propagation
Combinatorial optimization algorithms critically depend on good heuristics for deciding where to branch during search [5]. Survey propagation provides a strong source of information for the decimation heuristic. As discussed above, the approximate nature of messagepassing implies that the “signal" might be misleading. We now describe a more effective way to use the information from survey propagation.
Whenever we have a combinatorial optimization problem over and wish to find a solution , we may augment the original feasibility problem with constraints that partition the statespace into disjoint statespaces and recursively search the resulting subproblems. Such partitioning constraints can significantly simplify search by exploiting the structure of the solution set and are known as streamlining constraints [17]. Good streamlining constraints will provide a balance between yielding significant shrinkage of the search space and safely avoiding reductions in the solution density of the resulting subproblems. Partitioning the space based on the value of a single variable (like in decimation) performs well on the former at the cost of the latter. We therefore introduce a different constraining strategy that strives to achieve a more balanced tradeoff.
3.1 Streamlining constraints for constraint satisfaction problems
The success of survey inspired decimation relies on the fact that marginals carry some signal about the likely assignments of variables. However, the factor graph becomes more dense as the constraint density approaches the phase transition threshold, making it harder for survey propagation to converge in practice. This suggests that the marginals might provide a weaker signal to the decimation procedure in early iterations. Instead of selecting a variable to freeze in some configuration as in decimation, e.g., , we propose a strictly more general streamlining approach where we use disjunction constraints between subsets of highly magnetized variables, e.g., .
The streamlined constraints can cut out smaller regions of the search space while still making use of the magnetization signal. For instance, introducing a disjunction constraint between any pair of variables reduces the statespace by a factor of (since three out of four possible variable assignments satisfy the clause), in contrast to the decimation procedure in Algorithm 1 which reduces the state space by a factor of . Intuitively, when branching with a length clause such as we make an (irreversible) mistake only if we guess the value of both variables wrong. Decimation can also be seen as a special case of streamlining for the same choice of literal. To see why, we note that in the above example the acceptable variable assignments for decimation are a subset of the valid assignments for streamlining .
The success of the streamlining constraints is strongly governed by the literals selected for participating in these added disjunctions. Disjunctions could in principle involve any number of literals, and longer disjunctions result in more conservative branching rules. But there are diminishing returns with increasing length, and so we restrict ourselves to disjunctions of length at most two in this paper. Longer clauses can in principle be handled by the inference procedure used by messagepassing algorithms, and we leave an exploration of this extension to future work.
3.2 Survey Inspired Streamlining
The pseudocode for survey inspired streamlining is given in Algorithm 2. The algorithm replaces the decimation step of survey inspired decimation with a streamlining procedure that adds disjunction constraints to the original formula [Line 16], thereby making the problem increasingly constrained until the search space can be efficiently explored by local search.
For designing disjunctions, we consider candidate variables with the highest magnetizations, similar to decimation. If a variable is selected, the polarity of the literal containing the variable is positive if and negative otherwise [Lines 1215].
Disjunctions use the signal from the survey propagation messages without overcommitting to a particular variable assignment too early (as in decimation). Specifically, without loss of generality, if we are given marginals and for variables and , the new update adds the streamlining constraint to the problem instead of overcommitting by constraining or to its most likely state. This approach leverages the signal from survey propagation, namely that it is unlikely for to be true, while also allowing for the possibility that one of the two marginals may have been estimated incorrectly. As long as streamlined constraints and decimation use the same bias signal (such as magnetization) for ranking candidate variables, adding streamlined constraints through the above procedure is guaranteed to not degrade performance compared with the decimation strategy in the following sense.
Proposition 1.
Let be a formula under consideration for satisfiability, be the formula obtained after one round of survey inspired decimation, and be the formula obtained after one round of survey inspired streamlining. If is satisfiable, then so is .
Proof.
Because unitpropagation is sound, the formula obtained after one round of survey inspired decimation is satisfiable if and only if is satisfiable, where the literal denotes either or . By construction, the formula obtained after one round of streamlining is . It is clear that if is satisfiable, so is . Clearly, the converse need not be true. ∎
3.3 Algorithmic design choices
A practical implementation of survey inspired streamlining requires setting some design hyperparameters. These hyperparameters have natural interpretations as discussed below.
Disjunction pairing. Survey inspired decimation scales to large instances by taking the top variables as decimation candidates at every iteration instead of a single candidate (Line 13 in Algorithm 1). The parameter is usually set as a certain fraction of the total number of variables in the formula, e.g., . For the streamlining constraints, we take the top variables, and pair the variables with the highest and lowest magnetizations as a disjunction constraint. We remove these variables from the candidate list, repeating until we have added disjunctions to the original set of constraints. For instance, if are our top decimation candidates (with signs) in a particular round, we add the constraints . Our procedure for scaling to top decimation candidates ensures that Proposition 1 holds, because survey inspired decimation would have added instead.
Other pairing mechanisms are possible, such as for example . Our choice is motivated by the observation that is the variable we are least confident about  we therefore choose to pair it with the one we are most confident about (). We have found our pairing scheme to perform slightly better in practice.
Constraint threshold. We maintain a streamlining constraint counter for every variable which is incremented each time the variable participates in a streamlining constraint. When the counter reaches the constraint threshold, we no longer consider it as a candidate in any of the subsequent rounds. This is done to ensure that no single variable dominates the constrained search space.
Iteration threshold. The iteration threshold determines how many rounds of streamlining constraints are performed. While streamlining constraints smoothly guide search to a solution cluster, the tradeoff being made is in the complexity of the graph. With every round of addition of streamlining constraints, the number of edges in the graph increases which leads to a higher chance of survey propagation failing to converge. To sidestep the failure mode, we perform rounds of streamlining before switching to decimation.
4 Empirical evaluation
We streamlining constraints for random SAT instances for with variables respectively and constraint densities close to the theoretical predictions of the phase transitions for satisfiability.
4.1 Solver success rates
In the first set of experiments, we compare survey inspired streamlining (SIS) with survey inspired decimation (SID). In line with [7], we fix and each success rate is the fraction of instances solved for every combination of and considered. The constraint threshold is fixed to . The iteration threshold is a hyperparameter set as follows. We generate a set of random SAT instances for every and . For these “training" instances, we compute the empirical solver success rates varying T over . The best performing value of on these train instances is chosen for testing on fresh instances. All results are reported on the test instances.
Results. As shown in Figure 2, the streamlining constraints have a major impact on the solver success rates. Besides the solver success rates, we compare the algorithmic thresholds which we define to be the largest constraint density for which the algorithm achieves a success rate greater than . The algorithmic thresholds are pushed from to for , to for , to for , and to for , shrinking the gap between the algorithmic thresholds and theoretical limits of satisfiability by an average of . This is significant as there is virtually no performance overhead in adding streamlining constraints.
Distribution of failure modes. Given a satisfiable instance, solvers based on survey propagation could fail for two reasons. First, the solver could fail to converge during message passing. Second, the local search procedure invoked after simplification of the original formula could timeout which is likely to be caused due to a pathological simplification that prunes away most (or even all) of the solutions. In our experiments, we find that the percentage of failures due to local search timeouts in SID and SIS are and respectively (remaining due to nonconvergence of message passing).
These observations can be explained by observing the effect of decimation and streamlining on the corresponding factor graph representation of the random SAT instances. Decimation simplifies the factor graph as it leads to the deletion of variable and factor nodes, as well as the edges induced by the deleted nodes. This typically reduces the likelihood of nonconvergence of survey propagation since the graph becomes less “loopy”, but could lead to overconfident (incorrect) branching decisions especially in the early iterations of survey propagation. On the other hand, streamlining takes smaller steps in reducing the search space (as opposed to decimation) and hence are less likely to make inconsistent variable assignments. However, a potential pitfall is that these constraints add factor nodes that make the graph more dense, which could affect the convergence of survey propagation.
4.2 Solution cluster analysis
Figures 3 and 4 reveal the salient features of survey inspired streamlining as it runs on an instance of 3SAT with a constraint density of , which is below the best achievable density but is known to be above the clustering threshold . The iteration threshold, was fixed to 90. At each iteration of the algorithm we use SampleSAT [35] to sample 100 solutions of the streamlined formula. Using these samples we estimate the marginal probabilities of all variables i.e., the fraction of solutions where a given variable is set to true. We use these marginal probabilities to estimate the marginal prediction calibration i.e., the frequency that a variable which survey propagation predicts has magnetization at least 0.9 has an estimated marginal at least as high as the prediction.
The increase in marginal prediction calibrations during the course of the algorithm (Figure 3, blue curve) suggests that the streamlining constraints are selecting branches that preserve most of the solutions. This might be explained by the decrease in the average Hamming distance between pairs of sampled solutions over the course of the run (green curve). This decrease indicates that the streamlining constraints are guiding survey propagation to a subset of the full set of solution clusters.
Over time, the algorithm is also finding more extreme magnetizations, as shown in the bottom three histograms of Figure 4 at iterations , , and . Because magnetization is used as a proxy for how reliably one can branch on a given variable, this indicates that the algorithm is getting more and more confident on which variables it is “safe” to branch on. The top plots of Figure 4 show the empirical marginal of each variable versus the survey propagation magnetization. These demonstrate that overall the survey propagation estimates are becoming more and more riskaverse: by picking variables with high magnetization to branch on, it will only select variables with (estimated) marginals close to one.
4.3 Integration with downstream solvers
The survey inspired streamlining algorithm provides an easy “blackbox" integration mechanism with other solvers. By adding streamlining constraints in the first few iterations as a preprocessing routine, the algorithm carefully prunes the search space and modifies the original formula that can be subsequently fed to any external downstream solver. We tested this procedure with Dimetheus [16] – a competitive ensemble solver that won two recent iterations of the SAT competitions in the random SAT category. We fixed the hyperparameters to the ones used previously. We did not find any statistically significant change in performance for ; however, we observe significant improvements in solver rates for higher (Figure 4(a),4(b)).
4.4 Extension to other constraint satisfaction problems
The survey inspired streamlining algorithm can be applied to any CSP in principle. Another class of CSPs commonly studied is XORSAT. An XORSAT formula is expressed as a conjunction of XOR constraints of a fixed length. Here, we consider constraints of length 2. An XOR operation between any two variables can be converted to a conjunction of disjunctions by noting that , and hence, any XORSAT formula can be expressed in CNF form. Figure 4(c) shows the improvements in performance due to streamlining. While we note that the phase transition is not as sharp as the ones observed for random SAT (in both theory and practice [11, 28]), including streamlining constraints can improve the solver performance.
5 Conclusion
Variational inference algorithms based on survey propagation achieve impressive performance for constraint satisfaction problems when employing the decimation heuristic. We explored cases where decimation failed, motivating a new branching procedure based on streamlining constraints over disjunctions of literals. Using these constraints, we developed survey inspired streamlining, an improved algorithm for solving CSPs via variational approximations. Empirically, we demonstrated improvements over the decimation heuristic on random CSPs that exhibit sharp phase transitions for a wide range of constraint densities. Our solver is available publicly at https://github.com/ermongroup/streamlinevicsp.
An interesting direction for future work is to integrate streamlining constraints with backtracking. Backtracking expands the search space, and hence it introduces a computational cost but typically improves statistical performance. Similar to the backtracking procedure proposed for decimation [23], we can backtrack (delete) streamlining constraints that are unlikely to render the original formula satisfiable during later iterations of survey propagation. Secondly, it would be interesting to perform survey propagation on clusters of variables and to use the joint marginals of the clustered variables to decide which streamlining constraints to add. The current approach makes the simplifying assumption that the variable magnetizations are independent of each other. Performing survey propagation on clusters of variables could greatly improve the variable selection while incurring only a moderate computational cost. Finally, it would be interesting to extend the proposed algorithm for constraint satisfaction in several realworld applications involving combinatorial optimization such as planning, scheduling, and probabilistic inference [20, 8, 9, 39, 37].
Acknowledgments
This research was supported by NSF (#1651565, #1522054, #1733686) and FLI. AG is supported by a Microsoft Research PhD Fellowship and a Stanford Data Science Scholarship. We are grateful to Neal Jean for helpful comments on early drafts.
References
 [1] T. Achim, A. Sabharwal, and S. Ermon. Beyond parity constraints: Fourier analysis of hash functions for inference. In International Conference on Machine Learning, 2016.
 [2] D. Achlioptas and P. Jiang. Stochastic integration via errorcorrecting codes. In Uncertainty in Artificial Intelligence, 2015.
 [3] D. Achlioptas and Y. Peres. The threshold for randomSAT is . Journal of the American Mathematical Society, 17(4):947–973, 2004.
 [4] M. Banko, M. J. Cafarella, S. Soderland, M. Broadhead, and O. Etzioni. Open information extraction for the web. In International Joint Conference on Artificial Intelligence, 2007.
 [5] A. Biere, M. Heule, H. van Maaren, and T. Walsh. Handbook of satisfiability. Frontiers in artificial intelligence and applications, vol. 185, 2009.
 [6] D. M. Blei, A. Kucukelbir, and J. D. McAuliffe. Variational inference: A review for statisticians. Journal of the American Statistical Association, 112(518):859–877, 2017.
 [7] A. Braunstein, M. Mézard, and R. Zecchina. Survey propagation: An algorithm for satisfiability. Random Structures & Algorithms, 27(2):201–226, 2005.
 [8] M. Chen, Z. Zhou, and C. J. Tomlin. Multiplayer reachavoid games via low dimensional solutions and maximum matching. In American Control Conference, 2014.
 [9] M. Chen, Z. Zhou, and C. J. Tomlin. Multiplayer reachavoid games via pairwise outcomes. IEEE Transactions on Automatic Control, 62(3):1451–1457, 2017.
 [10] A. CojaOghlan and K. Panagiotou. The asymptotic SAT threshold. Advances in Mathematics, 288:985–1068, 2016.
 [11] H. Daudé and V. Ravelomanana. Random 2XORSAT at the satisfiability threshold. In Latin American Symposium on Theoretical Informatics, pages 12–23. Springer, 2008.
 [12] J. Ding, A. Sly, and N. Sun. Proof of the satisfiability conjecture for large . In Symposium on Theory of Computing, 2015.
 [13] M. B. Do and S. Kambhampati. Planning as constraint satisfaction: Solving the planning graph by compiling it into csp. Artificial Intelligence, 132(2):151–182, 2001.
 [14] S. Ermon, C. P. Gomes, A. Sabharwal, and B. Selman. Lowdensity parity constraints for hashingbased discrete integration. In International Conference on Machine Learning, 2014.
 [15] J. Euzenat, P. Shvaiko, et al. Ontology matching, volume 333. Springer, 2007.
 [16] O. Gableske, S. Müelich, and D. Diepold. On the performance of CDCLbased message passing inspired decimation using PMPi. Pragmatics of SAT, POS, 2013.
 [17] C. Gomes and M. Sellmann. Streamlined constraint reasoning. In Principles and Practice of Constraint Programming, pages 274–289. Springer, 2004.
 [18] C. P. Gomes, W. J. van Hoeve, A. Sabharwal, and B. Selman. Counting CSP solutions using generalized XOR constraints. In AAAI Conference on Artificial Intelligence, 2007.
 [19] A. Grover and S. Ermon. Variational bayes on Monte Carlo steroids. In Advances in Neural Information Processing Systems, 2016.
 [20] J. Hromkovič. Algorithmics for hard problems: introduction to combinatorial optimization, randomization, approximation, and heuristics. Springer Science & Business Media, 2013.
 [21] L. Kroc, A. Sabharwal, and B. Selman. Messagepassing and local heuristics as decimation strategies for satisfiability. In Symposium on Applied Computing, 2009.
 [22] E. Maneva, E. Mossel, and M. J. Wainwright. A new look at survey propagation and its generalizations. Journal of the ACM, 54(4):17, 2007.
 [23] R. Marino, G. Parisi, and F. RicciTersenghi. The backtracking survey propagation algorithm for solving random SAT problems. Nature communications, 7:12996, 2016.
 [24] M. Mézard, G. Parisi, and R. Zecchina. Analytic and algorithmic solution of random satisfiability problems. Science, 297(5582):812–815, 2002.
 [25] D. Mitchell, B. Selman, and H. Levesque. Hard and easy distributions of SAT problems. In AAAI Conference on Artificial Intelligence, 1992.
 [26] M. Molloy. Models for random constraint satisfaction problems. SIAM Journal on Computing, 32(4):935–949, 2003.
 [27] W. Nuijten. Time and resource constrained scheduling: a constraint satisfaction approach. PhD thesis, TUE: Department of Mathematics and Computer Science, 1994.
 [28] B. Pittel and G. B. Sorkin. The satisfiability threshold for XORSAT. Combinatorics, Probability and Computing, 25(2):236–268, 2016.
 [29] H. Ren, R. Stewart, J. Song, V. Kuleshov, and S. Ermon. Adversarial constraint learning for structured prediction. International Joint Conference on Artificial Intelligence, 2018.
 [30] M. Richardson and P. Domingos. Markov logic networks. Machine Learning, 62(1):107–136, 2006.
 [31] B. Selman, H. A. Kautz, and B. Cohen. Noise strategies for improving local search. In AAAI Conference on Artificial Intelligence, 1994.
 [32] P. Singla and P. Domingos. Entity resolution with Markov logic. In International Conference on Data Mining, 2006.
 [33] R. Stewart and S. Ermon. Labelfree supervision of neural networks with physics and domain knowledge. In AAAI Conference on Artificial Intelligence, 2017.
 [34] M. J. Wainwright and M. I. Jordan. Graphical models, exponential families, and variational inference. Foundations and Trends in Machine Learning, 1(12):1–305, 2008.
 [35] W. Wei, J. Erenrich, and B. Selman. Towards efficient sampling: exploiting random walk strategies. In AAAI Conference on Artificial Intelligence, 2004.
 [36] S. Zhao, S. Chaturapruek, A. Sabharwal, and S. Ermon. Closing the gap between short and long XORs for model counting. In AAAI Conference on Artificial Intelligence, 2016.
 [37] Z. Zhou, J. Ding, H. Huang, R. Takei, and C. Tomlin. Efficient path planning algorithms in reachavoid problems. Automatica, 89:28–36, 2018.
 [38] Z. Zhou, P. Mertikopoulos, N. Bambos, S. Boyd, and P. W. Glynn. Stochastic mirror descent in variationally coherent optimization problems. In Advances in Neural Information Processing Systems, 2017.
 [39] Z. Zhou, M. P. Vitus, and C. J. Tomlin. Convexity verification for a hybrid chance constrained method in stochastic control problems. In American Control Conference, 2014.
Appendices
Appendix A Survey propagation subroutines
Here, we provide details regarding the subroutines regarding the message passing updates SPUpdate [Line 6] and the marginalization procedure Marginalize [Line 9] used in Algorithms 1 and 2.
a.1 SPUpdate
If we let to be the set of clauses where appears with the same sign as in clause and to be the remaining clauses, then the subroutine in Algorithm 3 provides the message passing equations required to update .
a.2 Marginalize
We can estimate the approximate marginals for each variable by normalizing the following quantities so that they sum to one:
(1)  
(2)  
(3) 
where denotes the set of clauses that appears in and and are the clause subsets where appears negated and unnegated respectively.