1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | /************************** Posting in comp.constraints and sci.op-research describing this problem warwick @cs .mu.oz.au (Warwick HARVEY) wrote: >In sci.op-research, bigwind777 @aol .com (Bigwind777) writes: > >>Please help with this problem. > >>I have 32 golfers, individual play. > >>We will golf for 16 weeks. > >>I want to set up the foursomes so each person only golfs >>with the same person once. > >>How many weeks can we do this before it starts to duplicate ? >....... >It seems to be a generalisation of the problem of constructing a >round-robin tournament schedule, where the number players in a "game" is >more than two. > >Has anybody had any experience with this kind of problem? Any ideas on >good ways to model it? *************************/ :- lib(conjunto). % For a 9-week solution to the above problem, call golf(9, 8, X). golf(RoundNum,RoundSize,Rounds) :- % MODEL PART ( for (I,1,4*RoundSize), foreach (I,PlayerList) do true ), list2set(PlayerList,SetUB), ( count(_,1,RoundNum), foreach (GroupsInRound,Rounds), param(SetUB), param(RoundSize) do ( foreach (S,GroupsInRound), count(_,1,RoundSize), param(SetUB) do S `:: {} .. SetUB, #(S,4) ), % all_union(GroupsInRound,SetUB), all_disjoint(GroupsInRound) ), ( fromto(Rounds,[R|Rest0],Rest0,[]) do flatten(Rest0,Rest), ( foreach (Group,R), param(Rest) do ( param(Group), foreach (Group1,Rest) do ISize :: 0..1, #(Group /\ Group1,ISize) ) ) ), % SEARCH PART ( for (Player,1,4*RoundSize), param(Rounds) do writeln(player = (Player)), ( foreach (R,Rounds), count(Round,1,_), param(Player) do writeln(Round), member(Group,R), Player in Group ) ), % PRINT OUT SOLUTION ( foreach (R,Rounds) do writeln(R) ). |