LeMIE350F - NYU Stern

Lecture 17:
Introduction to Timetabling
© J. Christopher Beck 2005
1
Outline

Introduction to Timetabling


UC Berkeley Classroom Assignment
Reservations without Slack



Example 9.2.1
IP formulation
Algorithm 9.2.2
© J. Christopher Beck 2005
2
Classroom
Timetabling

UC Berkeley



30,000 students, 80 depts, 4000 classes,
250 rooms
3 schedulers and 1 supervisor
For each section of each course, the
departments supply
Estimated enrollment
 Requested meeting time
 Beck
Special
requirements (e.g., A/V equipment)3
© J. Christopher
2005

Develop an Objective

Some obvious components

One class at a time in a given room, for a
given prof, for a given student



Usually minimize the number of students who
can’t take the courses they want
Room should be big enough
Special equipment should be present
© J. Christopher Beck 2005
4
Develop an Objective

Some non-obvious components





Profs want rooms close to their offices
Students want consecutive classes to be
close together
Profs get one day with no classes
(Departments want classes in rooms they
“own”)
(Everyone wants no classes on Friday)
© J. Christopher Beck 2005
5
Develop an Objective

How do you balance the
components?


Is a room within 100 m of a
prof’s office worth not being able
to accommodate all students?
“You can have a Friday
afternoon class with A/V
equipment or a Friday morning
class without.”
© J. Christopher Beck 2005
6
Berkeley Guidelines

Standard “calendar”



9-hour day, starting at 8
AM
9 1-hour blocks overlap
with 6 1.5-hour blocks
“Prime time” blocks

One dept can only request
60% of its classes during
prime time
© J. Christopher Beck 2005
7
Berkeley Solution

Large IP




0.5M variables, 30K constraints
Very high penalty for not scheduling a class
at all
Other objective components: distance,
over-utilized facilities, empty seats
Solved heuristically

See Alg. 9.6.1, p 222
© J. Christopher Beck 2005
You should understand
Alg 9.6.1
8
Reservation
Systems


Hotel rooms, car rentals,
airline tickets (and
classroom scheduling)
You want to have the use of a resource
for a given period of time



With slack: pj < dj – rj
Without slack pj = dj – rj
May not be able to schedule all requests
© J. Christopher Beck 2005
9
Objectives




Maximize $$
Maximize resource usage
Minimize number of rejected requests
Minimize $$ of rejected requests
© J. Christopher Beck 2005
10
Objectives
© J. Christopher Beck 2005
11
Reservations without Slack

n activities, m resources

Weight is
often
equivalent
to profit 


All activities and resources are independent
pj = d j – rj
Activities have weight wj or wij
May have resource subsets


You don’t want to rent any car, you want to
rent an SUV
Some substitutability of resources
© J. Christopher Beck 2005
12
Weights Can Get Complicated
(Ex. 9.2.1)



Car rental agency with 4 car types
Customer j wants either a subcompact
or midsize
Customer k wants a subcompact but
there are none left

wij = (qj – ci) * pj


Yield management
qj is the price charged per day to customer j
ci is the cost (to the rental agency) per day of a
car in class i
© J. Christopher Beck 2005
13
IP Formulation



H slots
xij: binary variable that is 1 if activity j is
assigned to resource i
Jt: set of activities that need a resource
in slot t
© J. Christopher Beck 2005
14
IP Formulation
m
maximize
Does not represented
resource subsets!
n
 w x
i 1 j 1
ij ij
m
 xij  1, j  1,..., n
i 1
x
jJ t
ij
Every activity is assigned to
at most one resource
 1, i  1,..., n, t  1,..., H
© J. Christopher Beck 2005
Each resource has
only one activity
per time slot
15
IP Formulation


General problem is hard
Special cases are easy

All activities have duration of 1 –
independent problem for each time slot


See p. 209
All weights are 1, all resources in a single
set, durations are arbitrary

Maximize the number of scheduled activities
© J. Christopher Beck 2005
16
Alg 9.2.2



Order activities in ascending order of
release date
Let J be the set of already scheduled
activities
Step 1: J = {}, j = 1
© J. Christopher Beck 2005
17
Alg 9.2.2



Step 2: If a resource is available at rj,
assign it to activity j, add activity j to J,
and goto 4.
Step 3: Let j* in J with max. completion
time. If Cj > Cj*, then don’t schedule j.
Else replace j* with j in J
Step 4: If j = n, STOP. Else j = j +1 and
goto Step 2.
© J. Christopher Beck 2005
18
Exercise 9.1:
3 resources, 0 slack



Use Alg 9.2.2 to find max # activities
Find schedule that maximizes sum of
durations of activities scheduled
What is the minimum number of
resources needed to do all activities?
activities
rj
dj
© J. Christopher Beck 2005
1
2
8
2
7
8
3
5
9
4
2
4
5
1
4
6 7 8
0 4 8
3 10 10
9 10
0 0
1 3
19