Balanced team schedules based on seeding
November 4, 2014 10:01 AM   Subscribe

I'm running a fantasy football league in which we have 10 teams. The first 9 weeks were round-robin style, with each team playing each other team exactly once. My plan was to schedule weeks 10 through 13 (four weeks) such that each team played a mix of stronger and weaker opponents based on the standings in weeks 1 through 9, then use the week 1-13 results to seed teams for the playoffs in weeks 14-16, but I'm having trouble developing an approach for generating these balanced week 10-13 matchups fairly. Any ideas?

I'm a proficient programmer in Python and several other languages, and I've cooked up scripts in the past to generate schedules, but those always assumed that every team would play every other team exactly once or twice, and didn't take team seeds into account, so I'm having trouble coming up with a rough algorithm for doing this when the number of weeks is constrained, and when there's a need to make sure each team's strength of schedule is balanced.

I don't need the absolute optimal solution -- anything that ensures that each team is playing each week and has a relatively fair mix of strong and weak opponents is fine. My first idea was to divide the teams into two pools, but then each pool has an odd number of players, so each week would have to have a matchup that crosses over between pools, which confounded things.

I haven't found any ready-made schedule generating sites that handle these kind of constraints, so I thought I'd ask here.
posted by tonycpsu to Computers & Internet (8 answers total) 1 user marked this as a favorite
 
Seems like backtracking algorithms would be worth exploring
posted by thelonius at 11:12 AM on November 4, 2014


Best answer: One possibility: divide them into five pools of two teams each. Each team plays one team from each of the other four pools. Not perfect, as the weakest teams have a slightly harder schedule and the strongest teams have a slightly easier schedule, but it's pretty close. For example, let A1 be the top team, A2 the second-ranked team, B1 the third-ranked, and so forth. (Apply tie-breakers or random draw for teams with equal records.) Then:

Week 10: A1-B1 B2-A2 C1-E2 D2-C2 D1-E1
Week 11: A1-C2 D1-A2 B1-C1 E1-B2 E2-D2
Week 12: D2-A1 A2-C1 E2-B1 B2-D1 C2-E1
Week 13: E1-A1 A2-E2 B1-D2 C2-B2 C1-D1
posted by DevilsAdvocate at 12:22 PM on November 4, 2014 [1 favorite]


DevilsAdvocate's idea sounds similar to the way that a Swiss System Tournament works.
posted by thelonius at 12:39 PM on November 4, 2014


No, it's actually pretty much the opposite of a Swiss System. The Swiss System, in later rounds, pairs strong players against other strong players, and weak players against other weak players only, which is what tonycpsu is explicitly not looking for. Also, in the Swiss System, pairings for a round depend on the results of all previous rounds (e.g., the Week 13 pairings would take the results of Weeks 1-12 into account, so you couldn't even do the Week 13 pairings until the Week 12 results were in).
posted by DevilsAdvocate at 1:06 PM on November 4, 2014 [1 favorite]


DevilsAdvocate's solution looks like a pretty good one to me.

Meanwhile, here's a quick note about why one obvious approach won't work. Suppose we wanted to divide the 10 teams into the top 5 and the bottom 5 as the "strong" and "weak" teams and in the remaining 4 weeks we want each team to face two teams of the same strength (strong vs. strong or weak vs. weak) and two teams of the opposite strength (strong vs. weak). A simple count shows that you're going to need 10 strong vs. strong match-ups. However, with only 4 weeks remaining, that means at least one week is going to see at least 3 strong vs. strong match-ups which is impossible with only 5 strong teams.
posted by mhum at 1:12 PM on November 4, 2014 [1 favorite]


Response by poster: Yeah, using five pools rather than two isn't something I'd thought of, but does provide a pretty decent approximation of balance. Using the matchups DevilsAdvocate suggested, the average opponents' power ranking (1 being the strongest, 10 being the weakest) for each team would be:
Team     Opp. Power
1               6.5
2               6.5
3               6.0
4               6.0
5               5.5
6               5.5
7               5.5
8               5.0
9               4.5
10              4.5
I don't mind teams that did better in the round-robin having a bit of an easier go, and using the five pools idea as a starting point, I can probably juggle things to get more equal balance.

I'd still be interested in finding a more general purpose algorithm, but it sounds like that might be a heavier lift, and this is just a fantasy league, after all.
posted by tonycpsu at 2:00 PM on November 4, 2014


Best answer: Suppose we wanted to divide the 10 teams into the top 5 and the bottom 5 as the "strong" and "weak" teams and in the remaining 4 weeks we want each team to face two teams of the same strength (strong vs. strong or weak vs. weak) and two teams of the opposite strength (strong vs. weak). A simple count shows that you're going to need 10 strong vs. strong match-ups

Nope, you only need 5 strong vs. strong match-ups. Each of 5 strong teams plays 2 games against other strong teams for 10 teams*games, but since each game involves 2 teams it only takes 5 strong-strong games to accomplish that.

In fact, here's a schedule that does exactly that (teams now A1-A5 and B1-B5):
Week 10: A1-A2 A3-A4 A5-B2 B5-B1 B3-B4
Week 11: A5-A1 A2-B5 A3-B4 A4-B3 B1-B2
Week 12: A1-B1 A2-A3 A4-A5 B2-B3 B4-B5
Week 13: B4-A1 B3-A2 B2-A3 B1-A4 B5-A5

I actually like this better than my previous solution; this is now "perfectly balanced," at least according to tonycpsu's average opponents' power metric. Although to accomplish this some teams face very extreme opposition (teams A2 and B4 each face two of the top three teams, and also two of the bottom three teams) while others face all-middling opposition (teams A4 and B2 do not have to play any of the top two or bottom two teams).
posted by DevilsAdvocate at 2:17 PM on November 4, 2014


DevilsAdvocate: "Nope, you only need 5 strong vs. strong match-ups."

D'oh! Forgot to divide by two. Very sloppy mistake on my part.
posted by mhum at 3:13 PM on November 4, 2014


« Older C'mon, get happy   |   A year to prepare Newer »
This thread is closed to new comments.