In a previous post I mentioned wanting to go in the direction of algorithmic composition using rules of harmony and counterpoint, and never got very far beyond transcribing a few constraints in R. O. Morris's book into a formal notation. Now today on a mailing list I saw mention of Strasheela - a highly generic constraint-based computer aided music composition system:

For centuries, compositional rules were an established device for expressing compositional knowledge (for example in music education). Many musicians thus feel comfortable with a computational model based on the notion of rules. For example, rule-based approaches attracted much attention among composers, because by defining rules composers can formalise virtually any explicitly available compositional knowledge as a task which the computer can solve automatically.
Constraint programming allows to model complex problems a simple way. A problem is stated by a set of variables (unknowns) and constraints (relations) between these variables. For example, a compositional task is stated by (i) a music representation in which some musical aspects are unknown - and therefore represented by variables - and (ii) compositional rules which impose constraints on these variables For instance, a chord can be expressed by an event list and the chord pitches can be variables. Some harmonic rules may specify how the chord pitches are related to each other. In the terminology of constraint programming, the modelled problem or task is referred to as a constraint satisfaction problem (CSP).

So maybe I'll see if I can use Strasheela as an engine for my latent project, because I doubt I could write my own constraint solution system without a lot of research and effort.