<p>Specifically this looks like the <a href="http://en.wikipedia.org/wiki/Stable_roommates_problem" rel="nofollow">Stable Roommate Problem</a> (SRP). Alternate the order of preference based on position in a list sorted by distance from the total score. I.E., imagine a list with the following scores:  </p>

<p>1, 3, 18, 19, 20, 21.  </p>

<p>Then the preference list would be:  </p>

<p>1: 3, 18, 19, 20, 21<br>
3: 1, 18, 19, 20, 21<br>
18: 19, 20, 21, 3, 1<br>
19: 18, 20, 21, 3, 1<br>
20: 19, 21, 18, 3, 1<br>
21: 20, 19, 18, 3, 1</p>

<p>For more accuracy use the <a href="http://eprints.gla.ac.uk/11/1/SRT.pdf" rel="nofollow">Stable Roommate With Ties</a> (SRT) algorithm.</p>

<p>The way Swiss Teams differs from SRP is that not everyone will be listed. That is, if the teams with scores 20 and 18 have played each other already then neither list each other as preferences. It's possible that SRP will still give the correct result but it remains to be verified.</p>

CC BY-SA 2.5
2011-01-07T09:31:50.670Z
Yes, I think this indeed is a stable roommate problem. However, the team with a total score of 18 would have a preference list of: 19,20,21,3,1. Or am I mistaken?
Dabblernl
CC BY-SA 2.5
2011-01-09T06:41:59.383Z
I've modified the initial ordering to be based on distance instead of rank distance.
Jonathan
CC BY-SA 2.5
2011-01-07T03:20:35.000Z
2011-01-09T07:01:34.903Z
2011-01-09T07:01:34.903Z
Jonathan
<p>Maybe I’m totally wrong (the Wikipedia article suggests it), but to me this seems like a rather simple graph problem. The parties are the vertices in a graph, an edge’s weight is the difference in total score between the parties corresponding to the adjacent vertices. You start with a complete graph $G$ and search for a perfect (if the number of parties is even) minimum matching $M,$ then remove all edges in $M$ from $G,$ and search for another perfect minimum matching. Repeat these last two steps as often as necessary. Maybe the <a href="http://en.wikipedia.org/wiki/Matching_%28graph_theory%29" rel="nofollow">Wikipedia article on matchings</a> helps.</p>

CC BY-SA 2.5
2011-01-07T09:41:49.627Z
Thank you, I will try to study this. It is entirely baffling to me at the moment, having no knowledge of maths beyond what was taught me at high school ;-)
Dabblernl
CC BY-SA 2.5
2011-01-06T22:53:31.960Z
2011-01-07T08:53:38.163Z
2011-01-07T08:53:38.163Z
Sacha
<p>I am writing on software that has to create matches between teams of bridge players. Each round a new series of matches is calculated. The algorithm has to meet these two criteria:</p>

<ul>
<li>Each round every teams must meet a team against which it has not played before.</li>
<li>The teams that play against each other should have as close a total score as possible.</li>
</ul>

<p>This method is known as "Swiss teams". Can someone point me in the right direction?</p>

<p>Read some more about the <a href="http://en.wikipedia.org/wiki/Swiss-system_tournament" rel="nofollow">Swiss-tournament system</a></p>

CC BY-SA 3.0
2011-12-04T23:25:35.013Z
I am not sure if this is a suitable question for cstheory, it seems more appropriate for [SO]. Please see the [FAQ] to understand the scope of cstheory.
Kaveh
<ds.algorithms>
Algorithm for "Swiss teams" (bridge)
Dabblernl
# Algorithm for "Swiss teams" (bridge)

(Asked by: username_0 on 2011-01-06)

I am writing on software that has to create matches between teams of bridge players. Each round a new series of matches is calculated. The algorithm has to meet these two criteria:

* Each round every teams must meet a team against which it has not played before.
* The teams that play against each other should have as close a total score as possible.

This method is known as "Swiss teams". Can someone point me in the right direction?

Read some more about the [Swiss-tournament system](http://en.wikipedia.org/wiki/Swiss-system_tournament)

**Tags:** ds.algorithms
> **Comments:**
> **username_1**: I am not sure if this is a suitable question for cstheory, it seems more appropriate for [SO]. Please see the [FAQ] to understand the scope of cstheory.  

---

## 2 answers

### Answer by username_2 on 2011-01-07. Score: 2 | Accepted answer

Specifically this looks like the [Stable Roommate Problem](http://en.wikipedia.org/wiki/Stable_roommates_problem) (SRP). Alternate the order of preference based on position in a list sorted by distance from the total score. I.E., imagine a list with the following scores:

1, 3, 18, 19, 20, 21.

Then the preference list would be:

1: 3, 18, 19, 20, 21  
3: 1, 18, 19, 20, 21  
18: 19, 20, 21, 3, 1  
19: 18, 20, 21, 3, 1  
20: 19, 21, 18, 3, 1  
21: 20, 19, 18, 3, 1

For more accuracy use the [Stable Roommate With Ties](http://eprints.gla.ac.uk/11/1/SRT.pdf) (SRT) algorithm.

The way Swiss Teams differs from SRP is that not everyone will be listed. That is, if the teams with scores 20 and 18 have played each other already then neither list each other as preferences. It's possible that SRP will still give the correct result but it remains to be verified.

> **Comments:**
> **username_0**: Yes, I think this indeed is a stable roommate problem. However, the team with a total score of 18 would have a preference list of: 19,20,21,3,1. Or am I mistaken?  
> **username_2**: I've modified the initial ordering to be based on distance instead of rank distance.  

---

### Answer by username_3 on 2011-01-06. Score: 1

Maybe I’m totally wrong (the Wikipedia article suggests it), but to me this seems like a rather simple graph problem. The parties are the vertices in a graph, an edge’s weight is the difference in total score between the parties corresponding to the adjacent vertices. You start with a complete graph $G$ and search for a perfect (if the number of parties is even) minimum matching $M,$ then remove all edges in $M$ from $G,$ and search for another perfect minimum matching. Repeat these last two steps as often as necessary. Maybe the [Wikipedia article on matchings](http://en.wikipedia.org/wiki/Matching_%28graph_theory%29) helps.

> **Comments:**
> **username_0**: Thank you, I will try to study this. It is entirely baffling to me at the moment, having no knowledge of maths beyond what was taught me at high school ;-)  

---

