|
From: | Andreas F |
Subject: | [Help-glpk] Fair soccer team split problem |
Date: | Fri, 13 Apr 2012 13:05:03 +0000 |
Hi list
For a team of 17 kids I am assigned to split the group into 2 teams for each match. Lets say there are 20 matches in a season. The objective is to divide the group such that each kid spend equally many matches together with any other kid (i.e. no two kids play most games on same team, while two almost never play on same team). Using perl I have quickly created a script to randomly create teams. I would like it to be *fair*, but this approach isn't fair with only 20 matches (i.e. solutions). $ perl -wl my @p = (1 .. 17); my $origsize = scalar(@p); while (scalar(@p) > 0.5 * $origsize) { # Randomly remove a single element push @team1, splice(@p, rand @p, 1); } print join(q{,}, sort { $a <=> $b } @team1); print join(q{,}, sort { $a <=> $b } @p); __END__ 1,2,7,8,11,12,13,14,17 3,4,5,6,9,10,15,16 Is it feasible to use glpk to model this? -- Best regards, Andreas |
[Prev in Thread] | Current Thread | [Next in Thread] |