Implementation of the Relation Domain for Constraint Programming
Constraint programming (CP) has been used for several decades in music composition and analysis. It has served as the underlying technology of different tools that allow composers to compute with musical abstractions (e.g., notes, scores). However, the traditional domains used in musical CP, namely finite domains (integers) and finite sets (integer sets), are not well suited to represent and express properties on structured information such as a score in a compact and efficient way. This paper introduces a new domain for musical CP, namely relations, where a relation is a set of integer n-tuples. It proposes new constraints on relations and shows how to use them for musical composition. A single relation variable can represent a score of any size and any transformation between scores. The result is a system that directly supports computing with musical abstractions at a high abstraction level more pleasant to composers. The relation domain and its constraints are implemented using Binary Decision Diagrams and are provided as a library in the Gecode platform.