Skip to main content

Optimizing SAT Encodings for Arithmetic Constraints

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 10416))

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

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 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. 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. 3.

    The cardinality constraint is treated as a normal linear constraint when \(c > 2\).

  4. 4.

    This information is disclosed here in order to give the reader a complete picture of PicatSAT. A study is underway to investigate how this adder-based encoding compares with other encodings, such as sorting networks [16], totalizers [5], BDDs [7], and the decomposition method for adders by [37].

  5. 5.

    The two bit strings are made to have the same length after padding with zeros.

  6. 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. 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. 8.

    http://picat-lang.org.

  9. 9.

    https://github.com/chuffed/chuffed, released in December 2016.

  10. 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. 11.

    http://www.minizinc.org.

  12. 12.

    http://yices.csl.sri.com.

  13. 13.

    http://strichman.net.technion.ac.il/haifacsp/.

  14. 14.

    Instances that can be solved by the preprocessor are not included.

  15. 15.

    The benchmarks of MiniZinc 2012 were used because fzn2smt took the second place in that competition, and didn’t compete ever since.

  16. 16.

    fzn2smt, which does not have any solver-specific globals, uses MiniZinc’s default decomposer.

References

  1. 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)

    MathSciNet  MATH  Google Scholar 

  2. 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

    Google Scholar 

  3. Aho, A.V., Lam, M.S., Sethi, R., Ullman, J.D.: Compilers: Principles. Techniques. Addison-Wesley, Tools Boston (2007)

    MATH  Google Scholar 

  4. 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

    Chapter  Google Scholar 

  5. 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

    Chapter  Google Scholar 

  6. Barrett, C.W., Sebastiani, R., Seshia, S.A., Tinelli, C.: Satisfiability modulo theories. In: Handbook of Satisfiability, pp. 825–885 (2009)

    Google Scholar 

  7. Bartzis, C., Bultan, T.: Efficient BDDs for bounded arithmetic constraints. Int. J. Softw. Tools Technol. Transf. (STTT) 8(1), 26–36 (2006)

    Article  MATH  Google Scholar 

  8. Bordeaux, L., Hamadi, Y., Zhang, L.: Propositional satisfiability and constraint programming: a comparative survey. ACM Comput. Surv. 38(4), 1–54 (2006)

    Article  Google Scholar 

  9. Brayton, R.K., Hachtel, G.D., McMullen, C.T., Sangiovanni-Vincentelli, A.L.: Logic Minimization Algorithms for VLSI Synthesis. Kluwer Academic Publishers, Dordrecht (1984)

    Book  MATH  Google Scholar 

  10. Brewka, G., Eiter, T., Truszczyński, M.: Answer set programming at a glance. Commun. ACM 54(12), 92–103 (2011)

    Article  Google Scholar 

  11. Cadoli, M., Schaerf, A.: Compiling problem specifications into SAT. Artif. Intell. 162(1–2), 89–120 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  12. 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)

    Google Scholar 

  13. Crawford, J.M., Baker, A.B.: Experimental results on the application of satisfiability algorithms to scheduling problems. In: AAAI, pp. 1092–1097 (1994)

    Google Scholar 

  14. 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

    Chapter  Google Scholar 

  15. 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

    Chapter  Google Scholar 

  16. Eén, N., Sörensson, N.: Translating Pseudo-Boolean constraints into SAT. JSAT 2(1–4), 1–26 (2006)

    MATH  Google Scholar 

  17. 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

    Chapter  Google Scholar 

  18. 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

    Chapter  Google Scholar 

  19. Gebser, M., Kaufmann, B., Neumann, A., Schaub, T.: Conflict-driven answer set solving. In: IJCAI, p. 386 (2007)

    Google Scholar 

  20. Gent, I.P.: Arc consistency in SAT. In: ECAI, pp. 121–125 (2002)

    Google Scholar 

  21. 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

    Chapter  Google Scholar 

  22. Iwama, K., Miyazaki, S.: SAT-varible complexity of hard combinatorial problems. In: IFIP Congress, vol. 1, pp. 253–258 (1994)

    Google Scholar 

  23. Jackson, D., Abstractions, S.: Logic, Language, and Analysis. MIT Press, Cambridge (2012)

    Google Scholar 

  24. Li, C.M.: Integrating equivalency reasoning into davis-putnam procedure. In: AAAI, pp. 291–296 (2000)

    Google Scholar 

  25. Metodi, A., Codish, M.: Compiling finite domain constraints to SAT with BEE. Theor. Pract. Log. Program. 12(4–5), 465–483 (2012)

    Article  MATH  Google Scholar 

  26. 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

    Google Scholar 

  27. 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)

    Article  MathSciNet  MATH  Google Scholar 

  28. 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

    Google Scholar 

  29. Ohrimenko, O., Stuckey, P.J., Codish, M.: Propagation via lazy clause generation. Constraints 14(3), 357–391 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  30. Petke, J.: Bridging Constraint Satisfaction and Boolean Satisfiability. Artificial Intelligence: Foundations, Theory, and Algorithms. Springer, Heidelberg (2015)

    Book  MATH  Google Scholar 

  31. Rossi, F., van Beek, P., Walsh, T.: Handbook of Constraint Programming. Elsevier, Amsterdam (2006)

    MATH  Google Scholar 

  32. 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)

    Article  Google Scholar 

  33. Stojadinovic, M., Maric, F.: meSAT: multiple encodings of CSP to SAT. Constraints 19(4), 380–403 (2014)

    Article  MathSciNet  MATH  Google Scholar 

  34. Tamura, N., Taga, A., Kitagawa, S., Banbara, M.: Compiling finite linear CSP into SAT. Constraints 14(2), 254–272 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  35. Veksler, M., Strichman, O.: Learning general constraints in CSP. Artif. Intell. 238, 135–153 (2016)

    Article  MathSciNet  MATH  Google Scholar 

  36. 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

    Chapter  Google Scholar 

  37. Warners, J.P.: A linear-time transformation of linear inequalities into conjunctive normal form. Inf. Process. Lett. 68(2), 63–69 (1998)

    Article  MathSciNet  MATH  Google Scholar 

  38. 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

    Chapter  Google Scholar 

Download references

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

Authors

Corresponding author

Correspondence to Neng-Fa Zhou .

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics