Skip to main content

SAT Encodings of the At-Most-k Constraint

A Case Study on Configuring University Courses

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


At universities, some fields of study offer multiple branches to graduate in. These branches are defined by mandatory and optional courses. Configuring a branch manually can be a difficult task, especially if some courses have already been attended. Hence, a tool providing guidance on choosing courses is desired. Feature models enable modelling such behaviour, as they are designed to define valid configurations from a set of features. Unfortunately, the branches contain constraints instructing to choose at least k out of n courses in essence. Encoding some of these constraints naïvely in propositional calculus is practically infeasible. We develop a new encoding by combining existing approaches. Furthermore, we report on our experience of encoding the constraints of the computer science master at TU Braunschweig and discuss the impact for research on configurability.

This is a preview of subscription content, access via your institution.

Buying options

USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
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


  1. 1.

  2. 2.

  3. 3.

  4. 4.


  1. Apel, S., Batory, D., Kästner, C., Saake, G.: Feature-Oriented Software Product Lines (2013)

    Google Scholar 

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

    CrossRef  MATH  Google Scholar 

  3. Batory, D.: Feature models, grammars, and propositional formulas. In: Obbink, H., Pohl, K. (eds.) SPLC 2005. LNCS, vol. 3714, pp. 7–20. Springer, Heidelberg (2005).

    CrossRef  Google Scholar 

  4. Benavides, D., Segura, S., Ruiz-Cortés, A.: Automated analysis of feature models 20 years later: a literature review. Inf. Syst. 35(6), 615–708 (2010)

    CrossRef  Google Scholar 

  5. Chen, J.: A new SAT encoding of the at-most-one constraint. In: Proceedings of the Constraint Modelling and Reformulation (2010)

    Google Scholar 

  6. Czarnecki, K., Helsen, S., Eisenecker, U.: Formalizing cardinality-based feature models and their specialization. Softw. Process: Improv. Pract. 10, 7–29 (2005)

    CrossRef  Google Scholar 

  7. Czarnecki, K., Kim, C.H.P.: Cardinality-based feature modeling and constraints: a progress report, pp. 16–20 (2005)

    Google Scholar 

  8. Frisch, A.M., Giannaros, P.A.: SAT encodings of the at-most-k constraint. some old, some new, some fast, some slow. In: Proceedings of the Ninth International Workshop of Constraint Modelling and Reformulation (2010)

    Google Scholar 

  9. Frisch, A.M., Peugniez, T.J.: Solving non-boolean satisfiability problems with stochastic local search. In: IJCAI, vol. 2001, pp. 282–290 (2001)

    Google Scholar 

  10. Frisch, A.M., Peugniez, T.J., Doggett, A.J., Nightingale, P.W.: Solving non-boolean satisfiability problems with stochastic local search: a comparison of encodings. J. Autom. Reason. 35(1–3), 143–179 (2005).

    CrossRef  MathSciNet  MATH  Google Scholar 

  11. Günther, T.: Explaining satisfiability queries for software product lines. Master’s thesis, Braunschweig (2017).

  12. Klieber, W., Kwon, G.: Efficient CNF encoding for selecting 1 from n objects. In: Proceedings of the International Workshop on Constraints in Formal Verification (2007)

    Google Scholar 

  13. Krieter, S., et al.: FeatureIDE: empowering third-party developers, pp. 42–45 (2017).

  14. Krieter, S., Thüm, T., Schulze, S., Schröter, R., Saake, G.: Propagating configuration decisions with modal implication graphs, pp. 898–909, May 2018.

  15. Kučera, P., Savický, P., Vorel, V.: A lower bound on CNF encodings of the at-most-one constraint. In: Gaspers, S., Walsh, T. (eds.) SAT 2017. LNCS, vol. 10491, pp. 412–428. Springer, Cham (2017).

    CrossRef  MATH  Google Scholar 

  16. Mannion, M.: Using first-order logic for product line model validation, pp. 176–187 (2002)

    Google Scholar 

  17. Meinicke, J., Thüm, T., Schröter, R., Benduhn, F., Leich, T., Saake, G.: Mastering Software Variability with FeatureIDE. Springer, Cham (2017).

    CrossRef  Google Scholar 

  18. Mendonça, M.: Efficient reasoning techniques for large scale feature models. Ph.D. thesis, University of Waterloo, Canada (2009)

    Google Scholar 

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

    CrossRef  MATH  Google Scholar 

  20. Thüm, T., Apel, S., Kästner, C., Schaefer, I., Saake, G.: Analysis strategies for software product lines: a classification and survey, pp. 57–58, Gesellschaft für Informatik (GI), Bonn, Germany, March 2015

    Google Scholar 

  21. Wiegand, J., et al.: Eclipse: a platform for integrating development tools. IBM Syst. J. 43(2), 371–383 (2004)

    CrossRef  Google Scholar 

Download references


We thank Moritz Kappel, Chico Sundermann, Timo Günther, Marc Kassubeck, Jan-Philipp Tauscher, and Moritz Mühlhausen for reviewing our paper in the earlier stages. Additional thanks go to the SEFM reviewers for giving very detailed and constructive remarks.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Paul Maximilian Bittner .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Bittner, P.M., Thüm, T., Schaefer, I. (2019). SAT Encodings of the At-Most-k Constraint. In: Ölveczky, P., Salaün, G. (eds) Software Engineering and Formal Methods. SEFM 2019. Lecture Notes in Computer Science(), vol 11724. Springer, Cham.

Download citation

  • DOI:

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-30445-4

  • Online ISBN: 978-3-030-30446-1

  • eBook Packages: Computer ScienceComputer Science (R0)