Download
language Essence 1.3
$ prob026.essence: Round Robin Tournament Scheduling
$ Problem details available at http://www.csplib.org/Problems/prob026/

given n_teams : int(1..)

where n_teams % 2 = 0

letting Team   be new type of size n_teams,
        Week   be new type of size n_teams-1,
        Period be new type of size n_teams/2

find sched :
    relation (size ((n_teams-1)*n_teams)/2) of
        (Week * Period * set (size 2) of Team)

such that
    forAll t : Team . forAll w : Week . exists (p,ts) in toSet(sched(w,_,_)) . t in ts,
    forAll t : Team . forAll p : Period .
        (sum (w,ts) in toSet(sched(_,p,_)) . toInt(t in ts)) <= 2,
    forAll t1,t2 : Team , t1 != t2 . |toSet(sched(_,_,{t1,t2}))| = 1