From Rules to Constraint Programs with the Rules2CP Modelling Language

  • François Fages
  • Julien Martin
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5655)


In this paper, we present a rule-based modelling language for constraint programming, called Rules2CP. Unlike other modelling languages, Rules2CP adopts a single knowledge representation paradigm based on rules without recursion, and a restricted set of data structures based on records and enumerated lists given with iterators. We show that this is sufficient to model constraint satisfaction problems, together with search strategies where search trees are expressed by logical formulae, and heuristic choice criteria are defined by preference orderings on variables and formulae. We describe the compilation of Rules2CP statements to constraint programs over finite domains, by a term rewriting system and partial evaluation. We prove the confluence of these transformations and provide a complexity bound on the size of the generated programs. The expressiveness of Rules2CP is illustrated first with simple examples, and then with a complete library for packing problems, called PKML, which, in addition to pure bin packing and bin design problems, can deal with common sense rules about weights, stability, as well as specific packing business rules. The performances of both the compiler and the generated code are evaluated on Korf’s benchmarks of optimal rectangle packing problems.


Modelling Language Constraint Program Business Rule Constraint Logic Programming Rule Engine 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Van Hentenryck, P.: The OPL Optimization programming Language. MIT Press, Cambridge (1999)Google Scholar
  2. 2.
    Hentenryck, P.V., Perron, L., Puget, J.F.: Search and strategies in opl. ACM Transactions on Compututational Logic 1, 285–320 (2000)MathSciNetCrossRefGoogle Scholar
  3. 3.
    Rafeh, R., de la Banda, M.G., Marriott, K., Wallace, M.: From Zinc to design model. In: Hanus, M. (ed.) PADL 2007. LNCS, vol. 4354, pp. 215–229. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  4. 4.
    de la Banda, M.G., Marriott, K., Rafeh, R., Wallace, M.: The modelling language Zinc. In: Benhamou, F. (ed.) CP 2006. LNCS, vol. 4204, pp. 700–705. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  5. 5.
    Frisch, A.M., Harvey, W., Jefferson, C., Martinez-Hernandez, B., Miguel, I.: Essence: A constraint language for specifying combinatorial problems. Constraints 13, 268–306 (2008)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Group, B.R.: The business rules manifesto Business Rules Group (2003),
  7. 7.
    Korf, R.E.: Optimal rectangle packing: New results. In: ICAPS, pp. 142–149 (2004)Google Scholar
  8. 8.
    Haemmerlé, R., Fages, F.: Modules for prolog revisited. In: Etalle, S., Truszczyński, M. (eds.) ICLP 2006. LNCS, vol. 4079, pp. 41–55. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  9. 9.
    Van Hentenryck, P.: Constraint satisfaction in Logic Programming. MIT Press, Cambridge (1989)Google Scholar
  10. 10.
    Huang, J., Darwiche, A.: The language of search. Journal of Artificial Intelligence Research 29, 191–219 (2007)MathSciNetzbMATHGoogle Scholar
  11. 11.
    Apt, K., Wallace, M.: Constraint Logic Programming using Eclipse. Cambridge University Press, Cambridge (2006)CrossRefGoogle Scholar
  12. 12.
    Carlsson, M., et al.: SICStus Prolog User’s Manual. Swedish Institute of Computer Science, 4th edn. (2007), ISBN 91-630-3648-7Google Scholar
  13. 13.
    Fages, F., Soliman, S., Coolen, R.: CLPGUI: a generic graphical user interface for constraint logic programming. Journal of Constraints, Special Issue on User-Interaction in Constraint Satisfaction 9, 241–262 (2004)Google Scholar
  14. 14.
    Fages, F., Martin, J.: From rules to constraint programs with the Rules2CP modelling language. INRIA Research Report RR-6495, Institut National de Recherche en Informatique (2008)Google Scholar
  15. 15.
    Rosen, B.: Tree-manipulating systems and Church-Rosser theorems. Journal of the ACM 20, 160–187 (1973)MathSciNetCrossRefzbMATHGoogle Scholar
  16. 16.
    Carlsson, M., Beldiceanu, N., Martin, J.: A geometric constraint over k-dimensional objects and shapes subject to business rules. In: Stuckey, P.J. (ed.) CP 2008. LNCS, vol. 5202, pp. 220–234. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  17. 17.
    Beldiceanu, N., Carlsson, M., Poder, E., Sadek, R., Truchet, C.: A generic geometrical constraint kernel in space and time for handling polymorphic k-dimensional objects. In: Bessière, C. (ed.) CP 2007. LNCS, vol. 4741, pp. 180–194. Springer, Heidelberg (2007); SICS Technical Report T2007:08, CrossRefGoogle Scholar
  18. 18.
    Allen, J.: Time and time again: The many ways to represent time. International Journal of Intelligent System 6 (1991)Google Scholar
  19. 19.
    Randell, D., Cui, Z., Cohn, A.: A spatial logic based on regions and connection. In: Nebel, B., Rich, C., Swartout, W.R. (eds.) Proc. of 2nd International Conference on Knowledge Representation and reasoning KR 1992, pp. 165–176. Morgan Kaufmann, San Francisco (1992)Google Scholar
  20. 20.
    Carpenter, H., Dowsland, W.: Practical consideration of the pallet loading problem. Journal of the Operations Research Society 36, 489–497 (1985)CrossRefzbMATHGoogle Scholar
  21. 21.
    Simonis, H., O’Sullivan, B.: Using global constraints for rectangle packing. In: Proceedings of the first Workshop on Bin Packing and Placement Constraints BPPC 2008, associated to CPAIOR 2008 (2008)Google Scholar
  22. 22.
    Jaffar, J., Lassez, J.L.: Constraint logic programming. In: Proceedings of the 14th ACM Symposium on Principles of Programming Languages, pp. 111–119. ACM, Munich (1987)Google Scholar
  23. 23.
    Balland, E., Brauner, P., Kopetz, R., Moreau, P.E., Reilles, A.: Tom: Piggybacking rewriting on java. In: Baader, F. (ed.) RTA 2007. LNCS, vol. 4533, pp. 36–47. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  24. 24.
    Fages, F., Coquery, E.: Typing constraint logic programs. Journal of Theory and Practice of Logic Programming 1, 751–777 (2001)MathSciNetCrossRefzbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • François Fages
    • 1
  • Julien Martin
    • 1
  1. 1.Projet Contraintes, INRIA Rocquencourt, BP105Le Chesnay CedexFrance

Personalised recommendations