Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sports league scheduling algorithm [closed]

Tags:

java

algorithm

I am building a small website for volleyball (personal interest). Appreciate help in algorithm for scheduling the games such that

  1. It can work for arbitrary number of teams and groups. Round-robin within each group. So if there are 6 teams in a group then there will be a total of 15 games in that particular group.
  2. A game lasts for 30 mins
  3. The schedule is evenly distributed i.e. a team is not required to play consecutively
  4. Each team is playing in approx equally distributed intervals i.e. a team shouldn't play their 1st game at 8 AM and wait until evening for their next 2 games
  5. We can schedule games starting from 8 AM until 4 PM.

6 teams is just an example. I am looking for a general algorithm that works for arbitrary number of teams, courts and groups.

Regards.

like image 869
Aravind Yarram Avatar asked Nov 05 '22 14:11

Aravind Yarram


1 Answers

I'm not sure this needs an algorithm. Since it's round robin with a fixed number of teams and games, you can really just set up a schedule (same on both courts).

Let me explain and tell me if you need something more.

There will be 15 games, with each team playing each other team so each team plays 5 games. You can run the tournament by playing 5 sets of 3 games where each team plays once in each set.

Example:

1-2
3-4
5-6

1-3
2-5
4-6

3-5
1-4
2-6

1-5
2-4
3-6

4-5
1-6
2-3

The longest interval possible for any team between games is 4 slots (2 hours). No team will play two consecutive games. Just plug the team names in and go.

Total playing time is 7.5 hours which just fits within your 8am-4pm window.

Note: I just put this together quickly. It may be possible to re-order things so that the longest interval is actually 3 games, not 4 without sacrificing the no-consecutive-game rule. As it stands, only one team goes the max interval (team 3 between sets 3 and 4). If that matters, it's worth looking into, but practically speaking, I think this would be fine.

like image 77
nycdan Avatar answered Nov 09 '22 15:11

nycdan