vendredi 10 avril 2015

Round robin match location algorithm


Vote count:

0




I'm trying to figure out an algorithm for setting a matches location for a round robin tournament.



  • Each team plays each other team twice, once at home and once away.

  • Each team has a home location.

  • There are many teams in the tournament that share the same home location.


I already have an array of all the matches. A match looks something like:



{
date:
home: "Bob",
away: "Frank",
location: null
}


I want to loop through all matches and assign the location. I've tried various solutions but nothing has worked perfectly yet.



  • Of course, if Bob's home location is available on date we can just use that.

  • We have to take into consideration the other match in which Bob and Frank play. It's fine to switch home/away teams but we must ensure it is balanced. (i.e. Bob and Frank play at home once each)

  • If it is impossible to assign a location even after trying to switch home/away, we must then attempt location splits.


Location split


Match locations can be split so that multiple matches are played at the same time at a single location. How we determine if a location can be split is outside the scope of this question but let's just say we have a function called canLocationBeSplit(location) which returns a bool true or false.


Both home or away locations on either match between 2 teams can be split. However, we only want to start splitting locations unless absolutely necessary. Again, each team must play at home once and away once.


If there is still no available location for the match, we just leave it as null.



asked 41 secs ago







Round robin match location algorithm

Aucun commentaire:

Enregistrer un commentaire