Skip to main content
Log in

Solution sampling with random table constraints

  • Published:
Constraints Aims and scope Submit manuscript

A Correction to this article was published on 07 September 2023

This article has been updated

Abstract

Constraint programming provides generic techniques to efficiently solve combinatorial problems. In this paper, we tackle the natural question of using constraint solvers to sample combinatorial problems in a generic way. We propose an algorithm, inspired from Meel’s ApproxMC algorithm on SAT, to add hashing constraints to a CP model in order to split the search space into small cells. By uniformly sampling the solutions in one cell, we can generate random solutions without revamping the model of the problem. We ensure the randomness by introducing a new family of hashing constraints: randomly generated tables, which keeps the cost of the hashing process tractable. We implemented this solving method using the constraint solver Choco-solver. The quality of the randomness and the running time of our approach are experimentally compared to a random branching strategy. We show that our approach improves the randomness while being in the same order of magnitude in terms of running time. We also use our algorithm with an other, more powerful, set of hashing constraints: linear modular equalities. We experimentally show that the resulting sampling is uniform, at the cost of a longer running time.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8

Similar content being viewed by others

Change history

Notes

  1. https://github.com/MathieuVavrille/tableSampling

  2. https://github.com/PesantGilles/MiniCPBP

  3. https://github.com/MiniZinc/minizinc-benchmarks/tree/master/on-call-rostering

  4. We use the library “Apache Commons Mathematics Library” (https://commons.apache.org/proper/commons-math/) for the probability computations

  5. https://www.minizinc.org/challenge.html

References

  1. Hartert, R., & Schaus, P. (2014). A support-based algorithm for the bi-objective pareto constraint. In C. E. Brodley, & P. Stone (Eds.), Proceedings of the Twenty-Eighth AAAI Conference on Artificial Intelligence, July 27 -31, 2014, Québec City, Québec, Canada (pp. 2674–2679). AAAI Press.

  2. Rossi, F., Venable, K. B., & Walsh, T. (2008). Preferences in constraint satisfaction and optimization. AI Mag., 29, 58–68.

    Google Scholar 

  3. Hebrard, E., Hnich, B., O’Sullivan, B., & Walsh, T. (2005). Finding diverse and similar solutions in constraint programming. In AAAI (pp. 372–377). volume 5.

  4. Hebrard, E. (2006). Robust Solutions for Constraint Satisfaction and Optimisation under Uncertainty. Ph.D. thesis University of New South Wales.

  5. Meel, K. S. (2018). Constrained counting and sampling: bridging the gap between theory and practice. arXiv preprint arXiv:1806.02239, .

  6. Demeulenaere, J., Hartert, R., Lecoutre, C., Perez, G., Perron, L., Régin, J.-C., & Schaus, P. (2016). Compact-table: efficiently filtering table constraints with reversible sparse bit-sets. In International Conference on Principles and Practice of Constraint Programming (pp. 207–223). Springer.

  7. Prud’homme, C., Fages, J.-G., & Lorca, X. (2016). Choco Solver Documentation. TASC, INRIA Rennes, LINA CNRS UMR 6241, COSLING S.A.S.

  8. Pesant, G., Meel, K. S., & Mohammadalitajrishi, M. (2021). On the usefulness of linear modular arithmetic in constraint programming. In Integration of Constraint Programming, Artificial Intelligence, and Operations Research - 18th International Conference, CPAIOR 2021, Vienna, Austria, September 21-24, 2021, Proceedings Lecture Notes in Computer Science. Springer.

  9. Acher, M., Temple, P., Jézéquel, J.-M., Galindo, J. A., Martinez, J., & Ziadi, T. (2018). Varylatex: Learning paper variants that meet constraints. In Proceedings of the 12th International Workshop on Variability Modelling of Software-Intensive Systems (pp. 83–88).

  10. Gotlieb, A., & Marijan, D. (2017). Using global constraints to automate regression testing. AI Magazine, 38, 73–87.

    Article  Google Scholar 

  11. Plazar, Q., Acher, M., Bardin, S., & Gotlieb, A. (2017). Efficient and complete fd-solving for extended array constraints. In IJCAI 2017.

    Google Scholar 

  12. Gomes, C. P., van Hoeve, W. J., Sabharwal, A., & Selman, B. (2007). Counting csp solutions using generalized xor constraints. In AAAI (pp. 204–209).

  13. Plaza, S. M., Markov, I. L., & Bertacco, V. (2008). Random stimulus generation using entropy and xor constraints. In 2008 Design, Automation and Test in Europe (pp. 664–669). IEEE.

  14. Yuan, J., Shultz, K., Pixley, C., Miller, H., & Aziz, A. (1999). Modeling design constraints and biasing in simulation using bdds. In 1999 IEEE/ACM International Conference on Computer-Aided Design. Digest of Technical Papers (Cat. No. 99CH37051) (pp. 584–589). IEEE.

  15. Wei, W., Erenrich, J., & Selman, B. (2004). Towards efficient sampling: Exploiting random walk strategies. In AAAI (pp. 670–676). volume 4.

  16. Kitchen, N., & Kuehlmann, A. (2007). Stimulus generation for constrained random simulation. In 2007 IEEE/ACM International Conference on Computer-Aided Design (pp. 258–265). IEEE.

  17. Ermon, S., Gomes, C. P., & Selman, B. (2012). Uniform solution sampling using a constraint solver as an oracle. arXiv preprint arXiv:1210.4861, .

  18. Dutra, R., Laeufer, K., Bachrach, J., & Sen, K. (2018). Efficient sampling of sat solutions for testing. In 2018 IEEE/ACM 40th International Conference on Software Engineering (ICSE) (pp. 549–559). IEEE.

  19. Dechter, R., Kask, K., Bin, E., Emek, R. et al. (2002a). Generating random solutions for constraint satisfaction problems. In AAAI/IAAI (pp. 15–21).

  20. Gogate, V., & Dechter, R. (2006). A new algorithm for sampling csp solutions uniformly at random. In International Conference on Principles and Practice of Constraint Programming (pp. 711–715). Springer.

  21. Dechter, R., Kask, K., & Mateescu, R. (2002b). Iterative join-graph propagation, .

  22. Schreiber, Y. (2010). Value-ordering heuristics: Search performance vs. solution diversity. In International Conference on Principles and Practice of Constraint Programming (pp. 429–444). Springer.

  23. Pearson, K. (1900). X. on the criterion that a given system of deviations from the probable in the case of a correlated system of variables is such that it can be reasonably supposed to have arisen from random sampling. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 50, 157–175.

    Article  MATH  Google Scholar 

  24. Boussemart, F., Hemery, F., Lecoutre, C., & Sais, L. (2004). Boosting systematic search by weighting constraints. In ECAI (p. 146). volume 16.

  25. Lecoutre, C., Sais, L., Tabary, S., & Vidal, V. (2006). Last conflict based reasoning. In G. Brewka, S. Coradeschi, A. Perini, & P. Traverso (Eds.), ECAI 2006, 17th European Conference on Artificial Intelligence, August 29 - September 1, 2006, Riva del Garda, Italy, Including Prestigious Applications of Intelligent Systems (PAIS 2006), Proceedings (pp. 133–137). IOS Press volume 141 of Frontiers in Artificial Intelligence and Applications.

  26. Knuth, D. E. (2014). Art of computer programming, volume 2: Seminumerical algorithms. Addison-Wesley Professional.

  27. Bach, E. (1987). Realistic analysis of some randomized algorithms. In Proceedings of the nineteenth annual ACM symposium on Theory of computing (pp. 453–461).

  28. Regnell, B., & Kuchcinski, K. (2011). Exploring software product management decision problems with constraint solving-opportunities for prioritization and release planning. In 2011 Fifth International Workshop on Software Product Management (IWSPM) (pp. 47–56). IEEE.

  29. Ruhe, G., & Saliu, M. O. (2005). The art and science of software release planning. IEEE software, 22, 47–53.

    Article  Google Scholar 

Download references

Acknowledgements

This article is an extended version of a conference paper: Solution sampling with random table constraints, Mathieu Vavrille, Charlotte Truchet, Charles Prud’homme, Proceedings of CP 2021, 56:1-56:17. This work was presented at the conference on October 2021: https://cp2021.lirmm.fr/submissions/74. Compared to the conference article, this version has been extended with the implementation of another series of hashing constraints, proposed in [8], inside the framework, more extensive experiments on a wider benchmark, and a more thorough analysis of the results and algorithm behaviour.

Funding

Partial financial support was received from the French National Research Agency as part of the DeCrypt project (ANR-18-CE39-0007) for two of the authors (Prud’homme and Truchet).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Mathieu Vavrille.

Ethics declarations

Competing interest

Apart from the project mentioned above, the authors have no other competing interests to declare that are relevant to the content of this article.

Additional information

The original online version of this article was revised: The main results of the article remains unchanged, but we misinterpreted a figure. The mistake is on the analysis of Figure 6a, the figure itself is correct, but we did not analyze it correctly.

Raw results of the MiniZinc benchmark

Raw results of the MiniZinc benchmark

This appendix presents in Table 1 the computation results.

Table 1 First table of raw results

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Vavrille, M., Truchet, C. & Prud’homme, C. Solution sampling with random table constraints. Constraints 27, 381–413 (2022). https://doi.org/10.1007/s10601-022-09329-w

Download citation

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10601-022-09329-w

Keywords

Navigation