News Shop
Events Chat

Creating a more automated helper for tournament pairings

Dear all,

as far as I understood the creation of swiss pairings seems to be quite complicated in some situations and therefore requires quite some brain power and also time. With this thread I’m aiming to give the tournament organizer a more automated helper for doing the pairings so that he has it easier.
(This is by no means a criticism on Frozen’s pairings or his organization of the current tourneys - I’m very grateful and thankful for that, I really intend to make his life easier and nothing else)
Over a decade ago I wrote an algorithm in Excel VBA (please don’t ask why I chose Excel back then) to do similar pairings but with less constraints and a slightly different setting. Maybe I’ll be able to make use of parts of that old algorithm in order to facilitate or possibly even automate the current process. In order to do so I already asked frozen to walk me through the current process and wrote him the following list of steps to take for creating a pairing table. He directed me to @zhavier as you created the current spreadsheet helper (cudos for that!).
When I started writing this very text as a private message to zhavier, I realized that I’ll add the rough idea for the algorithm to it and that it would be a waste of the awesome collective brain power that is available here, so instead I chose to open a new thread about all this.

So first: @zhavier & @charnel_mouse : as you have organized tourneys as well, could you please be so kind and correct me if I got minor or major parts wrong?
My understanding of the current process to generate a pairing table with the help of the current spreadsheet is:

  1. you let the random number generator assign a random number to each player
  2. you sort the list of players by the criteria (a) least number of losses (b) random number
  3. you write down the pairings in order of how they appeared in this ordered list player1 vs player2, player3 vs player4, etc.
  4. you do a manual check and that:
    4.1 looks whether some minor manual manipulation of the ordering of the players leads to a reduced number of rematches (awesome checkup helper here, by the way)
    4.2 you check in case this is a rematch that P1/P2 are swapped
    4.3 you check for a non-rematch, that both players have a roughly even distribution of P1s vs P2s
  5. you make use of the spreadsheet to create the properly named links to the matches

If there is anything missing or even if I got it wrong in nuances only, please tell me!

Now to all that are interested:
What I have in mind is to generate a list of all (or in case of too many participants “many”) possible pairing combinations and to do some kind of rating for these. For example a “pairing table” that contains a match between players that have a huge difference between their respective number of losses generates a large penalty score for the pairing table. Also a rematch generates a penalty score. Then I intend to do something analogous to steps 1 & 2 from above: I’ll generate a random number for each pairing table that was evaluated, then I’ll order these by the criteria (a) least penalty score and (b) the random value.
The highest ranked pairing table then is used for the pairings of the next round.
Obviously the steps 4.2 and 4.3 still have to be done (lower priority to get these automated), but we should be able to eliminate 4.1 which is the brain power consuming one (and likely time consuming as well).

Are there any ideas for further enhancements? Or do you think “not worth it”? Any other opinions or comments?
(@charnel_mouse : in case I really do start this project you’ll have to walk me through what exact kind of output you need in order to have the input for your awesome data analytics project in such a way that it doesn’t generate additional overhead for you)



I think you have pretty accurately summarized the process. And I had considered writing more automation into that spreadsheet, but never found the time or brainpower to tackle the problem. I always felt like it should be doable, and your proposed method is pretty good.


This looks like a good approach to me, generating a list of possible pairings makes it much easier to deal with things like minimizing rematches.

I wrote a little package in R to automate some of the XCAPS21 pairing process. It’s not complete, but I had it produce a log of the decisions made when making the pairings, which I could use as a starting point for making manual adjustments. If I added handling of rematches, I’d start using a list of possible pairings, like you suggest. It takes the pairing rules in priority order, rather than using an overall score, so it would be interesting to see differences in results. Something in a spreadsheet is nicer for others to use, of course.

Regarding output, I just record matches manually, so I wouldn’t worry about that too much!

Thanks a lot for again sharing your code, I’ll definitely have a look at it before diving into this project. I’m really looking forward to see how you did your part!

Dear all (but I’m especially looking at the ones that already have organized tournaments: @FrozenStorm, @zhavier , @charnel_mouse , @EricF ), I have not yet started to implement anything but put some additional thoughts into the algorithm. As you might have seen in the current pairing discussion it came across, that I missed on something else that a good pairing should try to avoid: direct rematches of the previous round.
With that in mind I want to share with you my current plan on what the things actually are that the algorithm should try to avoid. Could you please be so kind to think about the following: does anything else come to mind when looking at this list, that an automated pairing algorithm should try to avoid?

I hope this screenshot of my future config-tab is self explanatory enough that you are able to understand what I meant with the different penalty scores. In case not, please don’t hesitate to ask. The higher a penalty value, the more the algorithm will try to prevent that case to be included in the final matching table.

PS: I do not want to discuss the exact values of the different penalty scores yet. My focus for the moment is on creating a proper algorithm that takes into account all relevant things that should be tried to be prevented when creating a matching table.

1 Like

Hi all, as it looks like I will make use of this algorithm to create the matchups for the next tournament it’s about time to proceed in this thread. The algorithm is set up so far in my mind only, but I’ve already implemented some of the framework for it. With thinking things through more thoroughly, there came some more required parameters which I want to post here. In case anybody wants to make changes to the exact values for the different penalty scores or if someone wants to discuss any specifics of the penalty algorithm: please go ahead!!!
The higher a penalty value, the more the algorithm will try to find other possible pairings if a pairing table contains a case which is met with this specific penalty. Obviously starting from round 3 or 4 the different rules will compete with one another and we probably will find the need to adjust the penalty scores. But if anybody feels like one of the cases that are met with a penalty should be rated more important than it’s current penalty score suggests: please voice your opinion!

I can’t see anything obvious questionable here, but once it’s up and running you could always test it on previous tournaments, to see what it recommends compared to what the host did.