I Need an Algorithm…

Below is the explanation of a problem I need to find an algorithm for. Feel free to take a stab at it…

We have a schedule of high school football games. There are about 300 teams, which really doesn’t matter, but just FYI. It is a 9-week season and each team has one bye during one of those weeks. So each team plays 8 games. The opponents are already assigned for each game based on lots of different criteria including location, ranking, each team’s preference, etc. Now the Home and Away designations must be assigned. This is the tricky part because:

  • Each team must have exactly 4 home games and exactly 4 away games total.
  • In the last 5 weeks (which is when they play district opponents), each team must have either 2 home games or 3 home games (so that it is as balanced as possible).
  • No team can have more than 2 home OR away games in a row.
  • Some teams play an out-of-state team in week 1 and/or week 2. If so, the home or away value is already set – either they play out of the state or at home and this can’t be changed. But, this game(s) does factor into the overall total number of home and away games for that school for the season.

Have at it!

-Ann