In [1] a question is posed how to design a schedule for a sequence games:
To find a feasible schedule we use the following sets: \[\begin{align} & t \in \{A,\dots,I\} && \text{9 teams} \\ & r \in \{\mathit{round}_1,\dots,\mathit{round}_4\} && \text{4 rounds}\\ & m \in \{\mathit{match}_1,\dots,\mathit{match}_3\} && \text{3 matches per round} \end{align}\] We introduce binary variables \[x_{r,m,t} = \begin{cases} 1 & \text{if team $t$ plays in match $m$ in round $r$} \\ 0 & \text{otherwise}\end{cases}\]
A high-level model can look like:
Because of symmetry in the last equation, we only need to check teams \(t\lt t'\). This saves us a few quadratic constraints.
This model can be solved with a constraint solver or a global (non-convex) MIQCP (Mixed Integer Quadratically Constrained Programming) solver. Of course with a MIQCP solver we need to add a dummy objective (we are only interested in feasibility here). Global solvers likes Baron, Couenne or Antigone can solve this easily. The results can look like:
We can check that:
It is noted that there are many feasible solutions.
If we want to solve with a convex MIQCP solver (like Cplex or Gurobi) we can replace the quadratic constraint by: \[\sum_{r,m} x_{r,m,t} x_{r,m,t'} \le 1 \>\>\forall t\lt t'\]
Finally, if we want, we can linearize the quadratic constraint. That would allow us to solve this problem with a straight MIP solver. We can write: \[\begin{align} & y_{r,m,t,t'} \ge x_{r,m,t} + x_{r,m,t'} - 1\\ & \sum_{r,m} y_{r,m,t,t'} \le 1 \\ & y_{r,m,t,t'} \in [0, 1]\end{align}\]
There is lots of symmetry in this problem and there are quite a few papers around, mainly from a constraint programming view, that try to deal with this. For larger problems there are a few tricks we can apply. For example, we can fix the first round, and let the model only worry about the subsequent rounds.
- There are 9 teams,
- we have 4 rounds of 3 matches,
- each match consists of 3 teams,
- a team plays with another team exactly once in the same match.
| Three sided football field [4] |
To find a feasible schedule we use the following sets: \[\begin{align} & t \in \{A,\dots,I\} && \text{9 teams} \\ & r \in \{\mathit{round}_1,\dots,\mathit{round}_4\} && \text{4 rounds}\\ & m \in \{\mathit{match}_1,\dots,\mathit{match}_3\} && \text{3 matches per round} \end{align}\] We introduce binary variables \[x_{r,m,t} = \begin{cases} 1 & \text{if team $t$ plays in match $m$ in round $r$} \\ 0 & \text{otherwise}\end{cases}\]
A high-level model can look like:
| MIQCP feasibility model | |
|---|---|
| \[\sum_m x_{r,m,t} = 1 \>\>\forall r,t\] | Each team plays exactly once in each round |
| \[\sum_t x_{r,m,t} = 3 \>\>\forall r,m\] | Each match consists of three teams |
| \[\sum_{r,m} x_{r,m,t} x_{r,m,t'} = 1 \>\>\forall t\lt t'\] | Teams \(t\) and \(t'\) play exactly once in the same match |
Because of symmetry in the last equation, we only need to check teams \(t\lt t'\). This saves us a few quadratic constraints.
This model can be solved with a constraint solver or a global (non-convex) MIQCP (Mixed Integer Quadratically Constrained Programming) solver. Of course with a MIQCP solver we need to add a dummy objective (we are only interested in feasibility here). Global solvers likes Baron, Couenne or Antigone can solve this easily. The results can look like:
| Solution |
- Every row has three entries (a match has three teams)
- Every column has four entries: one in each round (a team plays once in each round)
- Two teams play in the same match exactly once (e.g. A and B meet in round 1 only)
It is noted that there are many feasible solutions.
If we want to solve with a convex MIQCP solver (like Cplex or Gurobi) we can replace the quadratic constraint by: \[\sum_{r,m} x_{r,m,t} x_{r,m,t'} \le 1 \>\>\forall t\lt t'\]
Finally, if we want, we can linearize the quadratic constraint. That would allow us to solve this problem with a straight MIP solver. We can write: \[\begin{align} & y_{r,m,t,t'} \ge x_{r,m,t} + x_{r,m,t'} - 1\\ & \sum_{r,m} y_{r,m,t,t'} \le 1 \\ & y_{r,m,t,t'} \in [0, 1]\end{align}\]
There is lots of symmetry in this problem and there are quite a few papers around, mainly from a constraint programming view, that try to deal with this. For larger problems there are a few tricks we can apply. For example, we can fix the first round, and let the model only worry about the subsequent rounds.
References
- PHP - Evenly Distribute Teams Into Arrays So That No Combination Repeats, https://stackoverflow.com/questions/52600546/php-evenly-distribute-teams-into-arrays-so-that-no-combination-repeats
- Markus Triska and Nysret Musliu, An Improved SAT Formulation for the Social Golfer Problem, Annals of Operations Research Vol. 194(1) (2012), pp. 427-438
- Nicolas Barnier, Pascal Brisset. Solving the Kirkman’s schoolgirl problem in a few seconds. CP 2002, 8th International Conference on Principles and Practice of Constraint Programming, Sep 2002, Ithaca, United States. Springer, 2470, pp 33-41, 2002.
- Three Sided Football, https://en.wikipedia.org/wiki/Three_sided_football