Wednesday 1 June 2016

A toy model: tennis team roster


We put in a tennis team to play Victoria Tennis Pennant grade 7 this winter.

  •             There are 6 players in the team and 5 of them are keen to play as much as possible while I only want to play occasionally.
  •             There are 8 team in the section so we decide to make have 5 players playing 10 weeks and I only play 6 weeks.
  •             There are 7 weeks’ away and 7 weeks’ home.
  •             Odd weeks are for single matches and even weeks are for double matches
  •             One player doesn’t have car so I make a trade off with him, he plays as many home matches as possible and I’m happy to play more away matches.
As the round robin schedule came out, the captain needs to make the roster which is a bit tricky to make everyone happy. For example, I only play 6 matches so I do not want to play an opponent twice, or player want to play even single/double matches, home/away matches, or player do not want to play/no-play too many weeks in a row, etc.
So I decided to put it into a model and let the optimization solver work out the best roster.

The model

Input data:
  •           Number of team = 8
  •           Number of round = 14
  •           Number of players = 6
  •           Number of players for each week = 4
  •           Array of number of playing weeks for each players: array of 6 elements.
  •           Home and away schedule: and array of size 14 with equal home and away elements
  •           Single and double schedule: and array of size 14 with equal single and double elements
  •           Player 1 prefers play home
  •           Player 5 only play 6 weeks (it’s me)

Constraints:
  •           Except Titus and Minh, everyone has number of home and away match difference of no more than 1 
  •           Everyone has number of single and double match difference of no more than 1 
  •           Everyone except Minh play other team at least once
  •           No one play more than 4 weeks in a row
  •           No one off more than 2 weeks in a row
  •           Except me, each player plays all other teams at least once.

Objective:
  •           Maximum player 1 home matches

Implementation: The model is built in Minizinc (www.minizinc.org) and run on 2 solvers comes with Minizinc IDE, Gecode  and G12 FD.


Result: Both found optimal solution less than 1 second and give player one 7 matches.



No comments:

Post a Comment