View Single Post
Old 11-16-2015, 06:09 PM   #32
Fishbreath
Minors (Double A)
 
Fishbreath's Avatar
 
Join Date: Oct 2015
Posts: 145
I'm proud and somewhat surprised to report that the scheduler just managed to handle Hageneezz's test case (1 subleague, 4 divisions, 20 teams, 64 divisional games, 30 interdivisional games). Its output is included below.

It also figured out my easy test case (2 subleagues, 2 divisions each, 16 teams total, 50/30/20 games requested, adjusted to 51/36/24 to make even matchups possible), and my moderate test cases (2 subleagues, 2 divisions each, 20 teams total 4-4, 5-5 and 5-4, 5-4, 60/60/20 games adjusted to 60/60/24).

It failed my MLB test case: it can't hit a 162-game target, though it successfully schedules 212 instead. A success, of sorts, in that it was able to make a perfectly compact schedule with no gaps, and did so for a fairly difficult structure. It would probably get closer to 162 with better selection of series lengths required and target number of games. (It'll always look higher, rather than lower, at the moment.)

It also fails my brutal test case (two subleagues, 2-3-5 and 2-3-5, series lengths requested 3/3/3, few breaks/little extra room) most of the time, thought it does occasionally succeed. With the extra-brutal case (series lengths 3/3/2), it fails badly enough that I doubt it'll frequently happen upon a workable schedule, but I don't think any of you are looking for quite that odd a schedule. :P

I think it's fair to say that it stands a reasonable chance of generating a reasonable schedule for most reasonable league structures. I have two things left to do before I can release this version:
1. Improve home/away balancing to look per-opponent, per-category, and overall, instead of just per-opponent and overall.
2. Schedule games throughout the day, rather than scheduling all games at 9:00 a.m. (Heh.)
3. (I know I only said two, but as an option...) write a little progress bar so you can watch as it works things out.

Some future improvements in mind, post-release:
1. Mark some days of the week (or rather, some set of days per seven days) as off-limits, to allow for weekend-only scheduling, or guaranteed breaks every week.
2. Improve handling of non-equal requested schedule lengths.

For those of you following along at home, the insight that pushed me over the edge was this: at the end of previous, failed scheduling attempts, teams would often be left with a large number of games against a single opponent un-schedulable. I changed the code so that, at each scheduling step, each team is allowed to schedule one series against the opponent it needs to play the most, before yielding its turn to the next team. Requiring teams to share the limited resources (namely, days in the schedule) seems to have fixed a problem that boils down to impoliteness, hogging all the free slots before other teams have a crack at them.

Code:
T1 schedule debug 94 games 47H/47A
Divisional 64 games 32H/32A
	T3 16 games 8H/8A
	T4 16 games 8H/8A
	T5 16 games 8H/8A
	T2 16 games 8H/8A
Subleague 30 games 15H/15A
	T6 2 games 1H/1A
	T7 2 games 1H/1A
	T8 2 games 1H/1A
	T17 2 games 1H/1A
	T16 2 games 1H/1A
	T11 2 games 1H/1A
	T13 2 games 1H/1A
	T10 2 games 1H/1A
	T18 2 games 1H/1A
	T19 2 games 1H/1A
	T15 2 games 1H/1A
	T9 2 games 1H/1A
	T12 2 games 1H/1A
	T14 2 games 1H/1A
	T20 2 games 1H/1A
Interleague 0 games 0H/0A

Last edited by Fishbreath; 11-18-2015 at 07:58 PM.
Fishbreath is offline   Reply With Quote