## Monadic Constraint Programming (2009)

### Cached

### Download Links

Citations: | 19 - 10 self |

### BibTeX

@MISC{Schrijvers09monadicconstraint,

author = {Tom Schrijvers and Peter Stuckey and Philip Wadler},

title = {Monadic Constraint Programming},

year = {2009}

}

### OpenURL

### Abstract

A constraint programming system combines two essential components: a constraint solver and a search engine. The constraint solver reasons about satisfiability of conjunctions of constraints, and the search engine controls the search for solutions by iteratively exploring a disjunctive search tree defined by the constraint program. In this paper we give a monadic definition of constraint programming where the solver is defined as a monad threaded through the monadic search tree. We are then able to define search and search strategies as first class objects that can themselves be built or extended by composable search transformers. Search transformers give a powerful and unifying approach to viewing search in constraint programming, and the resulting constraint programming system is first class and extremely flexible.

### Citations

812 | Semantics of constraint logic programs
- Jaffar, Maher, et al.
- 1998
(Show Context)
Citation Context ...n used throughout the development of CP. Indeed in the evolution of CP we have seen a series of increasingly complex abstractions as the field became better understood. The original CLP(X) framework (=-=Jaffar & Lassez, 1987-=-) already abstracted the constraint language and solver from the rest of the language. Constraint logic programming (CLP) languages such as ECLiPSe (ECLiPSe, 2008) provided search abstractions that al... |

430 | Theory and practice of constraint handling rules
- Frühwirth
- 1998
(Show Context)
Citation Context ...hown in Figure 14. In future work we would like to do the following: • Generalize our search framework to arbitrary search problems. • Integrate a Haskell implementation of constraint handling rules (=-=Frühwirth, 1998-=-) with the framework to provide the combination of programmable search and programmable solving. • Make state-of-the-art constraint solver implementations, e.g., Gecode (Schulte et al., 2009), availab... |

383 |
Programming with Constraints: An Introduction
- Marriott, Stuckey
- 1998
(Show Context)
Citation Context ... and unifying approach to viewing search in constraint programming, and the resulting constraint programming system is first class and extremely flexible. 1 Introduction A constraint programming (CP; =-=Marriott & Stuckey, 1998-=-) system combines two essential components: a constraint solver and a search engine. The constraint solver reasons about conjunctions of constraints, and its principal job is to determine unsatisfiabi... |

342 |
A Filtering Algorithm for Constraints of Difference in CSPs
- Régin
- 1994
(Show Context)
Citation Context ...lver interface. In the next section, we define a more suitable generic model abstraction that is further away from the constraint solver interface. Note that global constraints, such as alldifferent (=-=Régin, 1994-=-), an important feature of CP, may be supported directly by the solver by making them part of the Constraint solver type. They can also be defined succinctly by decomposition to more primitive constra... |

313 | The Oz programming model
- Smolka
- 1995
(Show Context)
Citation Context ...ogic programming (CLP) languages such as ECLiPSe (ECLiPSe, 2008) provided search abstractions that allowed features of search such as variable and value selection to be defined by users code. The Oz (=-=Smolka, 1995-=-) language separated the definition of the search tree, from the method used to explore it, providing functional abstractions for defining the search. OPL (Van Hentenryck et al., 2000) provided for th... |

237 | The OPL Optimization Programming Language - HENTENRYCK - 1999 |

201 | The execution algorithm of Mercury: an efficient purely declarative logic programming language. volume 29
- Somogyi, Henderson, et al.
- 1996
(Show Context)
Citation Context ... devoted to the integration of functional programming and (constraint) logic programming. On the one hand, we have CLP languages with support for a functional notation of predicates, such as Mercury (=-=Somogyi et al., 1996-=-) and Ciao (Casas et al., 2006). Mercury allows the user to program search strategies by using the underlying DFS, much like any CLP language. Ciao offers two alternative search strategies, BFS and it... |

147 | A Denotational Semantics of Inheritance
- Cook
- 1989
(Show Context)
Citation Context ...e, by binding them to Haskell using the C foreign function interface and have them implement the Solver type class. • Investigate the connection between our composable search transformers and mixins (=-=Cook, 1989-=-), and in particular develop monadic mixins suitable for hiding the transformers’ state. • Explore the performance characteristics of the framework: (1) the overhead of the search strategy transformer... |

91 | L.: Constraint-based Local Search - Hentenryck, Michel - 2005 |

56 | Alma-0: An imperative language that supports declarative programming
- Apt, Brunekreef, et al.
- 1998
(Show Context)
Citation Context ...dler, 1985) – upon which various improvements have been made, e.g., BFS (Seres & Spivey, 1999), Prolog’s pruning operator cut (Hinze, 2001), and fair interleaving (Kiselyov et al., 2005). The Alma-0 (=-=Apt et al., 1998-=-) has a similar objective in an imperative setting: it adds Prolog-like DFS and pruning features to Modula-2. FaciLe is a FD constraint library for OCaml, developed as part of the PhD thesis of Nicola... |

49 | Programming constraint inference engines
- Schulte
- 1997
(Show Context)
Citation Context ...ded for composing transformers. The Oz (Smolka, 1995) language was the first language to truly separate the definition of the disjunctive constraint model from the search strategy used to explore it (=-=Schulte, 1997-=-). Here computation spaces capture the solver state, as well as possible choices (effectively the Dynamic nodes). Search strategies such as DFS, BFS, LDS, branch and bound, and BeFS are constructed by... |

41 | SaLSA: A Language for Search Algorithms
- Laburthe, Caseau
- 1998
(Show Context)
Citation Context ...strategy, for example, when the depth bound finishes to another strategy. The user cannot define their own search transformers in the library, though they could be programmed from scratch. The Salsa (=-=Laburthe & Caseau, 2002-=-) language is an imperative domain-specific language for implementing search algorithms on top of constraint solvers. Its center of focus is a node in the search process. Programmers can write custom ... |

39 | Type checking with open type functions
- Schrijvers, Jones, et al.
- 2008
(Show Context)
Citation Context ...Term solver) add :: Constraint solver -> solver Bool run :: solver a -> a This type class requires that solver be a monad, which allows it to encapsulate its state. A solver has two associated types (=-=Schrijvers et al., 2008-=-), the type of supported constraints (Constraint solver) and the type of terms that constraints range over (Term solver). The terms of interest are of course the constraint variables; a fresh variable... |

36 | Compairing Trailing and Copying for Constraint Programming - Schulte - 1999 |

21 | A Syntactic Approach to Combining Functional Notation, Lazy Evaluation, and Higher-Order in LP Systems
- Casas, Cabeza, et al.
(Show Context)
Citation Context ...unctional programming and (constraint) logic programming. On the one hand, we have CLP languages with support for a functional notation of predicates, such as Mercury (Somogyi et al., 1996) and Ciao (=-=Casas et al., 2006-=-). Mercury allows the user to program search strategies by using the underlying DFS, much like any CLP language. Ciao offers two alternative search strategies, BFS and iterative deepening, in terms of... |

19 | P.: Typed logical variables in Haskell - Claessen, Ljunglöf - 2000 |

19 | Polytypism and Polytypic Unification - Jansson - 1995 |

18 | On a tighter integration of functional and logic programming
- Braßel, Huch
- 2007
(Show Context)
Citation Context ...es; it has a fixed search strategy. However, the KiCS Curry system, implemented in Haskell, does not offer any constraint solvers; yet, it does provide reflective access to the program’s search tree (=-=Brassel & Huch, 2007-=-), allowing programmed or encapsulated search. As far as we can tell, their implementation technique prevents this programmed search from being combined with constraint solving. Embedding logic progra... |

17 | Embedding Prolog in Haskell
- Spivey, Seres
- 1999
(Show Context)
Citation Context ... backtracking. Most notable is the list-based backtracking monad – which Wadler pioneered before the introduction of monads (Wadler, 1985) – upon which various improvements have been made, e.g., BFS (=-=Seres & Spivey, 1999-=-), Prolog’s pruning operator cut (Hinze, 2001), and fair interleaving (Kiselyov et al., 2005). The Alma-0 (Apt et al., 1998) has a similar objective in an imperative setting: it adds Prolog-like DFS a... |

13 | Prolog’s control constructs in a functional setting - Axioms and implementation
- Hinze
- 1992
(Show Context)
Citation Context ...king monad – which Wadler pioneered before the introduction of monads (Wadler, 1985) – upon which various improvements have been made, e.g., BFS (Seres & Spivey, 1999), Prolog’s pruning operator cut (=-=Hinze, 2001-=-), and fair interleaving (Kiselyov et al., 2005). The Alma-0 (Apt et al., 1998) has a similar objective in an imperative setting: it adds Prolog-like DFS and pruning features to Modula-2. FaciLe is a ... |

13 | Application de la programmation par contraintes à des problèmes de gestion du trafic aérien - Barnier - 2002 |

11 |
Backtracking, interleaving, and terminating monad transformers (functional pearl
- Kiselyov, Shan, et al.
- 2005
(Show Context)
Citation Context ...efore the introduction of monads (Wadler, 1985) – upon which various improvements have been made, e.g., BFS (Seres & Spivey, 1999), Prolog’s pruning operator cut (Hinze, 2001), and fair interleaving (=-=Kiselyov et al., 2005-=-). The Alma-0 (Apt et al., 1998) has a similar objective in an imperative setting: it adds Prolog-like DFS and pruning features to Modula-2. FaciLe is a FD constraint library for OCaml, developed as p... |

11 |
Gecode: Generic Constraint Development Environment,” http://www.gecode.org
- Schulte, Lagerkvist, et al.
(Show Context)
Citation Context ...andling rules (Frühwirth, 1998) with the framework to provide the combination of programmable search and programmable solving. • Make state-of-the-art constraint solver implementations, e.g., Gecode (=-=Schulte et al., 2009-=-), available, by binding them to Haskell using the C foreign function interface and have them implement the Solver type class. • Investigate the connection between our composable search transformers a... |

11 | Nondeterministic Control For Hybrid Search - Hentenryck, Michel - 2005 |

5 | Constraint logic programming. Pages 111–119 of - Jaffar, Lassez - 1987 |

4 | High-level nondeterministic abstractions in
- Michel, See, et al.
- 2006
(Show Context)
Citation Context ...he traversal. The Comet approach does not support a notion of composable search transformers. Interestingly the Comet approach to search can also be implemented in C++ using macros and continuations (=-=Michel et al., 2006-=-). Functional (constraint) logic programming. Several programming languages have been devoted to the integration of functional programming and (constraint) logic programming. On the one hand, we have ... |

4 | Typed logical variables - Claessen, Ljunglöf - 2000 |

3 | A program to solve Sudoku - Bird - 2006 |

2 | Constrained Monadic Computations. http://www-ps.informatik. uni-kiel.de/~sebf/projects/constraint-monad.html - Fischer - 2008 |

2 | Septembr). Embedding Prolog into Haskell. Haskell workshop’99 - Seres, Spivey - 1999 |

2 | Sicstus prolog. http://www.sics.se/isl/sicstuswww/site/index.html - SICStus - 2008 |

2 | On a tighter integration of Functional and - Brassel, Huch - 2007 |

2 | Programming constraint inference engines. Pages 519–533 of: Principles and practice of constraint programming - cp97, proceedings - Schulte - 1997 |

2 | The Oz programming model. Pages 324–343 of: Computer science today - Smolka - 1995 |

1 | Type checking with open type functions. Pages 51–62 of: Proceeding of the 13th acm sigplan international conference on functional programming - Schrijvers, Jones, et al. - 2008 |

1 | Available at: http://www.recherche.enac.fr/opti/papers/ thesis/ Last accessed 3 - Toulouse - 2009 |

1 |
Eclipse [online]. Available at: http://www.eclipse-clp.org/ Last accessed 3
- ECLiPSe
- 2008
(Show Context)
Citation Context ...he original CLP(X) framework (Jaffar & Lassez, 1987) already abstracted the constraint language and solver from the rest of the language. Constraint logic programming (CLP) languages such as ECLiPSe (=-=ECLiPSe, 2008-=-) provided search abstractions that allowed features of search such as variable and value selection to be defined by users code. The Oz (Smolka, 1995) language separated the definition of the search t... |

1 | Constrained monadic computations [online]. Available at: http://www-ps - Fischer - 2008 |

1 |
Haskell FD library [online]. Available at: http://overtond.blogspot
- Overton
- 2008
(Show Context)
Citation Context ... another variable and an integer. Formally, the semantics can be expressed as [[FDIn t (l,u)]] =[[t]] ∈{l,...,u} [[FDEQ t d]] =[[t]] = d [[FDNE s t i]] =[[s]] ̸= [[t]] + i We use Overton’s FD solver (=-=Overton, 2008-=-) for the concrete implementation. The above is sufficient to express our n-queens model. However, it is a rather primitive way of writing a model, directly against the constraint solver interface. In... |

1 | 519–533. constraint programming 697 - Springer - 1999 |

1 |
Sicstus Prolog [online]. Available at: http://www.sics.se/isl/sicstuswww/ site/index.html Last accessed 3
- SICStus
- 2008
(Show Context)
Citation Context ...vior. 9 Related work Since our approach combines constraint and functional programming there is a broad spectrum of related work. CP. CLP languages such as ECLiPSe (ECLiPSe, 2008) and SICStus Prolog (=-=SICStus, 2008-=-) allow programmable search using the built-in search of the paradigm. Each system provides predicates to define search, analogous to the Dynamic nodes in the model tree. ECLiPSe provides a search lib... |

1 | The OPL Optimization Programming Language. Cambridge,MA - Hentenryck - 1999 |