Search code examples
algorithmmathseedingtournament

Tournament Tree seeding with n Teams, m Groups, k Proceeder and Lucky loser


Imagine a tournament with 6 groups and 4 Teams per group. 2 Teams of each group (called "proceeder" from now on) proceed to the elimination phase (tournament tree / bracket stage...). Now that there are 6 groups with 2 proceeder each, the total amount of proceeder is 12. Because 12 is not a power of two, we need more teams, that proceed to this state. These additional proceeder (called "lucky loser" from now on) are the 4 best 3rd placed teams from all groups.

You can see this setup in the EC 2016 (France) gameplan. https://www.fussball-em-2016.com/wp-content/uploads/2016/01/em-2016-spielplan.jpg

After the final groupstage tables you can see, who is playing against whom in the round of 16. Here comes the problem. Is there a specific seeding for n groups, m proceeder and k lucky loser. If i try to summarize the given example it is somehow as follows.

mth proceeder (without lucky loser) of group n-(n+1) vs. mth proceeder (without lucky loser) of group n-(n+1). But why is that. Why does the 2nd of group A play against the 2nd of group C and not group B. But if we take that information, do I always need to skip 1 group, or does the 2nd of the first group play against the 2nd of the (n/2)th group. Considdering this matchup, the next match is the 1st of group D vs the 3rd of the previously skipped group B or the following groups E or F. (If there are more groups, does it go on with G, H, ... ?). At this point I cant express it with n, m ... anymore.

I do not have a specific code snipped, because I still cant figure out an approach of how to iterate over it. In the first place you skip a group (dont know if always 1 group or depending on the number of groups) and the mth placed team plays against the 1st team of another group. Then the lucky loser of the groups not mentioned before. I cant figure out a proper structure or any similarities.

Maybe someone knows an approach of how to create this seeding with undefined numbers of groups, proceeder and lucky loser, considering also not having any lucky losers at all. Of course it only needs to work, if the number of total proceeder + lucky losers is a power of two, so a proper tree can be created.


Solution

  • I'm not sure where exactly you hit the wall. If you look at the actual plan for the Euro 2016 you may see that it is relatively straightforward. I can't match that exactly but it seems not hard to get something like this.

    Since you didn't provide any explicit restrictions on the resulting match ups I assume the rules for the first knock-out round matches are:

    • a winner of a group should not be matched against a winner of another group (only against 2nd or 3rd place)
    • no two teams that played in the same group should be matched against each other.

    First of all let's notice that m, the number of lucky losers, must be even. Each group provides 2 direct winners and the total number of proceeders is also even. Now lets split n, the total number of groups, into to regions:

    1. The last n-m groups. This is the simpler (more traditional part): the winners of these groups will never play with the lucky losers. If n-m is even you can just split them in pairs and play cross games (1A vs 2B and 1B vs 2A). If it is odd, the simplest solution is to play shift by 1 games (1A vs 2B, 1B vs 2C, ... 1Z vs 2A).

    2. The first m groups. In those groups we say that all the first places will play with some lucky looser, and all the second places will play among themselves. So what we want now is some scheme that will not let the winner and the lucky looser of the same group to be matched against each other again.

    Let's assume that all the lucky losers come from those first m groups. If this is not the same, leave those that come from these groups in their groups and fill the gaps with the lucky losers from the other group in increasing order. For example, assume that there m = 4 and actual lucky losers came from the groups B, C, E, and F. Then B and C stays in their groups, the gap in the group 3A is filled by 3E and the gap in the group 3D by 3F so the resulting order there is 3E, 3B, 3C, 3F. This rule is a simple way to ensure that the teams from the same group will not be matched up again: we just do not match up teams from the same (re-assigned) group and that's all we need.

    Since m is even, we can split all groups in pairs. From each pair we build 3 games:

    • 1A vs 3B
    • 1B vs 3A
    • 2A vs 2B

    This probably will provide a bit skewed distribution in the next round. You can improve this if you split groups in pairs in two different ways. For example, one way is to join groups #i and #(i+1) and another is to join groups #i and #(i+m/2). Then you build 1st vs 3rd matches from one pairing and 2nd vs 2nd from another.

    To complete the Euro 2016 example it would go like this:

    1. n-m = 2 so the last two groups are E and F. So the next stage is 1E vs 2F and 1F vs 2E.

    2a. First pairing (#i vs #(i+1)) is A with B and C with D. It gives us matches 2A vs 2B and 2C vs 2D

    2b. The second pairing (#i vs #(i+m/2)) is A with C and B with D. Actual lucky losers are 3B, 3C, 3E, and 3F so according to the algorithm we put them as 3E, 3B, 3C, 3F. This gives us 4 matches 1A vs 3C, 3E (re-assigned to 3A) vs 1C, 1B vs 3F (re-assigned to 3D), 3B vs 1D.

    To sum up all matches are

    • 1E vs 2F
    • 1F vs 2E
    • 2A vs 2B
    • 2C vs 2D
    • 1A vs 3C
    • 3E vs 1C
    • 1B vs 3F
    • 3B vs 1D

    This looks reasonably good to me.

    Obviously you can additionally re-arranges the games to meet some more restrictions on the next round. For example, should the winners of the 1E vs 2F and 1F vs 2E be matched up against each other again in the next round or never met until the final? AFAIK both choices have been used in practice because both have some pro and cons. The obvious downside of matching them against each other is that this is boring for spectators and kind of unfair (if the two best teams were seeded in the same group, they can't take 1st and 2nd place). The non-obvious upside is that in the real life the time for the rest between matches matters and such matching provides a more fair schedule in this aspect.