Making Compact-Table Compact
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  and during her student internship at KTH. We are grateful for the helpful comments from the anonymous reviewers.
- 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
- 6.Ingmar, L.: Implementation and evaluation of a compact-table propagator in Gecode. Bachelor thesis, Department of Information Technology, Uppsala University, Sweden, August 2017. http://urn.kb.se/resolve?urn=urn:nbn:se:uu:diva-328679
- 7.Lagerkvist, M.Z., Schulte, C.: Advisors for incremental propagation. In: Bessière , pp. 409–422Google Scholar
- 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.Nethercote, N., Stuckey, P.J., Becket, R., Brand, S., Duck, G.J., Tack, G.: MiniZinc: towards a standard CP modelling language. In: Bessière , pp. 529–543Google Scholar
- 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.Schaus, P., Aoga, J.O.R., Guns, T.: CoverSize: a global constraint for frequency-based itemset mining. In: Beck , pp. 529–546Google Scholar
- 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.Verhaeghe, H., Lecoutre, C., Deville, Y., Schaus, P.: Extending compact-table to basic smart tables. In: Beck , pp. 297–307Google Scholar
- 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