Prev: How to format Superscript and Subscript for a symbol to the same vertical level??
Next: FromAdjacencyMatrix / FromAdjacencyLists - broken?
From: cmpbrn on 24 Oct 2009 02:44 Given 10 (1 to 10) chess-players, in one day they play 5 games (1-2, 6-10, 5-7, 4-8, 3-9). Then they need 8 more days to complete the championship (one gamer must play one time against any other player): 1-3, 2-10, 6-7, 5-8, 4-9 1-4, 2-3, 7-10, 6-8, 5-9 1-5, 2-4, 3-10, 7-8, 6-9 1-6, 2-5, 3-4, 7-9, 8-10 1-7, 2-6, 3-5, 4-10, 8-9 1-8, 2-7, 3-6, 4-5, 9-10 1-9, 2-8, 3-7, 4-6, 5-10 1-10, 2-9, 3-8, 4-7, 5-6 How can I get the 10*(10-1)/2 = 45 pairs distributed in the 9x5 matrix? What's about any other even number of players? Bruno
From: ADL on 25 Oct 2009 01:10 This is what I would do: nPlayers = 10; pairs = DeleteCases[ Flatten[Table[ If[i < j, {i, j}, Null], {i, nPlayers}, {j, nPlayers}], 1], Null ]; fact = MapThread[ Power, Transpose(a)FactorInteger[Length[pairs]] ]; Partition[pairs, Max(a)Nearest[fact, 5]] This fills a rectangular table in which the number of matches per day is chosen closest to 5 as a function of the total number of pairs. As far as I see, it works for any integer. ADL On Oct 24, 8:44 am, cmp...(a)gmail.com wrote: > Given 10 (1 to 10) chess-players, in one day they play 5 games (1-2, > 6-10, 5-7, 4-8, 3-9). > Then they need 8 more days to complete the championship (one gamer > must play one time against any other player): > 1-3, 2-10, 6-7, 5-8, 4-9 > 1-4, 2-3, 7-10, 6-8, 5-9 > 1-5, 2-4, 3-10, 7-8, 6-9 > 1-6, 2-5, 3-4, 7-9, 8-10 > 1-7, 2-6, 3-5, 4-10, 8-9 > 1-8, 2-7, 3-6, 4-5, 9-10 > 1-9, 2-8, 3-7, 4-6, 5-10 > 1-10, 2-9, 3-8, 4-7, 5-6 > > How can I get the 10*(10-1)/2 = 45 pairs distributed in the 9x5 > matrix? > What's about any other even number of players? > > Bruno
From: Nasser M. Abbasi on 25 Oct 2009 01:12 <cmpbrn(a)gmail.com> wrote in message news:hbu7nh$7g2$1(a)smc.vnet.net... > Given 10 (1 to 10) chess-players, in one day they play 5 games (1-2, > 6-10, 5-7, 4-8, 3-9). > Then they need 8 more days to complete the championship (one gamer > must play one time against any other player): > 1-3, 2-10, 6-7, 5-8, 4-9 > 1-4, 2-3, 7-10, 6-8, 5-9 > 1-5, 2-4, 3-10, 7-8, 6-9 > 1-6, 2-5, 3-4, 7-9, 8-10 > 1-7, 2-6, 3-5, 4-10, 8-9 > 1-8, 2-7, 3-6, 4-5, 9-10 > 1-9, 2-8, 3-7, 4-6, 5-10 > 1-10, 2-9, 3-8, 4-7, 5-6 > > How can I get the 10*(10-1)/2 = 45 pairs distributed in the 9x5 > matrix? > What's about any other even number of players? > > Bruno > There is already websites to do round robin scheduling. You select the number of players, and it generates the pairings for you. Here is one for example http://www.devenezia.com/downloads/round-robin/index.html Implementing the algorithm in Mathematica should not be hard. There are algorithms and source code in other languages shown on the web site for this as well (unless someone already did this in Mathematica). --Nasser
From: danl on 26 Oct 2009 00:26 > > <cmpbrn(a)gmail.com> wrote in message news:hbu7nh$7g2$1(a)smc.vnet.net... >> Given 10 (1 to 10) chess-players, in one day they play 5 games (1-2, >> 6-10, 5-7, 4-8, 3-9). >> Then they need 8 more days to complete the championship (one gamer >> must play one time against any other player): >> 1-3, 2-10, 6-7, 5-8, 4-9 >> 1-4, 2-3, 7-10, 6-8, 5-9 >> 1-5, 2-4, 3-10, 7-8, 6-9 >> 1-6, 2-5, 3-4, 7-9, 8-10 >> 1-7, 2-6, 3-5, 4-10, 8-9 >> 1-8, 2-7, 3-6, 4-5, 9-10 >> 1-9, 2-8, 3-7, 4-6, 5-10 >> 1-10, 2-9, 3-8, 4-7, 5-6 >> >> How can I get the 10*(10-1)/2 = 45 pairs distributed in the 9x5 >> matrix? >> What's about any other even number of players? >> >> Bruno >> > > There is already websites to do round robin scheduling. You select the > number of players, and it generates the pairings for you. Here is one for > example > > http://www.devenezia.com/downloads/round-robin/index.html > > Implementing the algorithm in Mathematica should not be hard. There are > algorithms and source code in other languages shown on the web site for > this > as well (unless someone already did this in Mathematica). > > --Nasser Here are some possibly relevant links. http://demonstrations.wolfram.com/Tournaments/ http://demonstrations.wolfram.com/SocialGolferProblem/ http://mathworld.wolfram.com/Tournament.html http://mathworld.wolfram.com/TournamentMatrix.html Daniel Lichtblau Wolfram Research
From: John Fultz on 26 Oct 2009 00:30
On Sat, 24 Oct 2009 02:38:47 -0400 (EDT), cmpbrn(a)gmail.com wrote: > Given 10 (1 to 10) chess-players, in one day they play 5 games (1-2, > 6-10, 5-7, 4-8, 3-9). > Then they need 8 more days to complete the championship (one gamer > must play one time against any other player): > 1-3, 2-10, 6-7, 5-8, 4-9 > 1-4, 2-3, 7-10, 6-8, 5-9 > 1-5, 2-4, 3-10, 7-8, 6-9 > 1-6, 2-5, 3-4, 7-9, 8-10 > 1-7, 2-6, 3-5, 4-10, 8-9 > 1-8, 2-7, 3-6, 4-5, 9-10 > 1-9, 2-8, 3-7, 4-6, 5-10 > 1-10, 2-9, 3-8, 4-7, 5-6 > > How can I get the 10*(10-1)/2 = 45 pairs distributed in the 9x5 > matrix? > What's about any other even number of players? > > Bruno I've done quite the same thing for Scrabble competitions. Here's an= algorithm for round robin pairing for any number of players: http://en.wikipedia.org/wiki/Round-robin_tournament#Scheduling_algorithm And here's a simple function which implements the algorithm for a complete= round robin. For an odd number of players, just invent a "bye" player (bye's= opponent gets that round off) and pair as for even players. Pair[n_Integer?EvenQ] := Table[ Prepend[RotateRight[Range[n - 1] + 1, round - 1], 1][[{couple, -couple}]], {round, n - 1}, {couple, n/2}] An example output: In[28]:= Pair[8] // Grid Out[28]= {1,8}=09{2,7}=09{3,6}=09{4,5} {1,7}=09{8,6}=09{2,5}=09{3,4} {1,6}=09{7,5}=09{8,4}=09{2,3} {1,5}=09{6,4}=09{7,3}=09{8,2} {1,4}=09{5,3}=09{6,2}=09{7,8} {1,3}=09{4,2}=09{5,8}=09{6,7} {1,2}=09{3,8}=09{4,7}=09{5,6} Sincerely, John Fultz jfultz(a)wolfram.com User Interface Group Wolfram Research, Inc. |