language Essence 1.3
$ prob010.essence: Social Golfer Problem
$ Problem details available at
$ In a golf club there are a number of golfers who wish to play together in g
$ groups of size s. Find a schedule of play for w weeks such that no pair of
$ golfers play together more than once.

given w, g, s : int(1..)

letting Golfers be new type of size g * s

find sched : set (size w) of
                $ regular is implied by numParts g and partSize s
                partition (regular, numParts g, partSize s) from Golfers

such that

forAll g1, g2 : Golfers, g1 < g2 .
    (sum week in sched . toInt(together({g1, g2}, week))) <= 1