Skip to main content

PySAT: A Python Toolkit for Prototyping with SAT Oracles

  • Conference paper
  • First Online:
Theory and Applications of Satisfiability Testing – SAT 2018 (SAT 2018)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 10929))

Abstract

Boolean satisfiability (SAT) solvers are at the core of efficient approaches for solving a vast multitude of practical problems. Moreover, albeit targeting an NP-complete problem, SAT solvers are increasingly used for tackling problems beyond NP. Despite the success of SAT in practice, modeling with SAT and more importantly implementing SAT-based problem solving solutions is often a difficult and error-prone task. This paper proposes the PySAT toolkit, which enables fast Python-based prototyping using SAT oracles and SAT-related technology. PySAT provides a simple API for working with a few state-of-the-art SAT oracles and also integrates a number of cardinality constraint encodings, all aiming at simplifying the prototyping process. Experimental results presented in the paper show that PySAT-based implementations can be as efficient as those written in a low-level language.

This work was supported by FCT funding of post-doctoral grants SFRH/BPD/103609/2014, SFRH/BPD/120315/2016, FCT grant ABSOLV (028986/02/SAICT/2017), and LASIGE Research Unit, ref. UID/CEC/00408/2013.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

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

Institutional subscriptions

Notes

  1. 1.

    The method get_model() (get_core(), resp.) can be used if a prior SAT call was made and returned True (False, resp.). The get_core() method additionally assumes the SAT call was provided with a list of assumptions.

References

  1. Ansótegui, C., Bonet, M.L., Levy, J.: SAT-based MaxSAT algorithms. Artif. Intell. 196, 77–105 (2013)

    Article  MathSciNet  Google Scholar 

  2. Asín, R., Nieuwenhuis, R., Oliveras, A., Rodríguez-Carbonell, E.: Cardinality networks and their applications. In: Kullmann, O. (ed.) SAT 2009. LNCS, vol. 5584, pp. 167–180. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-02777-2_18

    Chapter  MATH  Google Scholar 

  3. Audemard, G., Lagniez, J.-M., Simon, L.: Improving glucose for incremental SAT solving with assumptions: application to MUS extraction. In: Järvisalo, M., Van Gelder, A. (eds.) SAT 2013. LNCS, vol. 7962, pp. 309–317. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-39071-5_23

    Chapter  MATH  Google Scholar 

  4. Bacchus, F., Hyttinen, A., Järvisalo, M., Saikko, P.: Reduced cost fixing in MaxSAT. In: Beck, J.C. (ed.) CP 2017. LNCS, vol. 10416, pp. 641–651. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-66158-2_41

    Chapter  Google Scholar 

  5. Bailleux, O., Boufkhad, Y.: Efficient CNF encoding of Boolean cardinality constraints. In: Rossi, F. (ed.) CP 2003. LNCS, vol. 2833, pp. 108–122. Springer, Heidelberg (2003). https://doi.org/10.1007/978-3-540-45193-8_8

    Chapter  MATH  Google Scholar 

  6. Batcher, K.E.: Sorting networks and their applications. In: AFIPS Conference, pp. 307–314 (1968)

    Google Scholar 

  7. Biere, A.: Lingeling, plingeling and treengeling entering the SAT competition 2013. In: Balint, A., Belov, A., Heule, M., Järvisalo, M. (eds.) Proceedings of SAT Competition 2013, volume B-2013-1 of Department of Computer Science Series of Publications B, pp. 51–52. University of Helsinki (2013)

    Google Scholar 

  8. Biere, A.: Lingeling essentials, a tutorial on design and implementation aspects of the SAT solver lingeling. In: Pragmatics of SAT workshop, p. 88 (2014)

    Google Scholar 

  9. Biere, A., Heule, M., van Maaren, H., Walsh, T. (eds.): Handbook of Satisfiability. Frontiers in Artificial Intelligence and Applications, vol. 185. IOS Press, Amsterdam (2009)

    MATH  Google Scholar 

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

    Article  MathSciNet  Google Scholar 

  11. CryptoMiniSat. https://github.com/msoos/cryptominisat/

  12. Eén, N., Sörensson, N.: An extensible SAT-solver. In: Giunchiglia, E., Tacchella, A. (eds.) SAT 2003. LNCS, vol. 2919, pp. 502–518. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-24605-3_37

    Chapter  Google Scholar 

  13. Eén, N., Sörensson, N.: Temporal induction by incremental SAT solving. Electron. Notes Theor. Comput. Sci. 89(4), 543–560 (2003)

    Article  Google Scholar 

  14. Fu, Z., Malik, S.: On solving the partial MAX-SAT problem. In: Biere, A., Gomes, C.P. (eds.) SAT 2006. LNCS, vol. 4121, pp. 252–265. Springer, Heidelberg (2006). https://doi.org/10.1007/11814948_25

    Chapter  Google Scholar 

  15. Gent, I., Nightingale, P.: A new encoding of alldifferent into SAT. In: International Workshop on Modelling and Reformulating Constraint Satisfaction Problem, pp. 95–110 (2004)

    Google Scholar 

  16. Glucose 3 and Glucose 4.1. http://www.labri.fr/perso/lsimon/glucose/

  17. graphviz. https://www.graphviz.org/

  18. Gurobi. http://www.gurobi.com/

  19. IBM ILOG: CPLEX optimizer 12.7.0 (2016). http://www-01.ibm.com/software/commerce/optimization/cplex-optimizer

  20. Janota, M.: MiFuMax – a literate MaxSAT solver. JSAT 9, 83–88 (2015)

    MathSciNet  Google Scholar 

  21. Lingeling bbc-9230380-160707. http://fmv.jku.at/lingeling/

  22. Martins, R., Joshi, S., Manquinho, V., Lynce, I.: Incremental cardinality constraints for MaxSAT. In: O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656, pp. 531–548. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-10428-7_39

    Chapter  Google Scholar 

  23. Matplotlib. https://matplotlib.org/

  24. Eighth Max-SAT Evaluation. http://www.maxsat.udl.cat/13/

  25. MaxSAT Evaluation 2017. http://mse17.cs.helsinki.fi/

  26. MiFuMax. http://sat.inesc-id.pt/~mikolas/

  27. MiniCard 1.2. https://github.com/liffiton/minicard/

  28. MiniSat 2.2. http://minisat.se/MiniSat.html

  29. MiniSat GitHub. https://github.com/niklasso/minisat/

  30. Morgado, A., Heras, F., Liffiton, M.H., Planes, J., Marques-Silva, J.: Iterative and core-guided MaxSAT solving: a survey and assessment. Constraints 18(4), 478–534 (2013)

    Article  MathSciNet  Google Scholar 

  31. networkx. https://networkx.github.io/

  32. NumPy. http://www.numpy.org/

  33. Ogawa, T., Liu, Y., Hasegawa, R., Koshimura, M., Fujita, H.: Modulo based CNF encoding of cardinality constraints and its application to MaxSAT solvers. In: ICTAI, pp. 9–17 (2013)

    Google Scholar 

  34. pandas. https://pandas.pydata.org/

  35. PBLib. http://tools.computational-logic.org/content/pblib.php

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

    Chapter  Google Scholar 

  37. Prestwich, S.D.: CNF encodings. In: Handbook of Satisfiability, pp. 75–97 (2009)

    Google Scholar 

  38. pylgl. https://github.com/abfeldman/pylgl/

  39. PyMiniSolvers. https://github.com/liffiton/PyMiniSolvers/

  40. PyPI. https://pypi.python.org/

  41. PySAT. https://pysathq.github.io/

  42. Pytorch. http://pytorch.org/

  43. satispy. https://github.com/netom/satispy/

  44. scikit-learn. http://scikit-learn.org/

  45. SciPy. https://scipy.org/

  46. Silva, J.M.: Minimal unsatisfiability: models, algorithms and applications (invited paper). In: ISMVL, pp. 9–14 (2010)

    Google Scholar 

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

    Chapter  MATH  Google Scholar 

  48. Soos, M.: Enhanced Gaussian elimination in DPll-based SAT solvers. In: POS@SAT, pp. 2–14 (2010)

    Google Scholar 

  49. Soos, M., Nohl, K., Castelluccia, C.: Extending SAT solvers to cryptographic problems. In: Kullmann, O. (ed.) SAT 2009. LNCS, vol. 5584, pp. 244–257. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-02777-2_24

    Chapter  Google Scholar 

  50. Tseitin, G.S.: On the complexity of derivations in the propositional calculus. Stud. Math. Math. Log. Part II, 115–125 (1968)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Alexey Ignatiev .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer International Publishing AG, part of Springer Nature

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Ignatiev, A., Morgado, A., Marques-Silva, J. (2018). PySAT: A Python Toolkit for Prototyping with SAT Oracles. In: Beyersdorff, O., Wintersteiger, C. (eds) Theory and Applications of Satisfiability Testing – SAT 2018. SAT 2018. Lecture Notes in Computer Science(), vol 10929. Springer, Cham. https://doi.org/10.1007/978-3-319-94144-8_26

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-94144-8_26

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-94143-1

  • Online ISBN: 978-3-319-94144-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics