COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Java Team Scheduling Algorithm

• Email
• Follow

```Hi there,

does anyone know of an open-source algorithm for "Team Scheduling"? I
want to
create a little demo of a Swing framework that I developed. In this
demo I want to
simulate a soccer / football league where 18 teams play against each
other. The
matches take place on a total of 34 weekends. Each team plays each
other team
twice, once at home, once away.

At first I thought this could be solved easily with two nested "for"
loops but it turns
out to be more complicated than that. Especially placing the matches
onto those
34 days without any team playing twice on the same day.

If anyone knows of a solution for this scenario, please let me know. I
tried solving
this myself but ended up with a couple of nods in my brain.

Regards,

Dirk

P.S.: no, I am not a student who needs help with his homework.
Unfortunately I
am too old for that (38 this weekend :-( ) To confirm look at
http://www.dlsc.com

```
 0
Reply dlemmermann (13) 3/12/2007 10:35:42 AM

See related articles to this posting

`On Mon, 12 Mar 2007 10:35:42 -0000, <dlemmermann@gmail.com> wrote:> Hi there,>> does anyone know of an open-source algorithm for "Team Scheduling"? I> want to> create a little demo of a Swing framework that I developed. In this> demo I want to> simulate a soccer / football league where 18 teams play against each> other. The> matches take place on a total of 34 weekends. Each team plays each> other team> twice, once at home, once away.>> At first I thought this could be solved easily with two nested "for"> loops but it turns> out to be more complicated than that. Especially placing the matches> onto those> 34 days without any team playing twice on the same day.>> If anyone knows of a solution for this scenario, please let me know. I> tried solving> this myself but ended up with a couple of nods in my brain.The problem can be slightly simplified if you ignore the home/away  requirement.  The second part of the season can be the same as the first  part but with the teams switched.This leaves you with 17 dates on each of which there must be 9 fixtures,  with each team playing once on each date.Firstly generate all of the required matches for the season (ignoring who  is at home).  This is the set of all combinations of length 2 from a set  of 18 elements.This will give you 153 pairs of teams that you need to divide into 17  separate pots ensuring that each team only appears once in each pot.I'm not sure of the best way to do this, but I think the following  approach should work reasonably well (although somebody else can probably  suggest a more efficient way of doint it):Firstly shuffle the list of 153 pairs (assuming you don't want the  fixtures to be predictable).  Then take each pair in turn and allocate it  to the first available pot (fixture date) in which neither team is already  present.  I haven't tried it, but I think this should give you what you  need.Once you've done this you can just duplicate the fixtures for the second  half of the season, switching the home and away teams for each match.Dan.-- Daniel Dyerhttps://watchmaker.dev.java.net - Evolutionary Algorithm Framework for Java`
 0
Reply Daniel 3/12/2007 11:32:08 PM

1 Replies
400 Views

Similar Articles

12/7/2013 12:49:09 AM
[PageSpeed]