How Cup Manager works under the hood
We have for a long time been polishing algorithms that are at the heart of Cup Manager's many automatic functions.
Each new tournament has given us new insight into how complicated it is to design the perfect schedule.
Here you will get insight into some of our unique features that use the knowledge we have gathered over the years.
Geographical division of teams
In order to make an automatic feature that you can actually rely on when it comes to handing out teams in groups (the same algorithm is actually used for playoff trees as well), it is important that you do not finish halfway and, for example, only take into account which clubs the teams come from. Such an algorithm leaves a lot of manual work to ensure that teams from the same city (or country in international tournaments) do not end up in the same group.
In Cup Manager, therefore, we take into account the following conflicts (one conflict is if two teams with the same property below end up in the same group):
- Sports district
- Postcode area
- Admin email address
- Jersey color
There are three different features in Cup Manager that use the same conflicts to create the best playing schedule possible:
- Group division of teams
- Playoffs (there is the conflict that teams have progressed from the same group)
- Match breakdown into struggling classes
In Cup Manager, we have built a "conflict solvers" which is guaranteed to be able to distribute teams between groups in an optimal way. This means that Cup Manager always distribute teams to groups so that the number of conflicts is minimized. Therefore, together with the feature that allows you to see certain teams before using the automatic function, it can be said that Cup Manager function for handing out teams is complete. The conflict solver is actually one of the first to be built for Cup Manager and has been included in all versions of Cup Manager since about 2008 (12 years at the time of writing!).
Since you don't have to rank teams in order of performance in struggling classes, amn doesn't have to let all teams in a group face each other either. It opens up to select certain matches from a large group where you avoid conflicts between the teams that play in the matches you select.
This may seem as simple a problem as handing out the law to groups, but the truth is that it is much more difficult. Unlike in the past, where it is possible to find a guaranteed optimal solution, here (at least with slightly larger groups) one has to settle for finding the best possible division. One can illustrate the difficulties by describing a sub-problem:
How many games do teams from the same club have to play against each other if they are in the same group of a certain size where all teams should play at least a certain number of matches?
For a 7-team group, the answer looks like this when you vary the number of teams from the same club (rows) and the number of matches per team (columns):
There are clear patterns in the table above, but the relationship is so complicated that we had to simulate the results for different group sizes in advance in Cup Manager. It then helps the system determine if it has found an optimal match breakdown.
Since there is no easy way to find the best matches, Cup Manager then tests themselves just as a human being would have done. The advantage for Cup Manager is that it is very fast and that Cup Manager can keep track of the fact that all teams have got the right number of matches. Cup Manager also handles all 11 conflicts from the conflict list. It is not easy to hold them in your head! After all, it's this testing that can take a few minutes if you draw a struggling class in Cup Manager.
A good playoff tree should meet two requirements.
1. The higher the ranked team, the easier the path to the final
2. Teams that have faced each other earlier in the tournament shall meet as late in the playoffs as possible
The first requirement leads to the best ranked team facing the worst ranked team, the next best team will face the second worst team and so on. In reality, there are often several teams that have the same ranking (e.g. the 1s from all groups – with the exception mentioned in Rule 4).
Rule 2 is in many cases easy to follow. For example, if the 1st and 2nd in each group go to playoff A, you can place the 1 on one side of the playoff tree and the 2nd on the other side. It becomes more complicated if you have 3 teams from the same group in the same playoffs. Then you have to divide the playoff tree into 4 parts (at each Semi final) and then put a team in 3 of the four parts, with the result that two of the teams can meet already in the Semifinal if the bad luck/luck is there.
It is clear that here you can end up in a very complicated situation if you have several groups with an odd number of teams and perhaps at worst also an uneven playoff tree. It is clear that not all cases that may occur with ready-made templates can be solved. We need an algorithm. Unfortunately, this could be even worse, because ofta also wants to comply with a third requirement similar to requirement 2:
3. Teams that usually meet in series games or come from the same club should meet as late in the playoffs as possible.
Here you get to the limit of what is possible in practice. In Cup Manager Rule 3 is solved by creating groups and playoffs and placing the teams, being able to check that teams from the same club do not meet. If you are unlucky, amn will be helped to move one of the teams to a new group in order to avoid the problem.
Finally, a playoff tree can be uneven (unless you use e.g. Best 3s). The fact that a playoff tree is uneven means that you have 14 teams and thus will have 1/8 finals, but only 6. This means that two of the teams must go straight to the 1/4 final. If you have an uneven playoff tree, there's one more rule:
4. In the case of uneven playoff trees, the teams that have played the most games shall have the preference to skip the opening round.
This means that if it is between the 1 in a 4-team group and the 1 in a 5-team group, the team in the 5-team group that has already played an extra match should skip the opening round of the playoffs.
A simple playoff tree with 4 teams coming from two groups. The best team meets the worst team (1s against 2s) and the teams from the same group do not meet until the final.
Scheduling is a problem that on the surface may seem simple, but is actually one of the hardest things there is for a computer to cope with. Even so, tournament administrators have always managed to set schedules without double meetings and with enough rest time. We took that into account when we built Cup Manager's algorithm for automatic scheduling.
Just as a human being had done, Cup Manager one game at a time will be placed on the schedule until all matches are placed. Should the bad luck arrive, simply remove the last few games on the schedule and try again until all the matches are placed.
What, then, is the problem? A simple calculation example quickly answers that question. Let's assume we want to place 100 games on 10 different playing fields. If we have to try all 10 playing field for all 100 games when we set the schedule, we will test 100000000000000000 (100^10) different placements of matches. Even with all the world's supercomputers united, it would not have been possible to schedule with such a method. Then we haven't even taken into account the time the games are to be played. The obvious trick (which is easier said than done) is not to make mistakes when placing the matches. Suddenly all we have to do is test 1 schedule. Instead of correcting your errors afterwards, you have to be proactive and make sure not to make any (or at least very few) errors.
Scheduling can then be divided into two issues that need to be resolved, or two questions to be answered during scheduling:
- Which match should I place next?
- What place and time should the match I have chosen be given?
If you answer "right" to the two questions throughout your scheduling, you are at the finish line! Unfortunately, the methods of answering those questions correctly are an entire field of science. The basis of Cup Manager's method of answering the questions comes from a degree project in computer science that you can download here. Using the method of ranking matches and placements described in that work, you will always get a balanced schedule with the same number of matches on each playing field.
To answer the questions, you must also take into account all the rules that exist for what the schedule of a tournament may look like. E.g. rest times and what days a match should be played, but also more advanced rules that everyone should play at least one match in the main stadium or artificial turf. Any rules you add will affect the answer to the two questions because it is with the help of the two questions that the system avoids breaking the rules.
Under the hood of cup manager's scheduler there is therefore an advanced scheduling engine that is able to schedule tournaments with several thousand matches, despite complicated rules. By taking into account all the rules you add to your schedule when answering the two questions, Cup Manager manage to quickly schedule almost all schedules.
We like to think about game schedules. Feel free to challenge us!
Cup Manager support
Do you want a simpler life?
Contact us, or choose an appointment to book a demo of Cup Manager. We look forward to showing you our system.