I am working with some tournament software where i need to generate pairings based on the swiss system. Some of the ideas i have came up with are as follows:

1)Create all permutations and choose best -This is O(n!) which is not possible when n can be up to 1000.

2)Create a weighted graph and choose best pairs somehow -I feel this is best but was hoping to find some similar examples

3)Find api where players(objects) can be passed in and paired based on typical elo/swiss pairing rules.

4)Generate initial result with no logic then try to improve with swapping until no more improvements can be made(not sure how one would know when no more improvements can be made)

So for pairings players are paired with others with same scores and staggered. So for example in a 16 player tournament the first round would have top seed paired with 9 seed and 2nd seed paired with 10 seed and so on. This gets complicated when you take into account teams(players on same team will only play each other when forced), players can't play each other twice, alternating colors is optimal which is what is meant by the above #1 creating all permutations to see which is best. This will not work if tournament is large.

I would like to do this client side(javascript) so wanted to keep that in mind.

Thanks in advance for any suggestions

| cite | improve this question | | | | |
  • $\begingroup$ I don't understand your question. What is the input, and what is the output? Try explaining this without using the words elo or swiss. $\endgroup$ – Yuval Filmus Jan 26 '17 at 13:12
  • 1
    $\begingroup$ I don't understand your question: your suggested approaches seem to have nothing to do with the Swiss pairing system (except for the last one, of course). Why don't you find a description of the pairing rules and try to implement them. I don't see any part of "Pair people who have the same score, so far; then adjust to avoid bad pairings" that even comes close to generating all possible permutations. $\endgroup$ – David Richerby Jan 26 '17 at 13:23
  • $\begingroup$ Updated question to be more clear $\endgroup$ – Maxqueue Jan 26 '17 at 13:32
  • $\begingroup$ It's not clear what you are looking for. Before we can design an algorithm to generate a satisfactory pairing, we need to know what conditions such a pairing must satisfy for it to be acceptable to you. To put it another way, what criteria should we use to evaluate proposed answers? As far as I can tell, the term 'Swiss' is very broad and just about any tournament schedule that isn't single-elimination and is faster than round robin could be called 'Swiss'. Can you edit your question to clarify your specific requirements? The question can be considered for re-opening once it is clear. $\endgroup$ – D.W. Jan 27 '17 at 6:02