TLDR; Do you want to organize a tournament where the pairing system is round robin but some players need to play against other players at a specific time? This gist is what you are looking for. If you want the full story, read on.
On friday evening, I got a call from the tournament director of Sri Lanka Scrabble. he wanted to know if I could write a bit of code for him to change the pairing of the Premier Players Tournament - a round robin event. Now you might read Scrabble and Sri Lanka in the same sentence and decide to move on, but hold it right there, Sri Lanka is fast on it's way to being a global Scrabble power house. For example the young scrabblers won six prizes at the World Youth Scrabble Championship three months ago. But I digress.
An odd number of players take part in this Premier Players Tournament and that means there is a bye. Another participant is Quackle. Sometimes players ask to receive the bye in a certain round so that they can rush out and attend to pressing matters in the middle of the tournament. Or if they get the bye at the start or end of the day, they can then show up later or leave early. On this occaision five of the players had wanted the timing of the bye fixed and two others wanted to play against Quackle in a specific round.
The Berger Table
If only the bye needs to be accommodated, it can be done very easily just by changing the seeds. The algorithm to generate a Berger table is described on Wikiepdia, thus it's easy to see that if someone wants to have the bye in the first round, he should be given the first seed and Bye the 10th seed (or vice verce).
As pointed out by my friend Jayendra De Silva (former Tournament director for Sri Lanka Chess), you can fix the bye even for all eight players simply by changing the seeds and it can be done manually even with pen and paper
If in addition to 'fixing the bye' one players wants to fix a time for the game against Quackle, that can be arranged by changing the seed for Quackle. Trouble arises when more than one player wants to player Quackle and Bye at certain times. Some combinations turn out to be impossible. In fact I spent quite a bit of time trying out various algorithms to try to 'flip pairings'. I soon reached the conclusion that the combination asked for was impossible but had not mathematical proof. So I ended up writing a brute force method to produce all possible combinations and to see if any one of them met the requirements.
For 9 or 10 players, there are 3,628,800 possible pairings but it takes only a little more than half a minute to produced them all. However this is an O(n!) problem so it might well be impossible for twenty four players. Number of possible pairings is huge and bigger than even Avagadro's number. Trying out all combinations didn't produce a match, but the code can be used to generate customized round robin pairing schedules for many situations.
Since many tournament directors probably will not be able to make much use of the code as it is, I will be releasing an online pairing generator real soon. There are quite a few of them already but none of them allow you to reschedule games as described above.
- Updrading Postgresql 9.3 to 9.5 with Postgis. »
- « Wifi with Qualcomm Atheros Device [168c:0042] (rev 30) on Linux Mint