Abstract
When implementing a propagator for a constraint, one must decide about variants: When implementing min, should one also implement max? Should one implement linear constraints both with unit and non-unit coefficients? Constraint variants are ubiquitous: implementing them requires considerable (if not prohibitive) effort and decreases maintainability, but will deliver better performance than resorting to constraint decomposition. This paper shows how to use views to derive propagator variants, combining the efficiency of dedicated propagator implementations with the simplicity and effortlessness of decomposition. A model for views and derived propagators is introduced. Derived propagators are proved to be perfect in that they inherit essential properties such as correctness and domain and bounds consistency. Techniques for systematically deriving propagators such as transformation, generalization, specialization, and type conversion are developed. The paper introduces an implementation architecture for views that is independent of the underlying constraint programming system. A detailed evaluation of views implemented in Gecode shows that derived propagators are efficient and that views often incur no overhead. Views have proven essential for implementing Gecode, substantially reducing the amount of code that needs to be written and maintained.
Similar content being viewed by others
References
Apt, K.R. (2003). Principles of constraint programming. Cambridge University Press, Cambridge, UK.
Baptiste, P., Le Pape, C., Nuijten, W. (2001). Constraint-based scheduling. International series in operations research & management science. Kluwer Academic Publishers.
Beeri, C., Fagin, R., Maier, D., Yannakakis, M. (1983). On the desirability of acyclic database schemes. Journal of the ACM, 30(3), 479–513.
Beldiceanu, N., Katriel, I., Thiel, S. (2004). Filtering algorithms for the same constraint. In Régin, J.C., & Rueher, M. (Eds.), Integration of AI and OR techniques in constraint programming for combinatorial optimization problems, LNCS, (Vol. 3011, pp. 65–79). Springer.
Carlsson, M., Ottosson, G., Carlson, B. (1997). An open-ended finite domain constraint solver. In Glaser, H., Hartel, P.H., Kuchen, H. (Eds.), Programming languages: Implementations, logics, and programs, LNCS (Vol. 1292, pp. 191–206). Springer, Southampton, UK.
The CHOCO team (2012). CHOCO. http://www.emn.fr/z-info/choco-solver/. Accessed Nov 2012.
Choi, C.W., Harvey, W., Lee, J.H.M., Stuckey, P.J. (2006). Finite domain bounds consistency revisited. In Sattar, A., & Kang, B.H. (Eds.), AI 2006: Advances in artificial intelligence, LNCS (Vol. 4304, pp. 49–58). Springer.
Correia, M. (2010). Modern techniques for constraint solving: the CaSPER experience. Ph.D. thesis, Universidade Nova de Lisboa.
Correia, M., & Barahona, P. (2009). Type parametric compilation of algebraic constraints. In Lopes, L.S., Lau, N., Mariano, P., Rocha, L.M. (Eds.), EPIA, LNCS (Vol. 5816, pp. 201–212). Springer.
Driesen, K., & Hölzle, U. (1996). The direct cost of virtual function calls in C+ +. In OOPSLA (pp. 306–323).
The ECLiPSe project (2012). ECLiPSe. www.eclipse-clp.org. Accessed Nov 2012
Eén, N., & Sörensson, N. (2004). An extensible SAT-solver. In Giunchiglia, E., & Tacchella, A., (eds.), Theory and Applications of Satisfiability Testing, LNCS (Vol. 2919, pp. 502–518). Santa Margherita Ligure, Italy: Springer.
Feydy, T., & Stuckey, P.J. (2009). Lazy clause generation reengineered. In Gent, I.P. (Ed.), Fifteenth international conference on principles and practice of constraint programming, LNCS (Vol. 5732, pp. 352–366). Springer.
Gent, I.P., Jefferson, C., Miguel, I. (2006). Minion: A fast scalable constraint solver. In Brewka, G., Coradeschi, S., Perini, A., Traverso, P. (Eds.), ECAI, frontiers in artificial intelligence and applications (Vol. 141, pp. 98–102). IOS Press.
Gent, I.P., Jefferson, C., Miguel, I. (2006). Watched literals for constraint propagation in Minion. In Benhamou, F. (Ed.), Twelfth internation conference on principles and practice of constraint programming, LNCS (Vol. 4204, pp. 182–197). Nantes, France: Springer.
Gervet, C. (1994). Conjunto: Constraint logic programming with finite set domains. In Bruynooghe, M. (Ed.), International symposium on logic programming (pp. 339–358). Ithaca, NY, U.S.A.: MIT Press.
Google (2012). Google or-tools. http://code.google.com/p/or-tools/. Accessed Nov 2012.
Gosling, J., Joy, B., Steele, G., Bracha, G. (2005). The Java language specification, 3rd Edn. Addison-Wesley Professional.
Harvey, W., & Stuckey, P.J. (2003). Improving linear constraint propagation by changing constraint representation. Constraints, 7, 173–207.
Hawkins, P., Lagoon, V., Stuckey, P.J. (2005). Solving set constraint satisfaction problems using ROBDDs. Journal of Artificial Intelligence Research, 24, 109–156.
Hölzle, U., & Ungar, D. (1994). Optimizing dynamically-dispatched calls with run-time type feedback. In PLDI ’94: Proceedings of the ACM SIGPLAN 1994 conference on programming language design and implementation (pp. 326–336). New York, NY, U.S.A.: ACM. doi:10.1145/178243.178478.
IBM Corporation (2009). IBM ILOG CP Optimizer V2.3 User’s Manual.
Laburthe, F. (2000). Choco: Implementing a CP kernel. In Beldiceanu, N., Harvey, W., Henz, M., Laburthe, F., Monfroy, E., T. Müller, Perron, L., Schulte, C. (Eds.), Proceedings of TRICS: Techniques for implementing constraint programming systems, a post-conference workshop of CP 2000 (pp. 71–85).
Lagerkvist, M.Z., & Pesant, G. (2008). Modeling irregular shape placement problems with regular constraints. In First workshop on bin packing and placement constraints BPPC’08.
Lagerkvist, M.Z., & Schulte, C. (2009). Propagator groups. In: Gent, I.P. (Ed.), Fifteenth international conference on principles and practice of constraint programming, LNCS (Vol. 5732, pp. 524–538). Springer.
Mackworth, A. (1977). Consistency in networks of relations. Artificial Intelligence, 8(1), 99–118.
Milner, R., Tofte, M., MacQueen, D. (1997). The definition of standard ML. Cambridge, MA, U.S.A.: MIT Press.
The Mozart Consortium (2012). The Mozart programming system. www.mozart-oz.org. Accessed Nov 2012.
Peyton Jones, S.L. (2003). Haskell 98. Journal of Functional Programming, 13(1), 1–255.
Puget, J.F. (1992). PECOS: A high level constraint programming language. In Proceedings of the first Singapore international conference on Intelligent Systems (SPICIS) (pp. 137–142). Singapore.
Puget, J.F. (1994). A C+ + implementation of CLP. In Proceedings of the second Singapore international conference on intelligent systems (SPICIS) (pp. B256–B261). Singapore.
Puget, J.F. (1998). A fast algorithm for the bound consistency of alldiff constraints. In Proceedings of the 15th national conference on artificial intelligence (pp. 359–366). Madison, WI, U.S.A.: AAAI Press.
Quimper, C.G. (2006). Efficient propagators for global constraints. Ph.D. thesis, University of Waterloo, Canada.
Régin, J.C. (1994). A filtering algorithm for constraints of difference in CSPs. In Proceedings of the twelfth national conference on artificial intelligence (pp. 362–367). Seattle, WA, USA: AAAI Press.
Schulte, C., & Carlsson, M. (2006). Finite domain constraint programming systems. In Rossi, F., van Beek, P., Walsh, T. (Eds.), Handbook of constraint programming (chap. 14, pp. 495–526). Amsterdam, The Netherlands: Elsevier Science Publishers.
Schulte, C., & Stuckey, P.J. (2005). When do bounds and domain propagation lead to the same search space? Transactions on Programming Languages and Systems, 27(3), 388–425.
Schulte, C., & Stuckey, P.J. (2008). Efficient constraint propagation engines. Transactions on Programming Languages and Systems, 31(1), 2:1–2:43.
Schulte, C., & Tack, G. (2009). Weakly monotonic propagators. In Gent, I.P. (Ed.), Fifteenth international conference on principles and practice of constraint programming, LNCS (Vol. 5732, pp. 723–730). Springer.
Schulte, C., Lagerkvist, M., Tack, G. (2012). Gecode. www.gecode.org. Accessed Nov 2012.
Swedish Institute of Computer Science (2012). SICStus Prolog. www.sics.se/sicstus/. Accessed Nov 2012.
Van Hentenryck, P., Saraswat, V.A., Deville, Y. (1998). Design, implementation, and evaluation of the constraint language cc(FD). Journal of Logic Programming, 37(1–3), 293–316.
Vilím, P. (2004). O(n log n) filtering algorithms for unary resource constraint. In Régin, J.C., & Rueher, M. (Eds.), Integration of AI and OR techniques in constraint programming for combinatorial optimization problems, LNCS (Vol. 3011, pp. 335–347). Springer.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Schulte, C., Tack, G. View-based propagator derivation. Constraints 18, 75–107 (2013). https://doi.org/10.1007/s10601-012-9133-z
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10601-012-9133-z