© J. Christopher Beck Lecture 21: IP and CP Models for Sports Scheduling
© J. Christopher Beck Outline Single Round Robin IP Model 3-Step Algorithm Again IP Models for the 3-Step Algorithm CP Models for the 3-Step Algorithm
© J. Christopher Beck Single Round Robin Tournament Assume n teams and that n is even Every team plays every other team It is possible to construct a schedule with n-1 slots each with n/2 games
© J. Christopher Beck IP for Simple Single RR Each team plays one game in each slot Each team plays each other team exactly once Pure IP model x ijt = 1 iff team i plays at home against team j in slot t
© J. Christopher Beck Recall the (More Complex) Problem Double RR tournament Minimize “breaks” Two consecutive Home or Away games A variety of other constraints and preferences “rival” pairings 2 Home or 1 Home, 1 Bye in first 5 weeks
© J. Christopher Beck Step Approach Step 1: HAPs Find at least n HAPs HAP – string of H, A, B Find a set of n consistent HAPs Step 2: Assign games to HAPs Step 3: Assign teams to HAPs
© J. Christopher Beck ACC Scheduling Solution Find feasible patterns Find pattern sets Assign games Assign teams to patterns Choose final schedule 38 patterns of length pattern sets 826 timetables17 schedules Step 1 Step 2Step 3 Figure 10.3
© J. Christopher Beck Step 1: HAPs Create a consistent set of HAPs What’s wrong with these HAPs? slot12345 Team aHAHAA Team bHBAHA Team cAABHH Team dAAHAH Team eBHABA Teams: UofT, Western, Queens, McGill, Waterloo
© J. Christopher Beck Step 1: HAPs List preferred HAPs (and a few others) E.g., All HAPs with 1 or 0 breaks Can you pick a consistent set of 5 HAPs? HAHAB HAHBA HABAH HBHAH BAHAH AHAHB AHABH AHBHA ABAHA BHAHA
© J. Christopher Beck Step 2: Assign Games You’ve got a set of consistent HAPs Match the Hs with the As slot12345 Team aHAHAB Team bHBAHA Team cAABHH Team dBHHAA Team eAHABH Teams: UofT, Western, Queens, McGill, Waterloo
© J. Christopher Beck Step 2: Assign Games You’ve got a set of consistent HAPs Match the Hs with the As slot12345 Team aHAHAB Team bHBAHA Team cAABHH Team dBHHAA Team eAHABH Teams: UofT, Western, Queens, McGill, Waterloo
© J. Christopher Beck Step 2: IP Model S is a set of n consistent HAPs T is the set of slots/rounds x ijt = 1 iff the team with pattern i plays in round t at the site of the team associated with pattern j Only defined if the i th pattern has a A is slot t and the j th pattern has an H F is the set of such triples (i, j, t)
© J. Christopher Beck Step 2: IP Model One game between team with pattern i and team with pattern j Team with pattern i plays at most one game is slot t
© J. Christopher Beck Step 3: Assign Teams to HAPs Map teams to patterns to maximize preferences slot12345 Team aHAHAB Team bHBAHA Team cAABHH Team dBHHAA Team eAHABH UofT Western Queens McGill Waterloo
© J. Christopher Beck Step 3: IP Model y ik = 1 iff team i is assigned to HAP k c ik = cost of team assignment y ik minimize One team assigned to each pattern One pattern assigned to each team
© J. Christopher Beck Constraint Programming Models Double RR with odd n Break is now 3 consecutive Hs or As No breaks are allowed H or B in at least 2 of first 4 rounds No team can be away in both of the final 2 games
© J. Christopher Beck Step 1: CP Model 1 h t, a t, b t – 0,1 variables denoting home, away, bye for a given team in slot t No breaks No team away for both of final 2 games H or B in at least 2 of first 4 slots
© J. Christopher Beck A Different CP Model: The Distribute Constraint distribute(card, value, base) card – array of variables value – array of values base – array of variables value[i] is taken by card[i] elements of base distribute([{0,1}, {1,3}], [0, 1], [w 1, …, w n ]) cardvaluebase
© J. Christopher Beck Step 1: CP Model 2 g t є {H,A,B} – variable denoting home, away, bye for a given team in slot t No breaks No team away for both of final 2 games H or B in at least 2 of first 4 slots distribute([{0,1,2}, {0,1,2}], [H, A], [g t, g t+1, g t+2 ]) t = 1, …, 2n-2 (g 2n ≠ A) OR (g 2n-1 ≠ A) distribute([{0,1,2}], [A], [g 1, g 2, g 3, g 4 ])
© J. Christopher Beck Step 1: CP Model 2 Some additional constraints 2 Bs, Equal # As & Hs distribute([{n-1}, {n-1}, {2}], [H, A, B], [g 1, …, g 2n ]) 1 Bs, Equal # As & Hs distribute([{(n-1)/2}, {(n-1)/2}, {1}], [H, A, B], [t 1, …, t n ]) Let t 1, … t n, be the HAP for one slot (across all teams)
© J. Christopher Beck Step 1: CP Model With either of these models, you can then easily generate all possible HAPs You could also add a cost function to generate only “good” HAPs
© J. Christopher Beck Step 2: Assign Games Given a set of consistent HAPs Devise a CP model to assign games The one in the book is overly complicated! slot Team aHAHABHAHAB Team bHBAHAHBAHA Team cAABHHAABHH Team dBHHAABHHAA Team eAHABHAHABH