Abstract
Boolean satisfiability (SAT) solvers have dramatically improved their performance in the last twenty years, enabling them to solve large and complex problems. More recently MaxSAT solvers have appeared that efficiently solve optimisation problems based on SAT. This means that SAT solvers have become a competitive technology for tackling discrete optimisation problems.
A challenge in using SAT solvers for discrete optimisation is the many choices of encoding a problem into SAT. When encoding integer variables appearing in discrete optimisation problems, SAT must choose an encoding for each variable. Typical approaches fix a common encoding for all variables. However, different constraints are much more effective when encoded with a particular encoding choice. This inevitably leads to models where variables have different variable encodings. These models must then be able to couple encodings, either by using multiple encoding of single variables and channelling between the representations, or by encoding constraints using a mix of representations for the variables involved. In this paper we show how using mixed encodings of integers and coupled encodings of constraints can lead to better (Max)SAT models of discrete optimisation problems.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
The usual definition of MaxSAT makes use of soft clauses with weights but is functionally equivalent to the definition here, and indeed internally many MaxSAT solvers treat the problem in the form we define here.
- 2.
Their approach handles any number of order encoded variables, we restrict to one for simplicity of explanation.
- 3.
References
Abío, I., Gange, G., Mayer-Eichberger, V., Stuckey, P.J.: On CNF encodings of decision diagrams. In: Quimper, C.-G. (ed.) CPAIOR 2016. LNCS, vol. 9676, pp. 1–17. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-33954-2_1
Abío, I., Nieuwenhuis, R., Oliveras, A., Rodríguez-Carbonell, E.: A parametric approach for smaller and better encodings of cardinality constraints. In: Schulte, C. (ed.) CP 2013. LNCS, vol. 8124, pp. 80–96. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-40627-0_9
Abío, I., Nieuwenhuis, R., Oliveras, A., Rodríguez-Carbonell, E., Mayer-Eichberger, V.: A new look at BDDs for pseudo-Boolean constraints. J. Artif. Intell. Res. 45, 443–480 (2012). https://doi.org/10.1613/jair.3653
Ansótegui, C., et al.: Automatic detection of at-most-one and exactly-one relations for improved SAT encodings of pseudo-Boolean Constraints. In: Schiex, T., de Givry, S. (eds.) CP 2019. LNCS, vol. 11802, pp. 20–36. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-30048-7_2
Barahona, P., Hölldobler, S., Nguyen, V.: Efficient sat-encoding of linear CSP constraints. In: International Symposium on Artificial Intelligence and Mathematics, ISAIM 2014, Fort Lauderdale, FL, USA, 6–8 January 2014 (2014). http://www.cs.uic.edu/pub/Isaim2014/WebPreferences/ISAIM2014_Barahona _etal.pdf
Choi, C.W., Harvey, W., Lee, J.H.M., Stuckey, P.J.: Finite domain bounds consistency revisited. In: Sattar, A., Kang, B.-H. (eds.) AI 2006. LNCS (LNAI), vol. 4304, pp. 49–58. Springer, Heidelberg (2006). https://doi.org/10.1007/11941439_9
Chu, G.: Improving combinatorial optimization. Ph.D. thesis, University of Melbourne, Australia (2011). http://hdl.handle.net/11343/36679
Feydy, T., Stuckey, P.J.: Lazy clause generation reengineered. In: Gent, I.P. (ed.) CP 2009. LNCS, vol. 5732, pp. 352–366. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-04244-7_29
Frisch, A.M., Peugniez, T.J.: Solving non-Boolean satisfiability problems with stochastic local search. In: Nebel, B. (ed.) Proceedings of the Seventeenth International Joint Conference on Artificial Intelligence, IJCAI 2001, Seattle, Washington, USA, 4–10 August 2001, pp. 282–290. Morgan Kaufmann (2001)
Gange, G., Berg, J., Demirović, E., Stuckey, P.J.: Core-guided and core-boosted search for CP. In: Hebrard, E., Musliu, N. (eds.) CPAIOR 2020. LNCS, vol. 12296, pp. 205–221. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-58942-4_14
Gorjiara, H., Xu, G.H., Demsky, B.: Satune: synthesizing efficient SAT encoders. In: Proceedings of the ACM Programming Languages 4(OOPSLA), pp.146:1–146:32 (2020)
Huang, J.: Universal Booleanization of constraint models. In: Stuckey, P.J. (ed.) CP 2008. LNCS, vol. 5202, pp. 144–158. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-85958-1_10
Huang, J.: Search strategy simulation in constraint booleanization. In: Thirteenth International Conference on the Principles of Knowledge Representation and Reasoning (2012)
Hurley, B., Kotthoff, L., Malitsky, Y., O’Sullivan, B.: Proteus: a hierarchical portfolio of solvers and transformations. In: Simonis, H. (ed.) CPAIOR 2014. LNCS, vol. 8451, pp. 301–317. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-07046-9_22
Ignatiev, A., Marques-Silva, J., Morgado, A.: A python library for prototyping with sat oracles (2021). https://pypi.org/project/python-sat/
Martins, R., Manquinho, V., Lynce, I.: Open-WBO: a modular MaxSAT solver,. In: Sinz, C., Egly, U. (eds.) SAT 2014. LNCS, vol. 8561, pp. 438–445. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-09284-3_33
Metodi, A., Codish, M., Stuckey, P.J.: Boolean equi-propagation for concise and efficient SAT encodings of combinatorial problems. J. Artif. Intell. Res. 46, 303–341 (2013). https://doi.org/10.1613/jair.3809, http://www.jair.org/papers/paper3809.html
Nethercote, N., Stuckey, P.J., Becket, R., Brand, S., Duck, G.J., Tack, G.: MiniZinc: towards a standard CP modelling language. In: Bessière, C. (ed.) CP 2007. LNCS, vol. 4741, pp. 529–543. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-74970-7_38
Nguyen, V., Mai, S.T.: A new method to encode the at-most-one constraint into SAT. In: Thang, H.Q., et al. (eds.) Proceedings of the Sixth International Symposium on Information and Communication Technology, Hue City, Vietnam, 3–4 December 2015. pp. 46–53. ACM (2015). https://doi.org/10.1145/2833258.2833293
Nguyen, V., Velev, M.N., Barahona, P.: Application of hierarchical hybrid encodings to efficient translation of CSPS to SAT. In: 25th IEEE International Conference on Tools with Artificial Intelligence, ICTAI 2013, Herndon, VA, USA, 4–6 November 2013, pp. 1028–1035. IEEE Computer Society (2013). https://doi.org/10.1109/ICTAI.2013.154
Nightingale, P., Spracklen, P., Miguel, I.: Automatically improving SAT encoding of constraint problems through common subexpression elimination in Savile row. In: Pesant, G. (ed.) CP 2015. LNCS, vol. 9255, pp. 330–340. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-23219-5_23
Ohrimenko, O., Stuckey, P.J., Codish, M.: Propagation via lazy clause generation. Constraints Int. J. 14(3), 357–391 (2009). https://doi.org/10.1007/s10601-008-9064-x
Philipp, T., Steinke, P.: PBLib – A Library for Encoding Pseudo-Boolean Constraints into CNF. In: Heule, M., Weaver, S. (eds.) SAT 2015. LNCS, vol. 9340, pp. 9–16. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-24318-4_2
Prestwich, S.: Finding Large Cliques using SAT Local Search, chap. 15, pp. 269–274. John Wiley, Hoboken (2007)
Schulte, C., Tack, G.: Views and iterators for generic constraint implementations. In: Hnich, B., Carlsson, M., Fages, F., Rossi, F. (eds.) Recent Advances in Constraints, pp. 118–132. Springer, Berlin Heidelberg, Berlin, Heidelberg (2006). https://doi.org/10.1007/11754602_9
Sinz, C.: Towards an optimal CNF encoding of Boolean cardinality constraints. In: van Beek, P. (ed.) CP 2005. LNCS, vol. 3709, pp. 827–831. Springer, Heidelberg (2005). https://doi.org/10.1007/11564751_73
Soh, T., Banbara, M., Tamura, N.: A hybrid encoding of CSP to SAT integrating order and log encodings. In: 27th IEEE International Conference on Tools with Artificial Intelligence, ICTAI 2015, Vietri sul Mare, Italy, 9–11 November 2015, pp. 421–428. IEEE Computer Society (2015). https://doi.org/10.1109/ICTAI.2015.70
Tamura, N., Banbara, M.: Sugar: a CSP to SAT translator based on order encoding. In: Proceedings of the Second International CSP Solver Competition, pp. 65–69 (2008)
Tamura, N., Banbara, M., Soh, T.: Compiling pseudo-boolean constraints to SAT with order encoding. In: 25th IEEE International Conference on Tools with Artificial Intelligence, ICTAI 2013, Herndon, VA, USA, 4–6 November 2013, pp. 1020–1027. IEEE Computer Society (2013). https://doi.org/10.1109/ICTAI.2013.153
Tamura, N., Taga, A., Kitagawa, S., Banbara, M.: Compiling finite linear CSP into SAT. Constraints 14(2), 254–272 (2009)
Tanjo, T., Tamura, N., Banbara, M.: A compact and efficient SAT-encoding of finite domain CSP. In: Sakallah, K.A., Simon, L. (eds.) SAT 2011. LNCS, vol. 6695, pp. 375–376. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-21581-0_36
Zhou, N.-F.: In pursuit of an efficient SAT encoding for the Hamiltonian cycle problem. In: Simonis, H. (ed.) CP 2020. LNCS, vol. 12333, pp. 585–602. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-58475-7_34
Zhou, N.-F., Kjellerstrand, H.: The Picat-SAT compiler. In: Gavanelli, M., Reppy, J. (eds.) PADL 2016. LNCS, vol. 9585, pp. 48–62. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-28228-2_4
Zhou, N.-F., Kjellerstrand, H.: Optimizing SAT encodings for arithmetic constraints. In: Beck, J.C. (ed.) CP 2017. LNCS, vol. 10416, pp. 671–686. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-66158-2_43
Acknowledgements
This research was partially funded by the Australian Government through the Australian Research Council Industrial Transformation Training Centre in Optimisation Technologies, Integrated Methodologies, and Applications (OPTIMA), Project ID IC200100009.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
A Proofs
A Proofs
Theorem 1
Unit propagation on the clauses of Eqs. (4) and (6) is propagation complete for constraint \(x \in D(x) \wedge x = y \wedge y \in D(y)\) and \(\mathcal {L}= DIRECT (x) \cup BINARY (y)\). Hence, it enforces domain consistency on x.
Proof
First we show that unit propagation enforces the exactly-one constraint. If we have \([\![x = d ]\!]\) and \([\![x = d' ]\!]\) true simultaneously, then Eq. (4) will force one binary variable in y to take two values, thus failing. If all variables \([\![x = d' ]\!]\) are set false except one \([\![x = d ]\!]\), then Eq. (6) will set the correct bits of y in the remaining solution (via setting the negation to false). The forward direction will then propagate \([\![x= d ]\!]\).
Next we show that the unit propagation is propagation complete with respect to the binary variables and missing values in the original domain. Suppose \(S \subseteq D(x)\) are the remaining values in the domain. Then \(\lnot [\![x = d ]\!]\) is set for \(d \in D_i(x) - S\). Suppose that there is no support for \([\![\mathsf {bit}(y, k) ]\!]\) in S. Then unit propagation of Eq. (6) will set \(\lnot [\![\mathsf {bit}(y, k) ]\!]\).
Finally, we show that unit propagation is propagation complete on the encoding variables. Given the subset of the current assignment literals \(L \subseteq \phi \) restricted to the direct encoding variables for x and binary encoding variables of y. Let \(S \subset D(x)\) be the set of possible domain values remaining, i.e. \(S = \{ d ~|~ d \in D(x), \lnot [\![x = d ]\!] \not \in L \}\). Clearly the direct encoding variables are consistent with this by definition, and if S is a singleton, by the first argument \([\![x = d ]\!]\) is set true. We now consider each bit variable \([\![\mathsf {bit}(y, k) ]\!]\): if \([\![\mathsf {bit}(y, k) ]\!] \in L\) then by Eq. (4) each value in \(d \in S\) has \(\mathsf {bit}(d, k)\) is true, hence it is supported; similarly if \(\lnot [\![\mathsf {bit}(y, k) ]\!] \in L\). Finally, if variable \([\![\mathsf {bit}(y, k) ]\!]\) does not appear in L, then there must be values in S with both truth values, otherwise one of the equations in Eq. (6) would have propagated.
Theorem 2
Unit propagation on the clauses of Eqs. (2) and (7) is propagation complete for constraint \(x \in lb(x)..ub(x) \wedge x = y\) and language \(\mathcal {L}= ORDER (x) \cup BINARY (y)\). Hence, it enforces the initial bounds on x. Note that these equations do not enforce (nor can the encoding variables represent) domain consistency on the domain of x.
Proof
Given the subset of the current assignment literals \(L \subseteq \phi \) restricted to the order encoding variables for x and binary encoding variables for x, we show there is support for each possible value defined by L. Since each bound or bit is supported or propagated, propagation completeness follows. The order literals in L define a range l..u given by \(l = \max \{ i ~|~ [\![x \ge i ]\!] \in L \}\) and \(u = \min \{ i-1 ~|~ \lnot [\![x \ge i ]\!] \in L \}\). The order consistency Eq. (2) enforces that \(\lnot [\![x \ge i ]\!] \in L\) for \(i > u\) and \([\![x \ge i ]\!] \in L\) for \(i < l\). We show l and u are supported. Suppose that \([\![\mathsf {bit}(x, b) ]\!] \ne \mathsf {bit}(l, b) \in L\) for some bit b. Then there is some stable segment for this bit including l, say \(r_l..r_u\). Then the clause \([\![\mathsf {bit}(x, b) ]\!] \vee [\![x < r_l ]\!] \vee [\![x > r_u ]\!]\) will fire enforcing \([\![x > r_u ]\!]\) and hence l cannot be the lower bound. A similar argument applies to the upper bound.
We now show each possible value for each binary encoding variable \([\![\mathsf {bit}(x, b) ]\!]\) is supported in the range l..u. Suppose to the contrary that w.l.o.g. \([\![\mathsf {bit}(x, b) ]\!]\) is not true for any \(x \in l..u\). Then there is a stable segment \(r_l..r_u\) at least as large as l..u for \(\lnot [\![\mathsf {bit}(x, b) ]\!]\). Then the clause \(\lnot [\![\mathsf {bit}(x, b) ]\!] \vee [\![x < r_l ]\!] \vee [\![x > r_u ]\!]\) will propagate \(\lnot [\![\mathsf {bit}(x, b) ]\!]\), which then must be in L. The same reasoning holds for the negation.
The channelling also enforces the outer bounds on the binary encoding variables. Clearly \(d_1 \le l \le u \le d_m\) so the arguments for support of binary encoding variables automatically take into account the initial bounds.
Theorem 3
Unit propagation on the clauses of Eqs. (2) and (8) and clauses for lexicographic encoding of \(y \ge lb(x)\) and together with the clause \(\lnot [\![x \ge ub(y)+1 ]\!]\) is propagation complete for \(x \le y\) for the language \(\mathcal {L}= ORDER(x) \cup BINARY(y)\).
Proof
Suppose \(\mathcal {D}\wedge x \le y \rightarrow [\![x \le d ]\!]\) we show that unit propagation will enforce this. The initial case given by \(y \le ub(x)\) is enforced by the last clause. Let d be the maximum value y can take given \(\mathcal {D}\), then we know that \(\lnot [\![\mathsf {bit}(y, k) ]\!] \in \mathcal {D}\) for all \(k \in \mathcal {B}(y), \mathsf {bit}(d, k) = 0\) otherwise y could take a larger value. The clause Eq. (8) for \([\![x \ge d+1 ]\!]\) has right-hand side \(\bigvee _{k \in \mathcal {B}(y), \lnot \mathsf {bit}(d, k)}[\![\mathsf {bit}(y, k) ]\!]\) and hence propagates \(\lnot [\![x \ge d+1 ]\!]\) as required.
Let Y be the set of all possibly values that y can take given the \(\mathcal {D}\). Suppose \(\mathcal {D}\wedge x \le y \rightarrow [\![\mathsf {bit}(y, k) ]\!]\) for some \(k \in \mathcal {B}(y)\). We show that unit propagation will enforce this. If x still sits at its initial lower bound this will be forced by the encoding of \(y \ge lb(x)\). Otherwise, this propagation was caused by \([\![x \ge d ]\!]\) in the current domain, where \(d > \min (Y)\)
So clearly (A) \(\mathsf {bit}(v, k) = 1\) for all \(v \in Y \cap d..\max (y)\). Let (B) \(d'= \max \{ d'' ~|~ d'' \in Y, \mathsf {bit}(d'', k) = 0\}\). Clearly such a \(d'\) exists otherwise we would already have propagated \([\![\mathsf {bit}(y, k) ]\!]\), and, since \(d' < d\), \([\![x \ge d'+1 ]\!]\) is propagated by Eq. (2). We claim the clause 8 for \([\![x \ge d'+1 ]\!]\) will propagate \([\![\mathsf {bit}(y, k) ]\!]\). Suppose to the contrary then there is another bit \(k'\) where \(\mathsf {bit}(d', k') = 0\) where \(\lnot [\![\mathsf {bit}(y, k') ]\!] \not \in \mathcal {D}\). Then \(d' + 2^{k'} \in Y\) and either \(d' + 2^{k'} \ge d\) contradicting (A), or \(d' + 2^{k'} < d\) contradicting (B).
While it is not possible for \(\mathcal {D}\wedge x \le y \rightarrow \lnot [\![\mathsf {bit}(y, k) ]\!]\) since a lower bound can never force a negative bit (although this can happen subsequently from the clauses for constraint \(y \le ub(y)\)).
Rights and permissions
Copyright information
© 2022 Springer Nature Switzerland AG
About this paper
Cite this paper
Bierlee, H., Gange, G., Tack, G., Dekker, J.J., Stuckey, P.J. (2022). Coupling Different Integer Encodings for SAT. In: Schaus, P. (eds) Integration of Constraint Programming, Artificial Intelligence, and Operations Research. CPAIOR 2022. Lecture Notes in Computer Science, vol 13292. Springer, Cham. https://doi.org/10.1007/978-3-031-08011-1_5
Download citation
DOI: https://doi.org/10.1007/978-3-031-08011-1_5
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-08010-4
Online ISBN: 978-3-031-08011-1
eBook Packages: Computer ScienceComputer Science (R0)