$ontext 32 golfers want to play in 8 groups of 4 each week, in such a way that any two golfers play in the same group at most once. References: - problem 10 in CSPLIB (www.csplib.org) - Barbara Smith, "Reducing Symmetry in a Combinatorial Design Problem", Tech. Report, School of Computing and Mathematics, University of Huddersfield, 2001. $offtext set t 'weeks' /week1*week10/ i 'golfers' /golfer1*golfer32/ g 'group' /group1*group8/ ; alias(i,j); binary variables x(i,g,t) 'schedule'; positive variable meet(i,j,g,t) 'golfer i and j meet'; free variables dummy 'objective'; equations game(i,t) 'each golver plays one game per week' fourplayer(g,t) 'four players per game' multiply1(i,j,g,t) 'linearization of multiplication (not used)' multiply2(i,j,g,t) 'linearization of multiplication (not used)' multiply3(i,j,g,t) 'linearization of multiplication' meetcount(i,j) edummy ; set ij(i,j); ij(i,j)$(ord(i)>ord(j)) = yes; * * golfer plays one game per week * game(i,t).. sum(g, x(i,g,t)) =e= 1; * * four players per game * fourplayer(g,t).. sum(i, x(i,g,t)) =e= 4; * * linearization of x(i,g,t)*x(j,g,t) * Note: we can relax the first two equations multiply1, multiply2 * multiply1(ij(i,j),g,t).. meet(ij,g,t) =l= x(i,g,t); multiply2(ij(i,j),g,t).. meet(ij,g,t) =l= x(j,g,t); multiply3(ij(i,j),g,t).. meet(ij,g,t) =g= x(i,g,t)+x(j,g,t)-1; meet.lo(ij,g,t) = 0; meet.up(ij,g,t) = 1; * * players i and j can meet only once * *meetcount(ij(i,j)).. sum((g,t), meet(ij,g,t)) =l= 1; meetcount(ij(i,j)).. sum((g,t), x(i,g,t)*x(j,g,t)) =l= 1; edummy.. dummy =e= 0; * * fix first round * set first(i,g) / (golfer1*golfer4).group1 (golfer5*golfer8).group2 (golfer9*golfer12).group3 (golfer13*golfer16).group4 (golfer17*golfer20).group5 (golfer21*golfer24).group6 (golfer25*golfer28).group7 (golfer29*golfer32).group8 /; x.fx(first,'week1') = 1; * * let golfer i always be in group i for i=1,2,3,4, t>t0 * * set t1(t); t1(t)$(ord(t)>1)=yes; x.fx('golfer1','group1',t1) = 1; x.fx('golfer2','group2',t1) = 1; x.fx('golfer3','group3',t1) = 1; x.fx('golfer4','group4',t1) = 1; model m /game,fourplayer,meetcount,edummy/; m.optfile=1; m.reslim=10000; m.iterlim=10000000; m.reslim=100000; option miqcp=cplex; solve m minimizing dummy using miqcp; $onecho > cplex.opt miqcpstrat 2 mipemphasis 4 threads 4 $offecho