Tutorial on Sports Scheduling
Download
Report
Transcript Tutorial on Sports Scheduling
Tutorial on Scheduling
Sports Tournaments
Michael Trick
Tepper School of Business
Carnegie Mellon University
CORS/INFORMS Banff
May, 2004
Goals
Outline main approaches to creating
tournament schedules
Combinatorial Design
Integer Programming
Constraint Programming
Give a selection of open problems
Identify promising new research directions
Primarily based on survey paper by Kelly
Easton, George Nemhauser and me.
Outline
Round robin scheduling
Round robin schedule with venues
(home/away)
Combinatorial Design
Integer and Constraint Programming
Multiphase Approach
Schedule then Break
Traveling Tournament Problem
Sample Leagues
Why Sports Scheduling???
Big Business!
US National TV pays $500 million / year for baseball
College basketball conferences get up to $30 million
Manchester United has (had) a market cap of £400
million
No rights holder wants to pay those sums and then
get a “bad” schedule.
Huge variety of problem types
Small instances are difficult
Strong break between easy/hard (for all algorithms)
Significant theoretical background
CP and IP differ in modeling
CP has clean models with [1..n] variables
IP uses 0-1 variables reasonably naturally
Practical interest in instances at the easy/hard interface
Sample Problem
10 teams: 1..10, play each other once;
5 games per time slot (all teams
play every slot), 9 slots
How hard can this be?
Slot 1: 1 vs 2, 3 vs 4, 5 vs 6, 7 vs 8, 9 vs 10
Slot 2: 1 vs 4, 2 vs 3, 5 vs 8, 6 vs 9, 7 vs 10
Slot 3: 1 vs 6, 2 vs 5, 3 vs 10, 4 vs 7, 9 vs 8
Slot 4: 1 vs 8, 2 vs 7, 3 vs 6, 4 vs 9, 5 vs 10
Slot 5: 1 vs 10, 2 vs 9, 3 vs 8, 4 vs 5, 6 vs 7
Slot 6: 1 vs 3, 2 vs 4, 5 vs 7, 6 vs 8, …
Uh oh! Stuck with 4 slots to go!
Not convinced?
1
Graph of remaining games
9
3
7
No perfect matching in graph
of remaining games
5
2
10
4
8
6
Every slot is perfect matching
(or 1-factor)
Premature Sets
Example of premature set (Rosa and
Wallis): set of scheduled slots that
cannot be completed to round robin
schedule
Exist for n (or more) slots; do not
exist for ≤ 3 slots (for 2n>6)
Open Problem: What is size of minimum
premature set?
Round Robin Tournaments
2n teams
2n-1 time slots
Every team plays one other team in
every time slot
Every team plays every other team
exactly once during tournament
Existence
Is there a round-robin schedule for
every 2n teams?
Yes [Kirkman 1847 or earlier]
Two constructions
Circle method
Greedy algorithm
Circle Method
Number teams 1..2n
In slot i have
i vs 2n
a vs b for a+b ≡ 2i (mod 2n-1)
Sample (2n=10)
Slot 1:
Slot 2:
Slot 3:
Slot 4:
Slot 5:
Slot 6:
Slot 7:
Slot 8:
Slot 9:
10 vs 1
10 vs 2
10 vs 3
10 vs 4
10 vs 5
10 vs 6
10 vs 7
10 vs 8
10 vs 9
2 vs 9
3 vs 1
4 vs 2
5 vs 3
6 vs 4
7 vs 5
8 vs 6
9 vs 7
1 vs 8
3 vs 8
4 vs 9
5 vs 1
6 vs 2
7 vs 3
8 vs 4
9 vs 5
1 vs 6
2 vs 7
4 vs 7
5 vs 8
6 vs 9
7 vs 1
8 vs 2
9 vs 3
1 vs 4
2 vs 5
3 vs 6
5 vs 6
6 vs 7
7 vs 8
8 vs 9
9 vs 1
1 vs 2
2 vs 3
3 vs 4
4 vs 5
Why Circle Method?
1
9
2
8
3
10
7
4
6
5
Slot 1
Slot 2
Continue rotating
to get all the
slots. Key is
initial set of games
have all
differences
Greedy Method
Order matches (i,j) in lexicographic order
(i,j) before (i,k) if j<k
(i,j before (k,l) if i<k
Order slots in cyclic order
Assign (1,2) to slot 1
Repeatedly assign each game to either
current slot or next slot it can feasibly go
into
Example (n=10)
1 vs 2
1 vs 3
1 vs 4
1 vs 5
1 vs 6
1 vs 7
1 vs 8
1 vs 9
1 vs 10
3 vs 9
2 vs 10
2 vs 3
2 vs 4
2 vs 5
2 vs 6
2 vs 7
2 vs 8
2 vs 9
4 vs 8
4 vs 9
3 vs 10
3 vs 4
3 vs 5
3 vs 6
3 vs 7
3 vs 8
4 vs 5
4 vs 6
4 vs 7
4 vs 10
etc.
Equivalence
Anderson (1991) showed equivalence
(rounds in different order)
Other non-equivalent schedules
possible
Lots of choices even among one of
these: permute slots, team numbers
Adding Requirements
Generally lots of other things you
would like in a schedule
Carry-over effects
Venues
Fixed/prohibited games
Objective function
Some of this can still be done directly
Carry Over Effects
Slot 1:
Slot 2:
Slot 3:
Slot 4:
Slot 5:
Slot 6:
Slot 7:
Slot 8:
Slot 9:
10 vs 1
10 vs 2
10 vs 3
10 vs 4
10 vs 5
10 vs 6
10 vs 7
10 vs 8
10 vs 9
2 vs 9
3 vs 1
4 vs 2
5 vs 3
6 vs 4
7 vs 5
8 vs 6
9 vs 7
1 vs 8
3 vs 8 4 vs 7 5 vs 6
4 almost always plays
4 vs 9 5 vs 8 6 vs 7
against team who just
5 vs 1played
6 vs29 7 vs 8
6 vs 2 7 vs 1 8 vs 9
7 vs 3 8 vs 2 9 vs 1
8 vs 4 9 vs 3 1 vs 2
9 vs 5 1 vs 4 2 vs 3
1 vs 6 2 vs 5 3 vs 4
2 vs 7 3 vs 6 4 vs 5
Balancing Carryover
In example: 4 has carry over effect
from 2 almost exclusively
Possible to “spread” carryover effect
out (no more than 1 time from any
other team)?
Solution
Yes, Russell (1980), if 2n = 2n
Slot 1: 1 vs 4
Slot 2: 1 vs 5
Slot 3: 1 vs 6
Slot 4: 1 vs 7
Slot 5: 1 vs 8
Slot 6: 1 vs 2
Slot 7: 1 vs 3
2 vs 5
2 vs 4
2 vs 8
2 vs 3
2 vs 6
3 vs 7
2 vs 7
3 vs 8
3 vs 6
3 vs 5
4 vs 6
3 vs 4
4 vs 5
4 vs 8
6 vs 7
7 vs 8
4 vs 7
5 vs 8
5 vs 7
6 vs 8
5 vs 6
What about for other 2n?
Combinatorial design does not (seem to)
help
Construction of Russell involves Galois
Fields (finite fields): might be generalized
(though GF(n) does not exist for all n)
Seems unlikely that balanced schedule
exists, but “best” balance is unknown
(measured by sum of squared carryover
values)
Current State
2n Value
6 60 (optimal Henz, Mueller, Thiel)
8 56 (optimal Russell)
10 122 (Trick)
12 188 (HMT and van Brandenburg)
14 260 (Russell)
16 240 (optimal, Russell)
18 428 (Russell)
20 520 (Russell) Open Problem: Improve
on the carryover values
Additional/Alternative
Requirements
Gets messier and messier as more
requirements get added.
Quickly get into NP-hard problems
Example: Fix all but 3 slots. Completion
problem is NP-complete (Easton, 2003)
Need to use algorithms like integer
programming/constraint programming
Studied in HMT (2004) and Trick (2003)
Basic Formulation
Two fundamental constraints:
In every time slot, the games correspond to a onefactor (or matching)
For every team, its opponents over all slots are alldifferent
ATL NYM PHI MON
--PHI
NYM
MON
--MON
ATL
PHI
All-different
--ATL
MON
NYM
--NYM
PHI
ATL
atl
phi
nym mon
One Slide on Formulating in
IP
Variables can be either continuous or
integer valued (often 0-1 variables)
Constraints are linear inequalities of these
variables
3x1+2x2+12x3 ≤ 13
x2-x3 ≤ 0
etc.
Objective is linear function of the variables
12x1+2x2-3x3…
Integer Program
Int n= …
Range Teams [0..n-1];
Range Slots [1..n-1];
Range Binary 0..1;
Var Binary plays[Teams, Teams, Slots]; // plays[i,j,t] is 1 if
// i plays j in slot t
Solve {
forall (i in Teams, t in Slots) plays[i,i,t] = 0;
//one-factor
forall (ordered i,j in Teams, t in Slots)
plays[i,j,t] = plays[j,i,t];
forall (i in Teams, t in Slots)
sum (j in Teams) plays[i,j,t] = 1;
// all-different
forall (i,j in Teams: i<>j) sum(t in Slots) plays[i,j,t] = 1;
Two Slide Introduction to
Constraint Programming
Variables begin with a feasible domain
(generally not 0,1)
Constraints reduce the feasible domains
through domain reduction
Much cleverness in defining interesting
constraints and doing domain reduction
After domain reduction
If domain becomes empty: infeasible
If domains are singletons: solution
Otherwise, branch
Two Slide Example of
Constraint Programming
Variables x,y,z. D(x) = {1,2}, D(y)={2,3},
D(z) = {3}.
Constraint: all-different(x,y,z)
Effects: D(y) becomes {2} which forces
D(x)={1}
This domain reduction gives unique values
to all variables
Constraint Program
Int n = …;
Range Teams [0..n-1];
Range Slots [1..n-1];
Var Teams opponent[Teams,Slots];
Solve {
forall (i in Teams, t in Slots) opponent[i,t]<>i;
//one-factor
forall (t in Slots)
one-factor(all (i in Teams) opponent[i,t]);
//all-different
forall (i in Teams)
all-different(all (t in Slots) opponent[i,t]);
Constraint Program (cont)
But how to implement one-factor and
all-different?
all-different is a well studied
constraint with multiple propagation
algorithms
HMT show that all-different
propagation should be as strong as possible
(expending extra work to reduce domains is
worth it)
Work done by Régin on how to do
propagation for this.
Three Models for 1-Factor
opponent[opponent[i,t],t] = i
Forall (t in Slots)
alldifferent(all i in Teams)
opponent[i,t]
Full propagation (uses nonbipartite
matching theorems)
Illustration of Propagation
Given domains
D(1)={2,4} D(2)={1,3} D(3)={2} D(4)={1,3}
can represent as a graph
1
4
2
i
j
j is in i‘s domain
3
opponent[opponent[i,t],t] = i removes any arc without
corresponding reverse arc
All-different removes any arc not part of any union of node-disjoint
cycles that covers all nodes
One-factor removes any arc not part of any union of node-disjoint
even cycles that covers all nodes
Propagation
i
j
j is in i‘s domain
Original
opponent[
opponent[i,t],t]
=i
All-different
One-factor
Strength of Propagations
HMT showed increasing strength and
proposed algorithm for one-factor
Not stronger, though, if domains are
bipartite: partition nodes into X and Y
such that domain of anything in X is in
Y and anyting in Y is in X.
Bipartite domains occur in
Bipartite tournaments
If home/away pattern is fixed.
Improving IP Formulation
Possible to add “odd-cut” constraints.
forall (t in Slots, S Teams: |S| odd)
sum (i in S, j notin S) plays[i,j,t] >= 1
Used to remove linear relaxations like:
Value .5 on every edge
Satisfies linear relax.
S
Can be found by minimum cut calculation (Gomory-Hu)
Interesting Parallels
Odd-cuts are useful exactly when the
HMT method is useful: nonbipartite
domains.
Use same underlying theory:
nonbipartite matching theory of
Edmonds, etc.
Comparing IP and CP
Decision on IP vs CP is primarily
computational
What instances to solve? Just finding
unconstrained Round Robin is not
interesting
Possible changes
Fixed/Prohibited games
Objective function
Test 1: Prohibited games
Series of prohibitions of the form
(k,i,j): in slot k, i cannot be at j
Now problem is NP-complete
(Schaerf)
Easy to add to both CP and IP
HMT: give test instances (divide their
time by 4.5 to normalize machine
speeds)
Test 1: Prohibited Games:
Results
Problem
Size All-different Basic-IP
F
T
N
T
HMT
F
T
S_10_no
10
23
0.02 4
0.10 6
0.01
S_12_no
12
24
0.07 0
0.14 25
0.17
S_14_no
14
135
0.23 50
1.02 69
0.56
S_16_no
16
79
0.30 0
0.39 86
1.19
S_18_no
18
43
0.32 0
0.42 30
0.50
S_20_no
20
696
5.47 0
0.78 254
5.11
Test 2: Recognizing
Premature Sets
Take n=10, 14, 18 etc. Divide into 2 divisions (0..4
and 5..9). Play between divisions for n/2-1 slots.
Note since odd number of teams in division,
divisions cannot play solely within themselves
Slot
--1
2
3
4
5
6
0 1 2 3 4 5
-----------------3 4 5 0 1 2
4 5 3 2 0 1
5 3 4 1 2 0
INFEASIBLE! Why?
Test 2: Premature Sets
Size
10
14
18
22
Only fix 2 games in slot n/2: result still
infeasible but hard to prove:
All_differen
t
F
T
116 0.20
-------------
Basic-IP
Strong-IP
N
393
-------
N
0
0
0
0
T
0.19
-------
T
0.20
0.34
0.32
0.38
Test 2: Premature Sets
Not unfair test: realistic set of
requirements on a schedule
Points to possibility of improved cuts/
constraints
Test 3: Maximum Value
Schedules
There may be a value for having i play
at j in slot k: predicted ratings,
attendance, team preferences, etc.
Objective could be to maximize total
value (other possibilities: maximize
minimum value, etc.)
Easy to modify CP and IP
Test 3: Maximum Value
Schedules: Results
Size
Results are clear (despite efforts to
find good search strategy for CP):
All_different
Basic_IP
F
T
N
T
8
84962
5.33
0
0.03
10
---
---
66
0.29
12
---
---
402
3.59
14
---
---
7263
133.03
IP vs CP
IP and CP are competitive
Neither are truly satisfying at this
stage
Open Problem: Fully test Strong IP formulation
Open Problem: Devise constraints/cuts that go
beyond the one-factor and all-different individual
constraints
Venues
Key issue in many leagues:
Every team has a home stadium (court,
arena, etc.).
Each game is either a “home” game or an
“away” game for a team
Issues with
Consecutive home/away
Subgroup counts (so many home in first half,
so many home on weekends, etc.)
Handling venues
Combinatorial Approaches
Direct addition to integer program
and/or constraint program
Multiple phase approaches
Home/away pattern generation
Schedule then break approaches
Combinatorial Approaches
De Werra did much work on this in
1980s
Generally concerned with minimizing
breaks
Ideal home/away pattern in HAHAH..
(or reverse)
HH or AA is called a break
Basic insights
Teams need breaks! No more than 1
each of
HAHAHAH…
AHAHAHA…
So, for round robin of 2n teams, there
are at least 2n-2 breaks
Minimum Break Schedule
De Werra (1981) suggests following
for canonical schedule:
In slot i, i plays 2n, other games are of
form i+k vs i-k for all values of k
Let i+k play at i-k if k is odd
Let i-k play at i+k if k is even
Let i play at 2n if i is even
Let 2n play at i if i is odd
Sample
1
2
3
4
5
1
6
@3
5
@1
4
2
5
@6
@4
2
@3
4 breaks: minimal
3
@4
1
6
@5
2
4
3
@5
2
@6
@1
5
@2
4
@1
3
6
6
@1
2
@3
4
@5
Facts about breaks
Occur in pairs
Each team has at most one
2 teams with 0
Pattern: (0,2,0,2) (di = #breaks after slot i)
In general, (…2,2,2…) not possible
(…2,2,0,2,2,…)
Miyashiro, Iwasaki, and Matsui have
necessary condition
Open Problem: Characterize feasible break
patterns for min-break schedules
Other way
Given a round robin schedule, assign
home/away so as to minimize breaks
1
2
3
4
5
1
6
@3
3
@5
5
1
4
2
5
6
@4
4
@2
2
3
3
4
1
@6
6
5
@2
2
4
@3
3
5
2
6
@1
1
5
@2
2
@4
4
1
@3
3
@6
6
9 breaks (but there are better solutions!)
6
@1
1
@2
2
3
@4
4
5
Schedule then break
Given a round-robin schedule, assign
home/away so as to minimize breaks
Régin: Constraint Program (up to 20)
Trick: Integer Program (up to 22)
Elf, Juenger, Rinaldi: Maximum Cut
(up to 26)
Miyashiro and Matsui: polynomial if
2n-2 breaks suffice
Open Problem: Is the Minimum Break
problem NP-complete?
More general venue
constraints
Min-break is not always appropriate
College basketball plays twice per
week, so something like HHAAHH…
is best
Major League Baseball likes things
like HHHAAAHHH…
Additional restrictions like weekend
counts, alternations, etc.
Add to IP and CP
Can modify previous IP and CP
formulations to include home/away
aspects
Add variables to home[i,t] which
equals 1 if i home in time t (and
constraints of the form “if i plays j,
exactly 1 is at home”).
Limits on Consecutive
Home/Away
Constraint Program clear winner:
N
K
Integer
Program
N
T
Constraint
Program
F
T
14
1
2
59.71
312
1.21
14
2
9
70.10
11
0.20
14
3
11
82.34
3
0.18
14
4
20
169.4
2
2
0.19
No Singletons
More interesting to prohibit singletons
(Single home surrounded by Aways or
vice-versa)
Easy to add such constraints:
home[i,t]<=
home[i,t-1]+home[i,t+1];
Test 5: No Singletons:
Results
IP is now much better:
N
K
Integer
Program
N
T
Constraint
Program
F
T
8
3
1516
22.73
---
---
8
4
77
0.92
---
---
10
3
---
---
---
---
10
4
15268
594.70 ---
---
Other approaches
Note problem size, however: even
small problems are getting hard to
solve
Alternative is to have multiple phase
approach
Phase 1: Find HAPs
Find Home/Away pattern, one
sequence per team
1:
2:
3:
Open Problem:
4:
Characterize feasible
5:
H/A patterns
6:
HAHAH
AHAHA
HHAAH
HAHHA
AAHHA
AHAAH
Phase 2. Assign Games
Assign games consistent with HAP
(+ denotes home; - is away)
1: +2 -3 +6 -4 +5
2: -1 +4 -5 +6 -3
3: +6 +1 -4 -5 +2
4: +5 -2 +3 +1 -6
5: -4 -6 +2 +3 -1
6: -3 +5 -1 -2 +4
Phase 3. Assign Teams
Assign teams to entries
F: +E -A +B -D
E: -F +D -C +B
A: +B +F -D -C
D: +C -E +A +F
C: -D -B +E +A
B: -A +C -F -E
+C
-A
+E
-B
-F
+D
Solving Subproblems
Nemhauser and Trick (1998, Scheduling
ACC): IP for phase 1 and 2, complete
enumeration for 3
Henz (2001): CP for all phases: much
faster, particularly relative to complete
enumeration
Lots of other papers in same vein (often in
different orders: Cain, Schreuder, Russell
and Leung, etc.)
Very robust and flexible approach
Final Problem
Combine issues of venue with travel
distance
Traveling Tournament Challenge
Problem
Traveling Tournament
Problem
Given an n by n distance matrix D= [d(i,j)] and an integer k find
a double round robin (every team plays at every other team)
schedule such that:
The total distance traveled by the teams is minimized (teams
are assumed to start at home and must return home at the end
of the tournament), and
No team is away more than k consecutive games, or home
more than k consecutive games.
(For the instances that follow, an additional constraint that if i is at
j in slot t, then j is not at i in t+1.)
Sample Instance
NL6: Six teams from the National League of
(American) Major League Baseball.
Distances:
0 745 665 929 605 521
745
0
80 337 1090 315
665
80
0 380 1020 257
929 337 380
0 1380 408
605 1090 1020 1380
0 1010
521 315 257 408 1010
0
k is 3
Sample Solution
Distance: 23916 (Easton May 7, 1999)
Slot
ATL
NYM
PHI
MON
0
1
2
3
4
5
6
7
8
9
FLA
NYM
PIT
@PHI
@MON
@PIT
PHI
MON
@NYM
@FLA
@PIT
@ATL
@FLA
MON
FLA
@PHI
@MON
PIT
ATL
PHI
@MON
FLA
MON
ATL
@PIT
NYM
@ATL
@FLA
PIT
@NYM
FLA
PHI
@PIT
@PHI
@NYM
ATL
FLA
NYM
@ATL
@FLA
PIT
PIT
@ATL
@PHI
NYM
PIT
@NYM
@MON
@PIT
PHI
MON
ATL
NYM
MON
@ATL
@FLA
PHI
ATL
FLA
@NYM
@PHI
@MON
Simple Problem, yes?
NL12. 12 teams
Feasible Solution: 143655 (Rottembourg and Laburthe May
2001), 138850 (Larichi, Lapierre, and Laporte July 8 2002),
125803 (Cardemil, July 2 2002), 119990 (Dorrepaal July 16,
2002), 119012 (Zhang, August 19 2002), 118955 (Cardemil,
November 1 2002), 114153 (Van Hentenryck January 14, 2003),
113090 (Van Hentenryck February 26, 2003), 112800 (Van
Hentenryck June 26, 2003), 112684 (Langford February 16,
2004), 112549 (Langford February 27, 2004), 112298 (Langford
March 12, 2004), 111248 (Van Hentenryck May 13, 2004).
Lower Bound: 107483 (Waalewign August 2001)
Successful Approaches:
Feasible Solutions
Anagnostopolous, Michel, Van
Hentenryck, and Vergados use
simulated annealing
Hard part is determining
neighborhood structure
Neighborhood
No completely natural neighborhood: most
swapping does not lead to feasible double
round robin schedule
Swap venues for a pair of games
Swap 2 slots of games
Swap schedule of 2 teams
Partially swap 2 slots (swap 1 game then
minimum number to keep feasible)
Partially swap 2 teams (swap games in
single slot then minimum number to keep
feasible)
Successful Approaches:
Lower Bound
Not much better than sum of minimum
travel for each team (solvable by
series of small IPs or CPs)
Successful Approaches:
Optimality
Easton uses parallel implementations
with CP generating good schedules
for teams and IPs putting schedules
together (parallel branch and price)
Able to prove optimality of 8 teams
Open Problem: Find optimal solutions to
the Traveling Tournament Problem for 2n=10
Practical Implementations
Trick and Nemhauser, then Easton,
Nemhauser and Trick on scheduling ACC
Basketball
Scheuder and Dutch Football
Trick then Easton, Nemhauser, and Trick on
MLB Baseball
Lustig and the NFL
Lots of others (and would be even more if
people would listen more to us!)
What is size of minimum premature set?
Fully test Strong IP
formulation
Improve on the
carryover values
Solve Real
Scheduling
Problems!
Devise constraints/cuts that go beyond the
one-factor and all-different individual constraints
Characterize feasible break
patterns for min-break schedules
Open Problem:
Characterize
feasible
Open Problem: Is the Minimum Break
H/A patterns
problem NP-complete?
Open Problem: Find optimal solutions to
the Traveling Tournament Problem for 2n=10
Further Information
Easton, Nemhauser and Trick survey
in Handbook of Scheduling
http://mat.gsia.cmu.edu/TOURN
This talk (or corrected version!) at
http://mat.gsia.cmu.edu/sports after
conference