Handbook of Constraint Programming: Foundations of Artificial Intelligence

Kim Marriott, Peter J. Stuckey, Mark Wallace
Constraint Logic Programming (CLP) is the merger of two declarative paradigms: constraint solving and logic programming. As both constraint solving and logic programs are based on mathematical relations the merger is natural and convenient. CLP encourages experimentation and fast algorithm development by narrowing the gap between the logic and the solving algorithms. This is because CLP can express both conceptual and design models and, even more importantly, CLP can also express mappings from conceptual to design models. By a conceptual model of a problem, we mean its precise formulation in logic, and by the design model of the problem we mean its algorithmic formulation, which maps to a sequence of steps for solving it. A single problem may have many different conceptual models, and many different design models.
The first important characteristic of constraint logic programs is that they allow succinct, natural conceptual modeling of satisfaction and optimization problems.
Example 12.1. For example, the cryptarithmetic problem
where each letter represents a different digit, is naturally conceptually modeled by the following CLP program: (we will use the concrete syntax of ECLiPSe [20] throughout this chapter)
smm(S,E,N,D,M,O,R,Y) : [S,E,N,D,M,O,R,Y] :: 0..9, 1000 * S + 100 * E + 10 * N + D ...