Abstract
The log encoding has been perceived to be unsuited to arithmetic constraints due to its hindrance to propagation. The surprising performance of PicatSAT, which is a pure eager SAT compiler based on the log encoding, in the MiniZinc Challenge 2016 has revived interest in the log encoding. This paper details the optimizations used in PicatSAT for encoding arithmetic constraints. PicatSAT adopts some well-known optimizations from CP systems, language compilers, and hardware design systems for encoding constraints into compact and efficient SAT code. PicatSAT is also empowered by a novel optimization, called equivalence reasoning, for arithmetic constraints, which leads to reduction of code size and execution time. In a nutshell, this paper demonstrates that the optimized log encoding is competitive for encoding arithmetic constraints.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsNotes
- 1.
PicatSAT with the Lingeling SAT solver won two silver medals and one bronze medal in the competition (http://www.minizinc.org/challenge2016/results2016.html).
- 2.
The default bounds of small domains are -3200 and 3200, which can be reset by using the built-in fd_vector_min_max(LB,UB).
- 3.
The cardinality constraint is treated as a normal linear constraint when \(c > 2\).
- 4.
- 5.
The two bit strings are made to have the same length after padding with zeros.
- 6.
This is done by using a recursive algorithm. When X or Y is a constant, the number of clauses in the generated code is still O(n) even though no auxiliary variables are used.
- 7.
Recall that since no negative zeros are allowed, the domain constraints already guarantee that X.m = 0 \(\Rightarrow \lnot X\).s and X.m = 0 \(\Rightarrow \lnot Y\).s.
- 8.
- 9.
https://github.com/chuffed/chuffed, released in December 2016.
- 10.
The fzn2smt solver (http://ima.udg.edu/recerca/lap/fzn2smt) has not been updated since 2012. There have been no significant speedups in the past five years in SAT solvers, on which both PicatSAT and SMT are based. PicatSAT uses Lingeling version 587f, which was released in February 2011 but is still faster than recent versions on most MiniZinc Challenge benchmarks. Therefore, this comparison is still relevant, if not completely up to date.
- 11.
- 12.
- 13.
- 14.
Instances that can be solved by the preprocessor are not included.
- 15.
The benchmarks of MiniZinc 2012 were used because fzn2smt took the second place in that competition, and didn’t compete ever since.
- 16.
fzn2smt, which does not have any solver-specific globals, uses MiniZinc’s default decomposer.
References
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. (JAIR) 45, 443–480 (2012)
Abío, I., Stuckey, P.J.: Encoding linear constraints into SAT. In: O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656, pp. 75–91. Springer, Cham (2014). doi:10.1007/978-3-319-10428-7_9
Aho, A.V., Lam, M.S., Sethi, R., Ullman, J.D.: Compilers: Principles. Techniques. Addison-Wesley, Tools Boston (2007)
Araya, I., Neveu, B., Trombettoni, G.: Exploiting common subexpressions in numerical CSPs. In: Stuckey, P.J. (ed.) CP 2008. LNCS, vol. 5202, pp. 342–357. Springer, Heidelberg (2008). doi:10.1007/978-3-540-85958-1_23
Bailleux, O., Boufkhad, Y., Roussel, O.: New Encodings of Pseudo-Boolean Constraints into CNF. In: Kullmann, O. (ed.) SAT 2009. LNCS, vol. 5584, pp. 181–194. Springer, Heidelberg (2009). doi:10.1007/978-3-642-02777-2_19
Barrett, C.W., Sebastiani, R., Seshia, S.A., Tinelli, C.: Satisfiability modulo theories. In: Handbook of Satisfiability, pp. 825–885 (2009)
Bartzis, C., Bultan, T.: Efficient BDDs for bounded arithmetic constraints. Int. J. Softw. Tools Technol. Transf. (STTT) 8(1), 26–36 (2006)
Bordeaux, L., Hamadi, Y., Zhang, L.: Propositional satisfiability and constraint programming: a comparative survey. ACM Comput. Surv. 38(4), 1–54 (2006)
Brayton, R.K., Hachtel, G.D., McMullen, C.T., Sangiovanni-Vincentelli, A.L.: Logic Minimization Algorithms for VLSI Synthesis. Kluwer Academic Publishers, Dordrecht (1984)
Brewka, G., Eiter, T., Truszczyński, M.: Answer set programming at a glance. Commun. ACM 54(12), 92–103 (2011)
Cadoli, M., Schaerf, A.: Compiling problem specifications into SAT. Artif. Intell. 162(1–2), 89–120 (2005)
Chen, J.: A new SAT encoding of the at-most-one constraint. In: Proceedings of the 9th International Workshop of Constraint Modeling and Reformulation (2010)
Crawford, J.M., Baker, A.B.: Experimental results on the application of satisfiability algorithms to scheduling problems. In: AAAI, pp. 1092–1097 (1994)
Dutertre, B., Moura, L.: A fast linear-arithmetic solver for DPLL(T). In: Ball, T., Jones, R.B. (eds.) CAV 2006. LNCS, vol. 4144, pp. 81–94. Springer, Heidelberg (2006). doi:10.1007/11817963_11
Eén, N., Biere, A.: Effective preprocessing in SAT through variable and clause elimination. In: Bacchus, F., Walsh, T. (eds.) SAT 2005. LNCS, vol. 3569, pp. 61–75. Springer, Heidelberg (2005). doi:10.1007/11499107_5
Eén, N., Sörensson, N.: Translating Pseudo-Boolean constraints into SAT. JSAT 2(1–4), 1–26 (2006)
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). doi:10.1007/978-3-642-04244-7_29
Gavanelli, M.: The log-support encoding of CSP into SAT. In: Bessière, C. (ed.) CP 2007. LNCS, vol. 4741, pp. 815–822. Springer, Heidelberg (2007). doi:10.1007/978-3-540-74970-7_59
Gebser, M., Kaufmann, B., Neumann, A., Schaub, T.: Conflict-driven answer set solving. In: IJCAI, p. 386 (2007)
Gent, I.P.: Arc consistency in SAT. In: ECAI, pp. 121–125 (2002)
Huang, J.: Universal booleanization of constraint models. In: Stuckey, P.J. (ed.) CP 2008. LNCS, vol. 5202, pp. 144–158. Springer, Heidelberg (2008). doi:10.1007/978-3-540-85958-1_10
Iwama, K., Miyazaki, S.: SAT-varible complexity of hard combinatorial problems. In: IFIP Congress, vol. 1, pp. 253–258 (1994)
Jackson, D., Abstractions, S.: Logic, Language, and Analysis. MIT Press, Cambridge (2012)
Li, C.M.: Integrating equivalency reasoning into davis-putnam procedure. In: AAAI, pp. 291–296 (2000)
Metodi, A., Codish, M.: Compiling finite domain constraints to SAT with BEE. Theor. Pract. Log. Program. 12(4–5), 465–483 (2012)
Nieuwenhuis, R.: The intsat method for integer linear programming. In: O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656, pp. 574–589. Springer, Cham (2014). doi:10.1007/978-3-319-10428-7_42
Nieuwenhuis, R., Oliveras, A., Tinelli, C.: Solving SAT and SAT modulo theories: from an abstract davis-putnam-logemann-loveland procedure to DPLL(T). J. ACM 53(6), 937–977 (2006)
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). doi:10.1007/978-3-319-23219-5_23
Ohrimenko, O., Stuckey, P.J., Codish, M.: Propagation via lazy clause generation. Constraints 14(3), 357–391 (2009)
Petke, J.: Bridging Constraint Satisfaction and Boolean Satisfiability. Artificial Intelligence: Foundations, Theory, and Algorithms. Springer, Heidelberg (2015)
Rossi, F., van Beek, P., Walsh, T.: Handbook of Constraint Programming. Elsevier, Amsterdam (2006)
Soh, T., Banbara, M., Tamura, N.: Proposal and evaluation of hybrid encoding of CSP to SAT integratin order and log encodings. Int. J. Artif. Intell. Tools 26(1), 1–29 (2017)
Stojadinovic, M., Maric, F.: meSAT: multiple encodings of CSP to SAT. Constraints 19(4), 380–403 (2014)
Tamura, N., Taga, A., Kitagawa, S., Banbara, M.: Compiling finite linear CSP into SAT. Constraints 14(2), 254–272 (2009)
Veksler, M., Strichman, O.: Learning general constraints in CSP. Artif. Intell. 238, 135–153 (2016)
Walsh, T.: SAT v CSP. In: Dechter, R. (ed.) CP 2000. LNCS, vol. 1894, pp. 441–456. Springer, Heidelberg (2000). doi:10.1007/3-540-45349-0_32
Warners, J.P.: A linear-time transformation of linear inequalities into conjunctive normal form. Inf. Process. Lett. 68(2), 63–69 (1998)
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). doi:10.1007/978-3-319-28228-2_4
Acknowledgement
The authors would like to thank the anonymous reviewers for helpful comments. This project was supported in part by the NSF under grant number CCF1618046.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2017 Springer International Publishing AG
About this paper
Cite this paper
Zhou, NF., Kjellerstrand, H. (2017). Optimizing SAT Encodings for Arithmetic Constraints. In: Beck, J. (eds) Principles and Practice of Constraint Programming. CP 2017. Lecture Notes in Computer Science(), vol 10416. Springer, Cham. https://doi.org/10.1007/978-3-319-66158-2_43
Download citation
DOI: https://doi.org/10.1007/978-3-319-66158-2_43
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-66157-5
Online ISBN: 978-3-319-66158-2
eBook Packages: Computer ScienceComputer Science (R0)