Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

Java Team Scheduling Algorithm

Thread view: 
dlemmermann@gmail.com - 12 Mar 2007 11:35 GMT
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
Daniel Dyer - 13 Mar 2007 00:32 GMT
> Hi there,
>
[quoted text clipped - 17 lines]
> 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.

Signature

Daniel Dyer
https://watchmaker.dev.java.net - Evolutionary Algorithm Framework for Java



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.