0

We are a group of 20 people and we like to go play 2 vs 2 tennis matches. Each of us plays one match each round and we do 5 rounds in total, so everyone plays 5 matches. Matches have two restrictions:

  • Everyone has a different level (from 1 to 5), so the matches must be balanced: two players with levels 5 and 5 shoulnd't be matched with two levels 1. So between the two teams, the difference in level must be lower or equal to 1.5.
    Ej.: level 1.5 and level 2 vs level 2 and level 2.5. The difference in level between teams is 1 so the match is accepted.
  • If two players play together in one match, they must not play toghether again in the following rounds.

I managed to create a python script that does the specified above, but it takes about 20 minutes to finish depending on the level of the people :/. What I do is shuffle the list with every one in it, break it into 5 lists of 4 people, check if conditions are satisfied and repeat for every round.

I tried modeling the problem to solve it with linear programming (LP) but I don't know which is my function to optimize to begin with... Any ideas on how to do this with or without LP?

Thanks in advance!

watxaut
  • 49
  • 3
  • 1
    LP will not be enough, you would need (Mixed-)Integer Programming (medium formulation difficulty). Alternatively you could use Constraint-Programming (easiest formulation) or SAT-solvers (highest formulation difficulty). – sascha Jun 19 '16 at 23:40
  • I will take a look into it! Thanks! – watxaut Jun 24 '16 at 11:09

1 Answers1

1

You could use a dummy objective or even try to minimize the max of the difference in levels.

My MIP model is not completely trivial, but it solves quite fast (about a second or so using a commercial solver).

enter image description here enter image description here

The results look ok at first sight:

enter image description here

I assumed two players cannot be in the same team more than once. I.e. not just in the same game. That is in my case you can play against another player more than once.

A more complex example can be found here.

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39
  • That looks complicated but very interesting. I need to go over it when i got more time. My approach used preprocessed pairs (pair@match@round = decision-variable) as some symmetry-reduction / simplification. The most interesting thing about a MIP-approach is in my opinion the following: **You could also minimize the average skill-difference**. (maybe even using a L2-norm which might be a better model, although one has to be careful about convexity). (btw: your blog is great!) – sascha Jun 20 '16 at 12:39
  • If you can come up with something substantially simpler I would certainly like to see that, – Erwin Kalvelagen Jun 20 '16 at 12:51
  • Wow thanks a lot! This is very complete! I will try it myself with python, at least now I have an idea about how my model should be. Could you tell me which solver did you use? – watxaut Jun 24 '16 at 11:06