Making Compact-Table Compact

  • Linnea Ingmar
  • Christian SchulteEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11008)


The compact-table propagator for table constraints appears to be a strong candidate for inclusion into any constraint solver due to its efficiency and simplicity. However, successful integration into a constraint solver based on copying rather than trailing is not obvious: while the underlying bit-set data structure is sparse for efficiency it is not compact for memory, which is essential for a copying solver.

The paper introduces techniques to make compact-table an excellent fit for a copying solver. The key is to make sparse bit-sets dynamically compact (only their essential parts occupy memory and their implementation is dynamically adapted during search) and tables shared (their read-only parts are shared among copies). Dynamically compact bit-sets reduce peak memory by \(7.2\%\) and runtime by \(13.6\%\) on average and by up to \(66.3\%\) and \(33.2\%\). Shared tables even further reduce runtime and memory usage. The reduction in runtime exceeds the reduction in memory and a cache analysis indicates that our techniques might also be beneficial for trailing solvers. The proposed implementation has replaced Gecode’s original implementations as it runs on average almost an order of magnitude faster while using half the memory.



We are grateful for numerous comments and assistance from Mats Carlsson and Roberto Castañeda Lozano. Part of the work has been carried out in the first author’s bachelor thesis [6] and during her student internship at KTH. We are grateful for the helpful comments from the anonymous reviewers.


  1. 1.
    Beck, J.C. (ed.): CP 2017. LNCS, vol. 10416. Springer, Cham (2017). Scholar
  2. 2.
    Bessière, C. (ed.): CP 2007. LNCS, vol. 4741. Springer, Heidelberg (2007). Scholar
  3. 3.
    Bessière, C., Régin, J.C.: Arc consistency for general constraint networks: preliminary results. In: International Joint Conference on Artificial Intelligence (IJCAI), vol. 1, Nagoya, Japan, pp. 398–404, August 1997Google Scholar
  4. 4.
    Bessière, C., Régin, J.C., Yap, R.H.C., Zhang, Y.: An optimal coarse-grained arc consistency algorithm. Artif. Intell. 165(2), 165–185 (2005)MathSciNetCrossRefGoogle Scholar
  5. 5.
    Demeulenaere, J., et al.: Compact-table: efficiently filtering table constraints with reversible sparse bit-sets. In: Rueher, M. (ed.) CP 2016. LNCS, vol. 9892, pp. 207–223. Springer, Cham (2016). Scholar
  6. 6.
    Ingmar, L.: Implementation and evaluation of a compact-table propagator in Gecode. Bachelor thesis, Department of Information Technology, Uppsala University, Sweden, August 2017.
  7. 7.
    Lagerkvist, M.Z., Schulte, C.: Advisors for incremental propagation. In: Bessière [2], pp. 409–422Google Scholar
  8. 8.
    Nethercote, N., Seward, J.: Valgrind: a framework for heavyweight dynamic binary instrumentation. In: Ferrante, J., McKinley, K.S. (eds.) Conference on Programming Language Design and Implementation (PLDI), pp. 89–100. ACM, San Diego (2007)Google Scholar
  9. 9.
    Nethercote, N., Stuckey, P.J., Becket, R., Brand, S., Duck, G.J., Tack, G.: MiniZinc: towards a standard CP modelling language. In: Bessière [2], pp. 529–543Google Scholar
  10. 10.
    Reischuk, R.M., Schulte, C., Stuckey, P.J., Tack, G.: Maintaining state in propagation solvers. In: Gent, I.P. (ed.) CP 2009. LNCS, vol. 5732, pp. 692–706. Springer, Heidelberg (2009). Scholar
  11. 11.
    de Saint-Marcq, V.L.C., Schaus, P., Solnon, C., Lecoutre, C.: Sparse-sets for domain implementation. In: CP Workshop on Techniques for Implementing Constraint Programming Systems (TRICS), pp. 1–10, Uppsala, Sweden, September 2013Google Scholar
  12. 12.
    Schaus, P., Aoga, J.O.R., Guns, T.: CoverSize: a global constraint for frequency-based itemset mining. In: Beck [1], pp. 529–546Google Scholar
  13. 13.
    Schulte, C.: Comparing trailing and copying for constraint programming. In: De Schreye, D. (ed.) International Conference on Logic Programming, pp. 275–289. The MIT Press, Las Cruces (1999)Google Scholar
  14. 14.
    Verhaeghe, H., Lecoutre, C., Deville, Y., Schaus, P.: Extending compact-table to basic smart tables. In: Beck [1], pp. 297–307Google Scholar
  15. 15.
    Verhaeghe, H., Lecoutre, C., Schaus, P.: Extending compact-table to negative and short tables. In: Singh, S.P., Markovitch, S. (eds.) AAAI Conference on Artificial Intelligence, San Francisco, CA, USA, pp. 3951–3957, February 2017Google Scholar

Copyright information

© Springer Nature Switzerland AG 2018

Authors and Affiliations

  1. 1.Uppsala UniversityUppsalaSweden
  2. 2.KTH Royal Institute of TechnologyStockholmSweden

Personalised recommendations