Multi-sport tournament organization with 7 teams

Paul -  
mamiemando Posted messages 33537 Registration date   Status Modérateur Last intervention   -

Hello,

I would like to organize a multi-sport tournament or Olympic games with 7 teams and 6 different sports (Sandball, Tchoukball, Pétanque, Relay, Paintball, Chamboule-tout). I can also make 8 teams if that is simpler, but the ideal would be 7. The idea is for each team to face all the other teams and participate at least once in every sport.

This should represent 6 rounds (3 fields), and there will be one team on break each time. However, I can't figure out how to ensure that each team plays in every sport while facing at least once the others... It crosses quite a bit of data and I admit I'm stuck every time. Is there any software or formula in Excel that could help with this?

If you could help me, that would be great, because I'm completely lost here.

Thank you in advance and have a good evening. :P

6 réponses

PierrotLeFou
 

You say that each team must play at least once against each of the others? Let's make a little diagram with a diagonal matrix:
The first row and the first column are for numbering the teams.
\ 1 2 3 4 5 6 7
1 *
2 1 *
3 1 2 *
4 1 2 3 *
5 1 2 3 4 *
6 1 2 3 4 5 *
7 1 2 3 4 5 6 *
The asterisk is to show that a team does not play against itself.
We see that there will be 21 games in total. We have 3 fields. So each field will be used 7 times.
And we repeat for each of the 6 sports.
Does that meet your criteria?
We place on each field two teams that are not on another field (at first all fields are free).
And we erase each of the 3 boxes after the games.
We start again as long as there are boxes in the matrix.

0
yg_be Posted messages 23437 Registration date   Status Contributeur Last intervention   Ambassadeur 1 587
 

hello,

You need more than 6 rounds to achieve this. In 6 rounds, each team won't even have played 6 times, so they won't have faced every other team. Nor have played each sport.

0
mamiemando Posted messages 33537 Registration date   Status Modérateur Last intervention   7 927
 

Hello,

Is the goal to find out which matches should be played at each time slot? The problem, of course, has many symmetries since with a renumbering of the teams, one can find another match schedule.

The problem obviously has a solution (in the worst case, we can have only one match played at each time slot from those listed by Pierrot, which means 21 time slots).

If we omit the constraint of the fields, to solve the problem in fewer time slots, I think a greedy algorithm that keeps track of already played matches is sufficient. I assume each match lasts one time slot.

  • Played matches = {}
  • t = 0
  • While |Played matches| != 21
    • Reset available teams = {1, ..., 7}
    • For i = 0 ... 6
      • If i is not available
        • Continue
      • Find an available team j such that neither (i, j) nor (j, i) is in Played matches
      • If j exists:
        • Add (i, j) -and/or (j, i)- to Played matches: the match (i, j) is played at time t
        • Remove i and j from available teams
      • i ++
    • t ++

Once you have decided on the matches, I think you can address the issue of the games associated with each match at a later time.

In any case, it is likely that for this instance a greedy algorithm of the same kind would be sufficient. At worst, your problem can be solved with an ILP (Integer Linear Program) or a CSP (Constraint Satisfaction Program), but this assumes you have some knowledge in operational research (the branch of mathematics that deals with optimization problems).

Good luck

0
yg_be Posted messages 23437 Registration date   Status Contributeur Last intervention   1 587
 

This solution overlooks the complexity of the problem posed: "each team participates at least once in each sport."

Clearly, this requires more than 21 matches. Each sport must be played a minimum of 4 times, so at least 24 matches are required.

Moreover, the solution introduces a constraint that was not in the statement: nothing forbids two teams from playing together multiple times. Fortunately, otherwise there would be no solution.

0
mamiemando Posted messages 33537 Registration date   Status Modérateur Last intervention   7 927 > yg_be Posted messages 23437 Registration date   Status Contributeur Last intervention  
 

Indeed, 21 time slots will not be enough because, since we have an odd number of teams, one team will have to replay a sport to face the 7th team, which indeed results in 4 matches per sport, and since there are 6 sports, that makes 24 matches. That said, I think we can still start from the solution of the greedy algorithm to add a few extra matches so that each "7th" can play their sport. Since there are 6 sports and 3 fields, that means 2 additional time slots.

0
PierrotLeFou
 

We all agree that it takes more than 6 "rounds" to play all the matches for the 6 sports in question.
This can be seen as a combinatorial analysis problem.
A team cannot play against itself. Team A cannot play against A.
Similarly, there is symmetry. If A plays against B, it is the same as saying that B plays against A.
Therefore, we need to calculate the number of combinations of 2 values among N (here N equals 7).
C(7, 2) is exactly 21 (7!/(5!2!))
We can list these pairs of numbers and ensure that there are no duplicate pairs (or their equivalents).
Depending on the language used, we could have a list of tuples or a 2D array thus providing the pairs.
Here, we are lucky, 21 is exactly divisible by 3. We can go through the list and assign the teams in groups of 3 pairs.
This will make exactly 7 rounds of 3 matches or courts. And we start again for each sport. So in total, 21*6 = 126 matches or 42 complete rounds.
Suppose the number of teams is 8 instead of 7.
The number of combinations will then be C(8, 2) = (8!/(6!2!)) = 28, which does not divide by 3.
We can proceed as with the other list by assigning a pair to each court in groups of 3 pairs.
This will create 27 pairs grouped by 3, hence 9 rounds.
And what do we do with the 28th pair?
We place it on the first court and go back to the beginning of the list but move on to the next sport.
We will virtually have a list of 28*6 (168) pair-matches, so 168/3 = 56 complete rounds.
If the number of sports were 7 instead of 6, we would have a total of 28*7 = 196 pair-matches.
In this case, we would have 65 complete rounds with 3 courts and one round with a single court.

0
yg_be Posted messages 23437 Registration date   Status Contributeur Last intervention   1 587
 

Attention, the statement indicates that each team must participate at least once in each sport.

This does not imply that each pair of teams must play in all sports.

0
mamiemando Posted messages 33537 Registration date   Status Modérateur Last intervention   7 927
 

Hello,

I propose this ILP formulation which I hope is complete and correct. We define T_max a priori (for example 24) and check if the solver finds a solution; if not, we increase T_max.

Notations: (I give the domains of definition here; to lighten the notations, I will not repeat them in the sums or the quantifiers of the constraints since they are implicitly always the same):

  • i, j: the indices of the teams in {1...7}
  • k: the indices of the sports with values in {1...6}
  • t: the indices of time with values in {1...T_max}

Decision variables (for each value of i, j, k, t):

  • Xijt: teams i and j meet at time t to play sport k, with values in {0, 1}
  • Yikt: team i plays sport k at time t, with values in {0, 1}

Objective function:

  • min sum_t sum_i sum(i <j) Xijt // Minimize the number of matches (we want to avoid pairs of teams (i, j) meeting multiple times "for fun")

Constraints (linear):

  • Xiit = 0 // Team i cannot meet itself
  • For all i, for all j != i, for all t: Xijt = Xjit // If i meets j at time t, then team j meets i at time t as well
  • For all i, sum_k Yikt <= 1 // Each team i plays at most one sport at time t
  • For all i, for all j != i, for all k: Yikt + Yijt >= 2 * Xijt // If i and j meet at time t, then they both practice sport k
  • For all t: sum_i sum_(i<j) Xijt <= 3 // At most 3 matches at each time t
  • For all i, for all t: sum_k Yikt <= 1 // Each team i plays at most 1 sport at each instant t
  • For all i: sum_t sum_k Yikt >= 6 // Each team i plays all 6 sports

Implementation

From a practical point of view, there are many ILP solvers. In Python, for example, scipy provides a function to solve a MILP (thus an ILP), namely scipy.optimize.milp.

There are many other solvers, not just in Python. Among the most well-known, we can notably mention Ilog Cplex (paid), Coin-OR (free equivalent of Cplex) usable in C++ and Java.

Remarks

We can probably make some linear relaxations (for example, saying that the Xijt and/or the Yikt are in [0, 1] instead of {0, 1}) in order to reduce the number of integer variables (which become effectively continuous) and thus significantly speed up the resolution. We hope that by making such a relaxation, we still find an integer solution (if that is not the case, we revert them to the discrete domain). It's worth looking at scipy.optimize.linprog.

Good luck

0
yg_be Posted messages 23437 Registration date   Status Contributeur Last intervention   1 587
 

I think there are constraints that are not strictly necessary, and I suppose this does not harm the solution.

However, are the two most important constraints not missing?

  • that each team must meet every other team?
  • that each team must play every sport?
  • for all i, sum_k min(1, sum_t Yikt) = 6
  • for all i, sum_j min(1, sum_t Xijt) = 6
0
yg_be Posted messages 23437 Registration date   Status Contributeur Last intervention   1 587
 

24 was the minimum number of meetings, not a time slot, right?

0
mamiemando Posted messages 33537 Registration date   Status Modérateur Last intervention   7 927 > yg_be Posted messages 23437 Registration date   Status Contributeur Last intervention  
 
  • #10 : Yes, you're right, but anyway we initially choose the value of T (24 is indeed the number of matches and is therefore clearly excessive) and then we solve the problem (then we repeat it by gradually reducing T). Apparently according to #11, T=8 is a choice that allows for a solution. If the optimization problem is correct, we can see if we find something with smaller values of T.
  • #9 : Indeed, some constraints are missing. The ones you propose are correct but are not yet linearized. To linearize them, we can introduce some dummy variables, normally taking values in {0, 1} -- but we can clearly relax this to [0, 1]. Unless I'm mistaken, we would then need to add the following elements to the previous formulation.
    • Variables and parameters:
      • Mij is the variable (dummy) indicating that team i has played at least once against team j during the tournament, taking values in {0, 1}
      • M = 7 is the number of teams
      • Nik is the variable (dummy) indicating that team i has played at least once in sport k during the tournament, taking values in {0, 1}
      • N = 6 is the number of sports
    • Linearized constraints:
      • For all i, for all j != i, Mij >= sum_t (Xijt) / T
      • For all i, sum_j Mij = M - 1 // The team to meet the M-1 opposing teams
      • For all i, for all k, Nik >= sum_t (Yikt) / T
      • For all i, sum_j Nij = N // The team to meet the M-1 opposing teams

Thanks again for your comments!

0
yg_be Posted messages 23437 Registration date   Status Contributeur Last intervention   1 587 > mamiemando Posted messages 33537 Registration date   Status Modérateur Last intervention  
 

Two missing constraints, I think:

  • For all i, for all j != i, Mij <= sum_t (Xijt)
  • For all i, for all k, Nik <= sum_t (Yikt)

I must admit that I was curious (skeptical) about the possibility of linearizing this. It's true that the use of inequalities offers many possibilities.

0
mamiemando Posted messages 33537 Registration date   Status Modérateur Last intervention   7 927 > yg_be Posted messages 23437 Registration date   Status Contributeur Last intervention  
 

Hello yg_be, these two inequalities are not useful because Mij and Nik take values in {0, 1}, so the constraints imposed by the domain of definition for these variables are already stronger than the two sets of constraints you mentioned. Thank you for your feedback anyway :-)

0
yg_be Posted messages 23437 Registration date   Status Contributeur Last intervention   Ambassadeur 1 587
 

Here is an example of how to organize this tournament into 24 matches, thus in 8 rounds:

 In round 0, teams 0 and 1 play in game 0. In round 0, teams 2 and 3 play in game 0. In round 0, teams 4 and 5 play in game 0. In round 1, teams 1 and 2 play in game 1. In round 1, teams 3 and 4 play in game 1. In round 1, teams 5 and 6 play in game 1. In round 2, teams 0 and 2 play in game 2. In round 2, teams 1 and 3 play in game 2. In round 2, teams 4 and 6 play in game 2. In round 3, teams 0 and 3 play in game 3. In round 3, teams 1 and 6 play in game 3. In round 3, teams 2 and 5 play in game 3. In round 4, teams 0 and 4 play in game 4. In round 4, teams 1 and 5 play in game 4. In round 4, teams 3 and 6 play in game 4. In round 5, teams 0 and 5 play in game 5. In round 5, teams 1 and 4 play in game 5. In round 5, teams 2 and 6 play in game 5. In round 6, teams 0 and 6 play in game 0. In round 6, teams 2 and 4 play in game 4. In round 6, teams 3 and 5 play in game 5. In round 7, teams 0 and 6 play in game 1. In round 7, teams 2 and 4 play in game 3. In round 7, teams 3 and 5 play in game 2.
0