Evenly duplicate games to reach a maximum amount per participant

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 05:44:33

First of all, you didn't strictly define what is an "evenly distributed" match up. So I will suggest this means that every pair of teams play either 1 or 2 games. With this restriction I have a solution for your original case and some thoughts on the general case.

Original Case

8 teams, each must play 10 games, team 1 should not play with team 5. Here is the match up matrix:

    1  2  3  4  5  6  7  8
    ----------------------
1 | 0  2  2  1  0  1  2  2
2 | 2  0  1  2  1  2  1  1
3 | 2  1  0  2  2  1  1  1
4 | 1  2  2  0  2  1  1  1
5 | 0  1  2  2  0  2  2  1
6 | 1  2  1  1  2  0  1  2
7 | 2  1  1  1  2  1  0  2
8 | 2  1  1  1  1  2  2  0

And the same matrix with cells colored according to value:

This matrix is symmetric, each row (and each column) sums up to 10, which means total number of games for each team is 10 as required. All values are 1 or 2, except for zeroes on main diagonal (teams do not play with themselves) and on (1, 5) and (5, 1) cells (team 1 and 5 do not play with each other).

General case

I will explain how I constructed the matrix for the original case in a number of steps. These steps may be generalized for several different conditions. But not for all. I do not suggest a solution for the most general case.

  1. Start with the matrix where all teams that can play, do play exactly one game. Sum of rows of this matrix is [6 7 7 7 6 7 7 7], where 6 stands in positions 1 and 5.
  2. Try to make sum of each row the same. For this, add games between teams 1 and 8, 1 and 7, 5 and 4, 5 and 3, 2 and 6. Sum is now [8 8 8 8 8 8 8 8]. Nice.
  3. Try to add two games per team where pairs from the previous item are forbidden. At this step, do it only for the first four teams. Add games between teams 1 and 2, 2 and 4, 4 and 3, 3 and 1. Sum is now [10 10 10 10 8 8 8 8].
  4. Repeat previous pattern for the last four teams. Sum is now [10 10 10 10 10 10 10 10]. Each pair of teams (which are allowed to play) plays 1 or 2 games. We're done.

Another idea, that may be helpful. In an evenly distributed match up, number of games between allowed pairs may differ not more than by 1. We may think of it as this: all pairs play N games, and several pairs play N+1 games. I started with all pairs playing 1 game in my solution. And it gives initial sums, which must be corrected by selecting these several pairs playing one additional game. So the general problem might be reformulated as follows: how to place several ones into allowed places of a zero symmetrical matrix so that sum of rows will become equal to a given vector?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!