Scheduling Double Round-Robin Tournaments with Divisional Play

Scheduling Double Round-Robin
Tournaments with Divisional Play: New
Results
Jeffrey Larson, KTH
Mikael Johansson, KTH
Mats Carlsson, SICS
June 14, 2016
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
1/33
Mats Carlsson
Elitserien—Top Level Swedish Handball League
I
I
2 divisions of 7 teams each
between 27 and 38 games required
I
I
I
7-team RRTs in parallel
14-team RRT
mirrored 14-team RRT
I
maximally fair home-away patterns required
I
reusable template traditionally desired
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
2/33
Mats Carlsson
Template
Team names to be substituted for team numbers
SRRT
team
1
2
3
4
5
6
7
8
9
10
11
12
13
14
z
6
7
6
5
4
3
2
6
14
13
12
11
10
9
2
1
7
6
6
4
3
9
8
14
13
6
11
10
3
6
1
7
6
5
4
10
6
8
14
13
12
11
4
3
2
1
7
6
5
11
10
9
8
14
6
12
5
4
6
2
1
7
6
12
11
6
9
8
14
13
DRRT, mirrored
DRRT
}|
6
5
4
3
2
1
6
13
12
11
10
9
8
6
{
z
7
6
5
6
3
2
1
14
13
12
6
10
9
8
8
9
10
11
63
12
14
1
2
3
4
6
5
7
}|
9
7
8
10
14
13
2
3
1
4
12
11
6
5
5
12
7
6
1
4
3
9
8
14
13
2
11
10
6
10
9
5
4
1
8
7
3
2
14
13
12
11
7
6
5
13
3
2
1
11
10
9
8
14
4
12
10
5
11
12
2
8
9
6
7
1
3
4
14
13
11
4
13
2
8
14
10
5
12
7
1
9
3
6
12
11
6
14
7
3
5
10
13
8
2
1
9
4
13
14
12
8
9
7
6
4
5
11
10
3
1
2
4
13
14
1
10
9
11
12
6
5
7
8
2
3
14
3
2
9
11
10
12
13
4
6
5
7
8
1
2
1
4
3
6
5
13
14
11
12
9
10
7
8
{
z
3
8
1
7
12
11
4
2
14
13
6
5
10
9
3
8
1
7
12
11
4
2
14
13
6
5
10
9
}|
2
1
4
3
6
5
13
14
11
12
9
10
7
8
14
3
2
9
11
10
12
13
4
6
5
7
8
1
4
13
14
1
10
9
11
12
6
5
7
8
2
3
13
14
12
8
9
7
6
4
5
11
10
3
1
2
12
11
6
14
7
3
5
10
13
8
2
1
9
4
11
4
13
2
8
14
10
5
12
7
1
9
3
6
{
10
5
11
12
2
8
9
6
7
1
3
4
14
13
7
6
5
13
3
2
1
11
10
9
8
14
4
12
6
10
9
5
4
1
8
7
3
2
14
13
12
11
5
12
7
6
1
4
3
9
8
14
13
2
11
10
9
7
8
10
14
13
2
3
1
4
12
11
6
5
8
9
10
11
13
12
14
1
2
3
4
6
5
7
BYE 6
AWAY 2, 4, 6, . . .
I
23,846,816 feasible templates.
HOME 3, 5, 7, . . .
I
12 (+ 12) breaks.
break 13 3, . . .
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
3/33
Mats Carlsson
Structural Constraints
1. Tournament structure:
I
I
I
7-team RRTs in parallel
14-team RRT
mirrored 14-team RRT (disregarded from now on)
2. There must be a minimum (12) total number of breaks.
3. Each team has one bye during the season to occur during
the divisional RRT.
4. #home and #away played so far differ by at most one,
∀t, ∀p
5. Any pair of teams must have consecutive games occur at
different venues.
6. Both divisions must have 3 pairs of complementary
schedules.
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
4/33
Mats Carlsson
Home/Away Pattern (HAP) Set
I
I
I
I
A common first step in template construction
#H must equal #A in every period
#H and #A played so far differ by at most one, ∀t, ∀p
not all HAP sets are schedulable
Team 1
Team 2
Team 3
Team 4
Team 5
Team 6
Team 7
Team 8
A
A
A
A
H
H
H
H
H
H
H
A
A
A
A
H
A
A
H
H
A
H
H
A
H
A
A
A
H
H
A
H
A
H
A
H
A
A
H
A
3
7
3
7
3
7
3
7
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
5/33
Mats Carlsson
HAP Sets for Elitserien
BAHAHAHAH
HBAHAHAHA
AHBAHAHAH
HAHBAHAHA
AHAHBAHAH
HAHAHBAHA
AHAHAHBAH
BHAHAHAHA
ABHAHAHAH
HABHAHAHA
AHABHAHAH
HAHABHAHA
AHAHABHAH
HAHAHABHA
A
A
H
H
A
H
A
H
A
H
A
H
A
H
H
H
A
A
H
A
H
A
H
A
H
A
H
A
A
A
H
A
H
H
A
H
A
H
A
H
A
H
H
H
A
H
A
A
H
A
H
A
H
A
H
A
A
A
H
A
H
A
H
H
A
H
A
H
A
H
H
H
A
H
A
H
A
A
H
A
H
A
H
A
A
A
H
A
H
A
H
A
H
H
A
H
A
H
H
H
A
H
A
H
A
H
A
A
H
A
H
A
A
A
H
A
H
A
H
A
H
A
H
H
A
H
H
H
A
H
A
H
A
H
A
H
A
A
H
A
A
A
H
A
H
A
H
A
H
A
H
A
H
H
I
HAP sets are unique
up to permutation of
the rows
I
104 feasible HAP
sets exist
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
6/33
Mats Carlsson
Consequences of Unique HAP Sets
I
For both divisions, one bye occurs in each period 1..7.
I
Breaks can only occur in period 9, 11, . . . , 19.
I
In the complementary schedules, breaks must be aligned.
I
Two schedules can only be complementary if the byes
occur in adjacent periods.
I
If the byes are on the diagonal, the complementary
schedules must include teams 2, 4 and 6 of the given
division.
I
If the byes are on the diagonal, the first row of both SRRTs
is complementary to the first column.
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
7/33
Mats Carlsson
Constraint Model
Problem Variables
HAP:

 −14.. − 1, if t plays away in p
0, if t has a bye in p
T [t, p] ∈

1..14, if t plays at home in p
H[t, p] ∈ {A, B, H}
Opponent:
O[t, p] ∈ 1..14
Template:
Break Period: B[t] ∈ 0..0 ∪ 9..19
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
8/33
Mats Carlsson
Constraint Model
Structural Constraints: Channeling

 −O[t, p], if H[t, p] = A
O[t, p],
if H[t, p] = H , ∀t, ∀p.
T [t, p] =

0,
if H[t, p] = B
P
B[t] = p∈9..19 p × (H[t, p] = H[t, p + 1]), ∀t.
O[t, p] = t ⇔ H[t, p] = B, ∀t, ∀p.
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
9/33
Mats Carlsson
Constraint Model
Structural Constraints: HAPs
R EGULAR([H[t, p] | p ∈ 1..20], e), ∀t.
where e is:
A
H
B
B
A
H
A
H
A
H
B
B
B
H
A
H
A
B
H
B
A
B
A
B
B
A
H
H
A
H
A
H
H
A
B
H
A
H
A
B
H
A
A
H
A
B
H
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
10/33
Mats Carlsson
Constraint Model
Structural Constraints: Matching Teams
O[O[t, p], p] = t, ∀t, ∀p,
i.e.,
I NVERSE([O[t, p] | t ∈ 1..14], [O[t, p] | t ∈ 1..14]), ∀p.
N.B. consistent with modeling trick O[t, p] = t ⇔ H[t, p] = B
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
11/33
Mats Carlsson
Constraint Model
Structural Constraints: All Teams Meet All Teams
A LL D IFF([O[t, p] | p ∈ 1..7]), ∀t.
A LL D IFF([O[t, p] | p ∈ 8..20]), ∀t.
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
12/33
Mats Carlsson
Constraint Model
Structural Constraints: Matching Home and Away
H[t, p] = A ⇐⇒ H[O[t, p], p] = H, ∀t, ∀p.
H[t, p] = B ⇐⇒ H[O[t, p], p] = B, ∀t, ∀p.
H[t, p] = H ⇐⇒ H[O[t, p], p] = A, ∀t, ∀p.
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
13/33
Mats Carlsson
Constraint Model
Structural Constraints: Alternating Venues
“Any pair of teams must have consecutive games occur at
different venues.”
A LL D IFF([T [t, p] | p ∈ 1..20]), ∀t
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
14/33
Mats Carlsson
Constraint Model
Structural Constraints: Complementary Schedules
“Both divisions must have 3 pairs of complementary schedules.”
Notation
implied
z }| {
i ⊕ j ⇔ B[i] = B[j] ∧(H[i, p] 6= H[j, p], ∀p ∈ 1..20).
∃{i, j, k , l, m, n} ⊂ 1..7 such that (i ⊕ j) ∧ (k ⊕ l) ∧ (m ⊕ n).
∃{i, j, k , l, m, n} ⊂ 8..14 such that (i ⊕ j) ∧ (k ⊕ l) ∧ (m ⊕ n).
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
15/33
Mats Carlsson
Constraint Model
Breaking Symmetries
Home-Away:
H[1, 2] = H ∧ H[2, 1] = A.
North-South:
[B[t] | t ∈ 1..7] ≤lex [B[t] | t ∈ 8..14].
Team Symmetry: we can fix the bye position, subsuming (2)
Division North
H[t, t] = B, ∀t ∈ 1..7.
Division South
similar
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
16/33
Mats Carlsson
Seasonal Constraints
On team names, not team numbers
1. Divisions
2. “Team x and y should be
assigned complementary
schedules.” (Shared
arena)
3. “Team x should play team
y in period z.” (Derby)
4. “Team x should play away
in period z.” (Venue
unavailablilty)
North
Alingsås
Eskilstuna
Hammarby
Redbergslid
Rimbo
Skövde
Sävehof
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
17/33
South
Halmstad
Kristianstad
Lugi
Lund
Malmö
Ystad
Önnered
Mats Carlsson
Seasonal Constraints
Two Modeling Approaches
Free Team Assignment (add level of indirection)
I
Let R[t] be the team number assigned to team name t:
1..7, if n plays in Division North
R[t] ∈
8..14, if n plays in Division South
A LL D IFF(R)
I
Substitute R[t] for t in constraint model.
I
Preserves symmetries.
Fixed Team Assignment
I
Preassign team numbers to team names.
I
Kills symmetries.
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
18/33
Mats Carlsson
Missing Propagation
How to Detect It
Look at the first failure!
B
H
A
H
A
H
A
B
A
H
A
H
A
H
hap[127] = 1
hap[128] = 1
hap[130] = 1
A
B
H
A
H
A
H
H
B
A
H
A
H
A
H
A
B
H
A
H
A
A
H
B
A
H
A
H
A
H
A
B
H
A
H
H
A
H
B
A
H
A
H
A
H
A
B
H
A
A
H
A
H
B
A
H
A
H
A
H
A
B
H
H
A
H
A
H
B
A
H
A
H
A
H
A
B
A
H
A
H
A
H
B
A
H
A
H
A
H
A
H
A
H
A
H
A
H
H
A
H
A
H
A
H
A
H
A
H
A
H
A
A
A
H
A
.
.
.
.
.
.
.
.
.
.
H
H
A
.
.
.
.
.
.
.
.
.
.
.
.
A
H
A
H
A
H
A
H
A
H
A
H
A
.
H
A
H
A
H
A
H
A
H
A
H
A
H
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Contradicts implied constraint:
X
(B[t] = i) = 2, ∀i ∈ {0, 9, 11, 13, 15, 17, 19}
t∈1..14
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
19/33
Mats Carlsson
Missing Propagation
Channeling to B[t] is Too Weak
Replace:
B[t] =
X
p × (H[t, p] = H[t, p + 1]), ∀t
p∈9..19
by something stronger:
B[t] = p ⇐⇒ H[t, p] = H[t, p+1], ∀t, ∀p ∈ {9, 11, 13, 15, 17, 19}
and try again.
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
20/33
Mats Carlsson
Missing Propagation
Next Try
B
H
A
H
A
H
A
B
A
H
A
H
A
H
A
B
H
A
H
A
H
H
B
A
H
A
H
A
H
A
B
H
A
H
A
A
H
B
A
H
A
H
A
H
A
B
H
A
H
H
A
H
B
A
H
A
H
A
H
A
B
H
A
A
H
A
H
B
A
H
A
H
A
H
A
B
H
H
A
H
A
H
B
A
H
A
H
A
H
A
B
A
H
A
H
A
H
B
A
H
A
H
A
H
A
H
A
H
A
H
A
H
H
A
H
A
H
A
H
A
H
A
H
A
H
A
A
A
H
H
A
H
A
H
A
H
A
H
A
H
H
H
A
A
H
A
H
A
H
A
H
A
H
A
A
A
H
A
H
H
A
H
A
H
A
H
A
H
H
H
A
H
A
A
H
A
H
A
H
A
H
A
A
A
H
A
H
A
H
H
A
H
A
H
A
H
H
H
A
H
A
H
A
A
H
A
H
A
H
A
A
A
H
A
H
A
H
A
A
H
A
.
.
.
H
H
A
H
A
H
A
H
H
A
.
.
.
.
A
A
H
A
H
A
H
A
.
.
.
.
.
.
H
H
A
H
A
H
A
H
.
.
.
.
.
.
A
A
H
A
H
A
H
A
.
.
.
.
.
.
This violates:
I
If the byes are on the diagonal, the complementary
schedules must include teams 2, 4 and 6 of the given
division.
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
21/33
Mats Carlsson
Missing Propagation
How to Fix It
Replace:
B[t] = p ⇐⇒ H[t, p] = H[t, p+1], ∀t, ∀p ∈ {9, 11, 13, 15, 17, 19}
by something even stronger:
B[t] > 0 =⇒ B[t] = B[t + 1], ∀t ∈ {1, 8}
B[t] > 0 =⇒ B[t] = B[t − 1], ∀t ∈ {7, 14}
B[t] > 0 =⇒ B[t] = B[t − 1] ∨ B[t] = B[t + 1], ∀t ∈ 2..6 ∪ 9..13
Now, no mistakes are made during HAP construction.
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
22/33
Mats Carlsson
Presolving
Tabling HAPs
I
I
R EGULAR recognizes 98 strings—we can have a table
instead.
Also, for each string s, thanks to symmetry breaking:
I
I
I
we know in which row s can occur; this is uniquely decided
by the prefix of s; and
we know where any break occurs; this is a simple function
of the suffix of s.
In fact, we have a bijection:
(string) (row, break)
TABLE([H[t, 1], . . . , H[t, 20], t, B[t]], {[string, row, break]}), ∀t
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
23/33
Mats Carlsson
Propagation from Cost Function
Original Formulation
N[t, p] =
cost =
X
1 , if team t prefers not to play at home during period p
0 , otherwise,
N[t, p] × (H[R[t], p] = H)+
t∈1..14,
p∈1..20
X
N[t, p] × (H[R[t], 41 − p] = A)
t∈1..14,
p∈21..33
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
24/33
Mats Carlsson
Propagation from Cost Function
Better Formulation
cost =
cost =
X
r ∈1..14
X
f (B[r ], r , R −1 [r ])
f (B[R[t]], R[t], t)
t∈1..14
where f (b, r , t) is precomputed
as a table for given break b,
row r , and team t.
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
25/33
Mats Carlsson
Experimental Setup
20 Instances with realistic seasonal constraints
I
Partitioning of teams into divisions
I
One given pair of complementary schedules per division
I
One 3-team intra-division derby set
I
One 3-team and one 4-team inter-division derby set
I
t prefers to not play at home during period p with 5%
probability
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
26/33
Mats Carlsson
Experimental Setup
Model Variants and Solver
NOSYM essential constraints, fixed team numbers, no
symmetry breaking
SYM essential constraints, free team numbers,
symmetry breaking
STR SYM with strengthened constraints
TAB STR with tabled HAPs and cost function
MiniZinc 2.0, Chuffed lazy clause generation (LCG) solver, free
search.
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
27/33
Mats Carlsson
Model Performance
Chuffed
20
# solved
15
NOSYM
SYM
STR
TAB
10
5
0
10−1
100
101
timeout limit (s)
102
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
28/33
Mats Carlsson
Model Performance
Gecode: fzn-gecode
20
# solved
15
NOSYM
SYM
STR
TAB
10
5
0
10−2 10−1 100 101 102 103 104 105
timeout limit (s)
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
29/33
Mats Carlsson
Model Performance
Gecode: fzn-gecode -f -restart luby -nogoods true
20
# solved
15
NOSYM
SYM
STR
TAB
10
5
0
10−1 100
101 102 103
timeout limit (s)
104
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
30/33
Mats Carlsson
Results
Scaling Up
20
# solved
15
7+7
8+8
9+9
10+10
10
5
0
100
101
102
timeout limit (s)
103
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
31/33
Mats Carlsson
How It All Started
Staged Approach [Johansson & Larson 2014]
I
enumerate all 23,846,816 templates, using necessary
conditions for feasibility
I
for each template, let IP find best team/row assignment
I
.1s per template is very optimistic
I
≥ 1 month to find best solution
Integrated Approach
I
CP model integrating all constraints
I
best solution found in a couple of seconds
I
first model could be improved a lot
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
32/33
Mats Carlsson
The Craft of Model Improvement
I
Symmetry breaking
I
Implied constraints
I
Discovering missing propagation by understanding failures
I
Precomputing TABLE constraints
I
Propagation from cost function
I
LCG plus free search: superior performance, robust w.r.t.
model
Scheduling Double Round-Robin Tournaments with Divisional Play: New Results
SweConsNet
June 14, 2016
33/33
Mats Carlsson