# Computer platforms for combinatorial search problems/mathematical music theory?

I'm finding programming various combinatorial searches (connected to mathematical music theory) in a general purpose computer language tedious, so I'd like pointers to computer platforms/environment purpose-built to enable such searches. If the answer has the form "Maple can do that" or "Mathematica can do that," then I'd appreciate pointers specific enough to get me started.

Within reason I would trade ease of specification against any optimization of the search algorithm, but I'd feel grateful for speed if I could have that too.

Here's an example of a typical question; I'm really hoping for an environment where I can specify such a search almost as succinctly as I now explain it (I use terminology from mathematical music theory but define everything in purely mathematical terms):

Write $T$ for the set of complex $12$th roots of unity.

Tetrachord means a subset of $T$ of cardinality $4$. Row means a permutation of T.

Fix two distinct rotation classes of tetrachords, $a$ and $b$. By definition row $R\in G_{a,b}$ if applying $R$ to the 24 tetrachords in $a \cup b$ yields 24 tetrachords pairwise distinct up to isometry.
Find $\bigcup_{a,b} G_{a,b}$.

Thanks in advance for any help!!

-
Not sure if this can help or not, but my friends who like to compose music via mathematical pattern and computer algorithm are crazy for the programming language Supercollider. I guess it has a lot of features which both programmers and composers can get behind. Maybe it can also do something that would help you –  David White Sep 13 '11 at 3:45
I think I understand what you are trying to do; the tricky part seems to be checking whether the 24 permuted tetrachords are distinct from the originals. I recall I once had a similar problem that involved checking that two sets had empty intersection; although it turned out to be possible, it was extremely difficult to program this constraint in Maple. So although Maple should be able to handle this particular problem, I would not recommend using it (unless someone else knows a easy way of doing it). –  ARupinski Sep 13 '11 at 3:59
@ARupinski I don't need distinct from a and b, just isometrically distinct from one another. –  David Feldman Sep 13 '11 at 4:09
@David: Either way, programming checks for distinctness ends up very roundabout in Maple (as I recall solving my problem involved finding a way to convert the sets to some other data structure such as strings and then using some weird functions on strings to compare them. At any rate, it was a very difficult workaround that probably could have been avoided with a language better suited to comparing sets). –  ARupinski Sep 13 '11 at 4:59
I don't know what you mean, since Maple can test for equality and disjointedness of sets easily, just use "set1 = set2" for equality and "set1 intersect set2={}" for disjointedness. –  Brendan McKay Sep 13 '11 at 7:00

## 2 Answers

A possible solution could be Strasheela, a library of music-related stuff built upon the Mozart programming system which is an interactive environment for the Oz programming language, a multi-paradigm programming language that supports constraint programming. The website states many uses, from Fuxian counterpoint to harmonic analysis but also realtime generation of rhythmic patterns. And due to the integration of many output formats (Lilypond for typeset music, MIDI for ugly beeps, Csound for less ugly beeps, Fomus for other compositional tools, ...) it will be easy to actually use your results.

The problem you describe sounds like it's doable in Strasheela (based on my own tiny bit of experience in it). It will also be able to find all solutions if you ask it to do so, but it might take some time (or be untractable) depending on the problem and the size of the solution space.

The idea of the language is different from your combinatorial approach, but it has great support of music theory and finding stuff, so you can use the terms for music theory without translating everything to a more mathematically oriented lingo. You'll have to phrase your actual problem in another way though: less combinatorial and more artificial intelligence-ish.

-

A student of mine wrote a progam alg which enumerates models of first-order theories (although it works best for equational theories). Specification is easy, but the program can't beat specialized enumeration techniques. If you can write down your problem without referring to actual complex numbers, it just might do it.

-