An Advanced Answer Set Programming Encoding for Nurse Scheduling

  • Mario Alviano
  • Carmine DodaroEmail author
  • Marco Maratea
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10640)


The goal of the Nurse Scheduling Problem (NSP) is to find an assignment of nurses to shifts according to specific requirements. Given its practical relevance, many researchers have developed different strategies for solving several variants of the problem. One of such variants was recently addressed by an approach based on Answer Set Programming (ASP), obtaining promising results. Nonetheless, the original ASP encoding presents some intrinsic weaknesses, which are identified and eventually circumvented in this paper. The new encoding is designed by taking into account both intrinsic properties of NSP and internal details of ASP solvers, such as cardinality and weight constraint propagators. The performance gain of clingo and wasp is empirically verified on instances from ASP literature. As an additional contribution, the performance of clingo and wasp is compared to other declarative frameworks, namely SAT and ILP; the best performance is obtained by clingo running the new ASP encoding.


Answer Set Programming Knowledge representation and reasoning Nurse Scheduling 



We would like to thank Nextage srl for providing support for this work. Mario Alviano has been partially supported by the Italian Ministry for Economic Development (MISE) under project “PIUCultura – Paradigmi Innovativi per l’Utilizzo della Cultura” (no. F/020016/01-02/X27), and under project “Smarter Solutions in the Big Data World (S2BDW)” (no. F/050389/01-03/X32) funded within the call “HORIZON2020” PON I&C 2014-2020, and by Gruppo Nazionale per il Calcolo Scientifico (GNCS-INdAM).


  1. 1.
    The website of Gurobi.
  2. 2.
    Abseher, M., Gebser, M., Musliu, N., Schaub, T., Woltran, S.: Shift design with answer set programming. Fundam. Inform. 147(1), 1–25 (2016). CrossRefzbMATHMathSciNetGoogle Scholar
  3. 3.
    Aickelin, U., Dowsland, K.A.: An indirect genetic algorithm for a nurse-scheduling problem. Comput. OR 31(5), 761–778 (2004). CrossRefzbMATHGoogle Scholar
  4. 4.
    Alviano, M., Dodaro, C.: Anytime answer set optimization via unsatisfiable core shrinking. TPLP 16(5–6), 533–551 (2016). MathSciNetzbMATHGoogle Scholar
  5. 5.
    Alviano, M., Dodaro, C., Leone, N., Ricca, F.: Advances in WASP. In: Calimeri, F., Ianni, G., Truszczynski, M. (eds.) LPNMR 2015. LNCS (LNAI), vol. 9345, pp. 40–54. Springer, Cham (2015). CrossRefGoogle Scholar
  6. 6.
    Alviano, M., Dodaro, C., Ricca, F.: A MaxSAT algorithm using cardinality constraints of bounded size. In: IJCAI 2015, pp. 2677–2683. AAAI Press (2015)Google Scholar
  7. 7.
    Alviano, M., Faber, W.: The complexity boundary of answer set programming with generalized atoms under the FLP semantics. In: Cabalar, P., Son, T.C. (eds.) LPNMR 2013. LNCS (LNAI), vol. 8148, pp. 67–72. Springer, Heidelberg (2013). CrossRefGoogle Scholar
  8. 8.
    Audemard, G., Simon, L.: Extreme cases in SAT problems. In: Creignou, N., Le Berre, D. (eds.) SAT 2016. LNCS, vol. 9710, pp. 87–103. Springer, Cham (2016). Google Scholar
  9. 9.
    Azaiez, M.N., Sharif, S.S.A.: A 0–1 goal programming model for nurse scheduling. Comput. OR 32, 491–507 (2005). CrossRefzbMATHMathSciNetGoogle Scholar
  10. 10.
    Balduccini, M., Gelfond, M., Watson, R., Nogueira, M.: The USA-advisor: a case study in answer set planning. In: Eiter, T., Faber, W., Truszczyński, M. (eds.) LPNMR 2001. LNCS (LNAI), vol. 2173, pp. 439–442. Springer, Heidelberg (2001). CrossRefGoogle Scholar
  11. 11.
    Bard, J.F., Purnomo, H.W.: Preference scheduling for nurses using column generation. Eur. J. Oper. Res. 164(2), 510–534 (2005). CrossRefzbMATHGoogle Scholar
  12. 12.
    Biere, A., Fröhlich, A.: Evaluating CDCL variable scoring schemes. In: Heule, M., Weaver, S. (eds.) SAT 2015. LNCS, vol. 9340, pp. 405–422. Springer, Cham (2015). CrossRefGoogle Scholar
  13. 13.
    Brewka, G., Eiter, T., Truszczynski, M.: Answer set programming at a glance. Commun. ACM 54(12), 92–103 (2011). CrossRefGoogle Scholar
  14. 14.
    Burke, E.K., Causmaecker, P.D., Berghe, G.V., Landeghem, H.V.: The state of the art of nurse rostering. J. Sched. 7(6), 441–499 (2004). CrossRefzbMATHMathSciNetGoogle Scholar
  15. 15.
    Calimeri, F., Faber, W., Gebser, M., Ianni, G., Kaminski, R., Krennwallner, T., Leone, N., Ricca, F., Schaub, T.: ASP-Core-2 Input Language Format (2013).
  16. 16.
    Calimeri, F., Gebser, M., Maratea, M., Ricca, F.: Design and results of the fifth answer set programming competition. Artif. Intell. 231, 151–181 (2016). CrossRefzbMATHMathSciNetGoogle Scholar
  17. 17.
    Chan, P., Weil, G.: Cyclical staff scheduling using constraint logic programming. In: Burke, E., Erben, W. (eds.) PATAT 2000. LNCS, vol. 2079, pp. 159–175. Springer, Heidelberg (2001). CrossRefGoogle Scholar
  18. 18.
    Cheang, B., Li, H., Lim, A., Rodrigues, B.: Nurse rostering problems - a bibliographic survey. Eur. J. Oper. Res. 151(3), 447–460 (2003). CrossRefzbMATHMathSciNetGoogle Scholar
  19. 19.
    Dodaro, C., Gasteiger, P., Leone, N., Musitsch, B., Ricca, F., Schekotihin, K.: Combining answer set programming and domain heuristics for solving hard industrial problems (application paper). TPLP 16(5–6), 653–669 (2016). MathSciNetzbMATHGoogle Scholar
  20. 20.
    Dodaro, C., Leone, N., Nardi, B., Ricca, F.: Allotment problem in travel industry: a solution based on ASP. In: Cate, B., Mileo, A. (eds.) RR 2015. LNCS, vol. 9209, pp. 77–92. Springer, Cham (2015). CrossRefGoogle Scholar
  21. 21.
    Dodaro, C., Maratea, M.: Nurse scheduling via answer set programming. In: Balduccini, M., Janhunen, T. (eds.) LPNMR 2017. LNCS (LNAI), vol. 10377, pp. 301–307. Springer, Cham (2017). CrossRefGoogle Scholar
  22. 22.
    Erdem, E., Öztok, U.: Generating explanations for biomedical queries. TPLP 15(1), 35–78 (2015). MathSciNetzbMATHGoogle Scholar
  23. 23.
    Gavanelli, M., Nonato, M., Peano, A.: An ASP approach for the valves positioning optimization in a water distribution system. J. Log. Comput. 25(6), 1351–1369 (2015). CrossRefzbMATHMathSciNetGoogle Scholar
  24. 24.
    Gebser, M., Kaminski, R., Kaufmann, B., Ostrowski, M., Schaub, T., Wanko, P.: Theory solving made easy with Clingo 5. In: ICLP TCs. OASICS, vol. 52, pp. 2:1–2:15. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik (2016).
  25. 25.
    Gebser, M., Kaminski, R., König, A., Schaub, T.: Advances in gringo series 3. In: Delgrande, J.P., Faber, W. (eds.) LPNMR 2011. LNCS (LNAI), vol. 6645, pp. 345–351. Springer, Heidelberg (2011). CrossRefGoogle Scholar
  26. 26.
    Gebser, M., Kaufmann, B., Kaminski, R., Ostrowski, M., Schaub, T., Schneider, M.T.: Potassco: the Potsdam answer set solving collection. AI Commun. 24(2), 107–124 (2011). zbMATHMathSciNetGoogle Scholar
  27. 27.
    Gebser, M., Kaufmann, B., Schaub, T.: Conflict-driven answer set solving: from theory to practice. Artif. Intell. 187, 52–89 (2012). CrossRefzbMATHMathSciNetGoogle Scholar
  28. 28.
    Gutjahr, W.J., Rauner, M.S.: An ACO algorithm for a dynamic regional nurse-scheduling problem in Austria. Comput. OR 34(3), 642–666 (2007). CrossRefzbMATHGoogle Scholar
  29. 29.
    Koponen, L., Oikarinen, E., Janhunen, T., Säilä, L.: Optimizing phylogenetic supertrees using answer set programming. TPLP 15(4–5), 604–619 (2015). MathSciNetzbMATHGoogle Scholar
  30. 30.
    Marileo, M.C., Bertossi, L.E.: The consistency extractor system: answer set programs for consistent query answering in databases. Data Knowl. Eng. 69(6), 545–572 (2010). CrossRefGoogle Scholar
  31. 31.
    Miller, H.E., Pierskalla, W.P., Rath, G.J.: Nurse scheduling using mathematical programming. Oper. Res. 24(5), 857–870 (1976). CrossRefzbMATHGoogle Scholar
  32. 32.
    Morgado, A., Dodaro, C., Marques-Silva, J.: Core-guided MaxSAT with soft cardinality constraints. In: O’Sullivan, B. (ed.) CP 2014. LNCS, vol. 8656, pp. 564–573. Springer, Cham (2014). Google Scholar
  33. 33.
    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). CrossRefGoogle Scholar
  34. 34.
    Ricca, F., Grasso, G., Alviano, M., Manna, M., Lio, V., Iiritano, S., Leone, N.: Team-building with answer set programming in the Gioia-Tauro seaport. TPLP 12(3), 361–381 (2012). zbMATHMathSciNetGoogle Scholar
  35. 35.
    Topaloglu, S., Selim, H.: Nurse scheduling using fuzzy modeling approach. Fuzzy Sets Syst. 161(11), 1543–1563 (2010). CrossRefzbMATHMathSciNetGoogle Scholar

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  1. 1.DEMACSUniversity of CalabriaRendeItaly
  2. 2.DIBRISUniversity of GenovaGenoaItaly

Personalised recommendations