1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 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, BforAll t1,t2 : Team , t2 > t1 . | toSet (sched(_,_,{t1,t2}))| = 1 |