Functional programming abstractions for CP modeling

Abstract

The field of Constraint Programming (CP) provides problem-independent technology for solving combinatorial problems. The programmer describes his problem in a model, which is processed by a problem-independent solver to produce a so- lution. Solver implementations are an active topic of research, and many efficient solvers exist. Specific languages were created that provide CP modeling facilities, but these domain-specific languages (DSL) run behind on features and abstractions, compared to modern general purpose languages. On the other hand, using CP libraries in such a language requires boilerplate code, and is often far less declarative in nature. Functional Programming (FP) is a programming paradigm that is based on the concept of functions as they are defined in mathematics, i.e., without side effects beyond their return value. Functional languages are declarative, offer very high level abstractions, and are easy to analyze. Furthermore, they can be used for general purposes. The existing Monadic Constraint Programming (MCP) framework offers interesting high-level abstractions for CP in the state-of-the-art functional programming language Haskell. In the first part of this thesis, we study how to build upon it to create a practical, concise, and declarative modeling DSL for constraint problems. Our language allows Finite Domain (FD) problems to be written using high-level expressions, while the underlying framework performs optimized translation to specific solver back-ends. Implemented back-ends include a proof-of-concept solver in Haskell, and bindings to the constraint solving library Gecode. For solving with low overhead, an extra mode is provided that generates C++ code for performing the solving at a later stage. In the second part, we provide declarative modeling of search. Controlling the search heuristic employed by a constraint solver is often essential for good performance, but existing systems are either limited in possibilities or imperative in nature. Again, we choose to provide a DSL to do better. The Search Combinators language is declarative, concise and captures many advanced search heuristics. We implement an efficient code generator for these search heuristics, avoiding the pitfalls encountered

    Similar works

    Full text

    thumbnail-image