Tuesday, December 31, 2019

8 teams, 84 games - Part 5

We saw the grid and statistics for the initial layout in the previous part.  For a first step in making revisions it would be better to see exactly what we want to revise.  Parameters can be defined for each schedule that set the thresholds we want for the statistics, and the grid can show where something is outside the desired bounds.

Saturday, December 28, 2019

8 teams, 84 games - Part 4

The Working Grid

Before I actually get into the working product described below I must mention the significant behind the scenes pieces that I am skipping over here.  Maybe someday I can make all this available, but so far my ambition has already far exceeded my followthrough.  So I know better than to say too much.  Perhaps this can provide momentum in that direction.

I use Perl scripts I have developed to turn the series layout as described in earlier parts into the HTML and Javascript that make up the tool with the data contained in it.  I may call it a webpage, which is true in the sense that I work with it in a web browser, but misleading in the sense that it is still just local and not out on the internet.  Again, I hope someday I can get beyond the current point.  The jump from doing a lot of the work in a spreadsheet to having this tool did happen, so maybe more can too.


Tuesday, December 24, 2019

8 teams, 84 games - Part 3

Filling out the seating chart

That pretty grid from the previous part has all of the series nicely laid out in half-weeks.  We just need to reorder those half-weeks into something that fits with design preferences.  What should those be?

Choices

No consecutive series against the same opponent.  You know, spread things around.

Distribute the matchup somewhat evently - i.e., do not have like both 1 v 5 matchups in the first handful of series sets.  You know, spread things around even more.

About 70% of the series are against division opponents, but the end of the schedule even more weighted toward division games like having only division series the last few weeks.

There are some other things I typically do that I will point out later.

Organization

We have 26 half weeks to slot in the series sets.  To put those together into a coherent whole, layout a simple grid for those half-weeks.  On the left is the early-week series, and on the right is the weekend series.

 1  2
 3  4
 5  6
 7  8
 9 10
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26

Set out the design preferences

Make the last 3 weeks be 6 intradivision series ("D"), which means 2 against each team.  Otherwise spread out the interdivision series ("L"), but keep them in pairs - just another choice.  In the original layout it is either all intradivision games or all interdivision, so we know what is what for all teams.

 1  2    D  D
 3  4    D  D
 5  6    L  L
 7  8    D  D
 9 10    D  L
11 12    L  D
13 14    D  L
15 16    L  D
17 18    D  D
19 20    L  L
21 22    D  D
23 24    D  D
25 26    D  D

Next start deciding which rows go into which slots.  I use team 1 as the identifier.  So I use the opponent for team 1 from a row to identify the row.  Right now, exactly which row does not matter.  We just want to order the opponents for team 1 in a reasonable way.

With so few teams, the same opponent can crop up very quickly, but make sure to not slot in the same opponent consecutively.  Also try to make sure the same pattern is not continuously used (i.e., do not have team 1 play 2 then 3 then 4 in that order every time).  Again with so few teams combinations are limited and there will be some repeating, but try to have variety.

 1  2    D  D    4  3
 3  4    D  D    2  4
 5  6    L  L    7  8
 7  8    D  D    3  4
 9 10    D  L    2  6
11 12    L  D    5  3
13 14    D  L    2  8
15 16    L  D    7  2
17 18    D  D    4  3
19 20    L  L    5  6
21 22    D  D    4  2
23 24    D  D    3  4
25 26    D  D    3  2

Things to note...

Each division opponent appears 3 times early in a week and 3 times on the weekend.  The division opponents are decently spread out to avoid cases like constantly playing a certain team after playing some other team, at least as well as can be done with only 3 division opponents.

The interdivision pairings are familiar from the layout.  5 and 6 are paired together twice, and same for 7 and 8.  The order of playing them is reversed though (i.e., first time plays 6 then 5 and second time plays 5 then 6).  Unlike the division matchups against each opponent being spread between early-week and weekend, both matchups against each interdivision opponent are either early-week or weekend.  The reason for that is so that if the pair of interdivision matchups against an opponent are swapped, it does not change the number of weekend series home vs away.

Looking backward, intending for these things went into putting the division slots in the places they went - one pair early-week then weekend, two pairs weekend then early-week, and the last pair early-week then weekend.

Homestands and roadtrips, at least for team # 1

To further narrow down to which rows go exactly where, again through the eyes of team 1, decide on making each matchup either home or away.  A lot to aim to do in that...

  • We want to target 2- and 3-series homestands and roadtrips.
  • We want to to try to avoid play the same opponent either home or away in extremely short order.  Again this is touch with so few teams.  But a prime example is the pair of matchups against team 3 the last two weeks - make one of those home and the other away.
  • Try to balance out the weekends home/away.  There are 13 weekends, so the goal is half (either 6 or 7) of those being at home.

One possible distribution...
 1  2    D  D    4  3    H  H
 3  4    D  D    2  4    A  A
 5  6    L  L    7  8    H  H
 7  8    D  D    3  4    A  A
 9 10    D  L    2  6    H  A
11 12    L  D    5  3    H  H
13 14    D  L    2  8    A  A
15 16    L  D    7  2    A  H
17 18    D  D    4  3    H  A
19 20    L  L    5  6    A  H
21 22    D  D    4  2    H  A
23 24    D  D    3  4    A  A
25 26    D  D    3  2    H  H

Pretty good...  Split of 6 weekends home and 7 away.  All 2- and 3-series homestands and roadtrips except for that 5th week (halfweeks 9 and 10) having a 1-series homestand and 1-series roadtrip.

Remember though that this is still just for team 1 (and team 5 in reverse since the second division was made a mirror of the first).  The result may not be so pretty for other teams.  And in shuffling things around to try to make them ideal, this layout for team 1 will surely be tweaked as part of the changes to address isues with other teams.  But we are not quite ready to worry about that.

The last step for the ordering is deciding where to slot in the 4-game series against the division opponents, one home and one away for each.  We can only put in one in a week so that there are no more than 7 games in a week.  And we do not want to pile the weeks with them all together because that would lead to too many days in a row without an offday.

Sprinkling those 4 game series around...

 1  2    D  D    4  3    H  H
 3  4    D  D    2  4    A4 A
 5  6    L  L    7  8    H  H
 7  8    D  D    3  4    A  A4
 9 10    D  L    2  6    H  A
11 12    L  D    5  3    H  H4
13 14    D  L    2  8    A  A
15 16    L  D    7  2    A  H
17 18    D  D    4  3    H  A4
19 20    L  L    5  6    A  H
21 22    D  D    4  2    H4 A
23 24    D  D    3  4    A  A
25 26    D  D    3  2    H  H4

Now we can put the order defined by this scheme on the matchups layout.  Set each halfweek number (1-26) on the row that matches what was defined for the team 1.

13  3 1 2 3 3 4 3 6 5 3 8 7
22  3 1 2 3 3 4 3 6 5 3 8 7
 3  4 1 2 4 3 4 4 6 5 4 8 7
 9  3 2 1 3 4 3 3 5 6 3 7 8
16  3 2 1 3 4 3 3 5 6 3 7 8
26  4 2 1 4 4 3 4 5 6 4 7 8
 7  3 1 3 3 4 2 3 7 5 3 6 8
23  3 1 3 3 4 2 3 7 5 3 6 8
18  4 1 3 4 4 2 4 7 5 4 6 8
 2  3 3 1 3 2 4 3 5 7 3 8 6
25  3 3 1 3 2 4 3 5 7 3 8 6
12  4 3 1 4 2 4 4 5 7 4 8 6
 4  3 1 4 3 2 3 3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
26  4 2 1 4 4 3 4 5 6 4 7 8

Next steps...

We have the structure all laid out, so we could turn it into the schedule that OOTP uses.  But first it can still gain refinement, character, and personalization.  That is just fancy talk for saying it can be further edited to make sure teams have reasonable homestands and roadtrips, spread around the offdays, and make sure other design parameters are met.  This layout may be great for team # 1 but others may be quirky like with lots of 1-series homestands and roadtrips (e.g., team # 2 goes H-A-H-A-H the first 5 half-weeks).  And I prefer not having everybody always playing on all the same days.  It would be nice to have a good tool for making edits to various details to try to make the schedule as good as possible collectively.

8 teams, 84 games - Part 2

Lay out the series

I use a spreadsheet for setting out the series.  It provides a nice structure for gridding things and simple math functions can be used to take care of some of the work like duplicating series and adding +1 to team numbers to create subsequent matchups.

I defined a series with a triplet of numbers.  From left to right the numbers in the triplet are:

  1. number of games in series
  2. away team
  3. home team.

The number of games I underline to make it stand out visually when working in the spreadsheet.  Here I will show the info with a fixed-width font rather than copying spreadsheet views.

So this represents a 3-game series of team 1 playing at team 2:
 3 1 2
That is one series, and we need to do all the series.

8 teams, 84 games - Part 1

Define parameters

We are going to build a ILN_BGN_SL1_D1_T4_D2_T4_C_ schedule!  That is the OOTP formatting for defining league structure and means...

One subleague, with 2 divisions, each with 4 teams

Games

84 games
Play each of 3 other teams in division 20 times (10H/10A)
Play each of 4 teams in other division 6 times (3H/3A)

That seems a likely choice for distribution of games for such a league configuration, but mostly it turns out nicely for illustrative purposes.