Title: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model
1The School Course Timetabling Problemor How
the Messiness of Real Life Can Obscure a Nice
Model
- Presentation by Liam Merlot
- joint work with Natashia Boland,
- Barry Hughes and Peter Stuckey
2First Some Terminology
- Session
- Subject
- Content, Year Level, Capacity, No. Classes, No.
Lessons - Class
- Union of Subject, Teacher and Students
- Lesson
- Each individual meeting of a class
3Problem Description (1)
- Create a timetable for a School
- find sessions for all lessons of all classes of
all subjects - Initial data
- student subject choices
- teacher subject allocations
- all information about subjects (capacity, no.
classes, no. lessons)
4Problem Description (2)
- Some subjects have multiple classes
- What English class is Fred in?
- Who is teaching Fred English?
- 2 Sub-Problems
- The Student Population Problem
- The Class Timetabling Problem
- Both problems combined The Population and Class
Timetabling Problem (PCTP)
5Blocking Decomposition
- Class Blocking and Population Problem (CBPP)
- Students are allocated to classes
- Classes are allocated to blocks
- Block Timetabling Problem (BTP)
- Blocks allocated to sessions
- What are Blocks?
- Sets of classes for which all lessons will be
allocated to the same set of sessions in the
timetable.
6Blocking Example
7Blocking Example
Block 1
Hist
Eng 1
Hist
Mat 3
Lit
Phys
Eng 2
Mat 1
Eng 3
Mat 2
Geog
Mat 3
Cook
Chem
Art
Lit
Bio
Phil
Psyc
8Blocking Example
Block 1
Hist
Eng 1
Hist
Mat 3
Lit
Phys
Eng 2
Block 2
Mat 1
Eng 3
Mat 1
Eng 2
Cook
Art
Mat 2
Geog
Mat 3
Cook
Chem
Art
Lit
Bio
Phil
Psyc
9Blocking Example
Block 1
Hist
Eng 1
Hist
Mat 3
Lit
Phys
Eng 2
Block 2
Mat 1
Eng 3
Mat 1
Eng 2
Cook
Art
Mat 2
Geog
Block 3
Mat 3
Cook
Mat 2
Phys
Phil
Chem
Art
Lit
Bio
Phil
Psyc
10Blocking Example
Block 1
Hist
Eng 1
Hist
Mat 3
Lit
Phys
Eng 2
Block 2
Mat 1
Eng 3
Mat 1
Eng 2
Cook
Art
Mat 2
Geog
Block 3
Mat 3
Cook
Mat 2
Phys
Phil
Chem
Art
Block 4
Lit
Bio
Chem
Geog
Bio
Phil
Psyc
11Blocking Example
Block 1
Hist
Eng 1
Hist
Mat 3
Lit
Phys
Eng 2
Block 2
Mat 1
Eng 3
Mat 1
Eng 2
Cook
Art
Mat 2
Geog
Block 3
Mat 3
Cook
Mat 2
Phys
Phil
Chem
Art
Block 4
Lit
Bio
Chem
Geog
Bio
Phil
Psyc
Block 5
Eng 3
Eng 1
Psyc
12Blocking Example
Block 1
Hist
Mat 3
Lit
Block 2
Mat 1
Eng 2
Cook
Art
Block 3
Mat 2
Phys
Phil
Block 4
Chem
Geog
Bio
Block 5
Eng 3
Eng 1
Psyc
13Blocking Example
Block 1
Timetable
Hist
Mat 3
Lit
Block 2
Mat 1
Eng 2
Cook
Art
Block 3
Mat 2
Phys
Phil
Block 4
Chem
Geog
Bio
Block 5
Eng 3
Eng 1
Psyc
14Blocking Example
Block 1
Hist
Mat 3
Lit
Block 2
Mat 1
Eng 2
Cook
Art
Block 3
Mat 2
Phys
Phil
Block 4
Chem
Geog
Bio
Block 5
Eng 3
Eng 1
Psyc
15Blocking Example
Student 25
Block 1
Hist
Mat 3
Lit
Lit
Block 2
Mat 1
Eng 2
Cook
Art
Mat
Block 3
Mat 2
Phys
Phil
Phys
Block 4
Chem
Geog
Bio
Chem
Block 5
Eng 3
Eng 1
Psyc
Eng
16Advantages and Disadvantages
- Allows some information from timetabling to be
used in student allocation - Greatly reduced search space
- Problem becomes difficult across year levels
- Doesnt work if teachers have significant time
restrictions
17PCTP Literature
- Very few papers
- School problems normally solved with blocking
(CBPP, BTP) - University problems normally a different
decomposition (CTP, SPP) - CBPP is further decomposed (non-linear model)
18Pure Blocking
- All students do the same number of subjects
- All subjects require the same number of lessons
(classes can be allocated to any block) - All classes must be blocked
- The number of blocks is equal to the number of
subjects that each student is taking
19Innovations in Our Model
- Students with the same set of subjects (program)
are combined - CBPP is solved in one step
20Pure Blocking Model
- Multiple related Network Models
- One for the Subjects
- One for each discrete student program
- One for each teacher
- Classes of subjects are allocated to blocks
- Students and teachers are allocated to take
subjects in blocks
21Pure Blocking Model
A
B
C
D
E
F
Subjects
G
H
I
J
K
L
Blocks
22Pure Blocking Model
No. Classes
1
4
1
1
6
1
2
1
3
1
1
2
A
B
C
D
E
F
Subjects
G
H
I
J
K
L
Blocks
23Pure Blocking Model
- Network Models for each discrete program and
teacher. - For example program 7 taken by 4 students
A
B
C
D
E
F
Subjects
Blocks
24Pure Blocking Model
- Network Models for each discrete program and
teacher. - For example program 7 taken by 4 students
4
4
4
4
4
4
A
B
C
D
E
F
Subjects
Blocks
4
4
4
4
4
4
Total capacity for each Subject-Block combination
dependent on Subject-Block allocation
25Model Data
- p ? P - discrete student programs
- t ? T - teachers
- s ? S - subjects
- b ? B - blocks
- ?s - number of classes of subject s
- ?s - capacity of each class of subject s
- ?p - number of students taking discrete program p
- ?ts - number of classes of subject s taken by
teacher t
26Model Variables
- xsb -integer variable number of classes of s
allocated to b - wp integer variable number of students taking
p with a full allocation - ypsb - integer variable number of students
studying p allocated to take subject s in block
b - ztsb - binary variable whether teacher t takes
subject s in block b
27Model 1
- Max ??p wp ??t ?s ?b ztsb
- Subject to
- ?b?B xsb ?s, ? s ? S
- wp ? ?p, ? p ? P
?b?B ypsb wp, ? s ? p, ? p ? P ?s?p ypsb wp,
? b ? B, ? p ? P ?p?P ypsb ? ?sxsb, ? b ? B, ? s
? P
?b?B ztsb ? ?ts, ? s ? t, ? t ? T ?s?t ztsb ? 1,
? b ? B, ? t ? T ?t?T zpsb ? xsb, ? b ? B, ? s ? T
28Model 2
- Max ??p ?s ?b ypsb ??t ?s ?b ztsb
- Subject to
- ?b?B xsb ?s, ? s ? S
- ?b?B ypsb ? ?p, ? s ? p, ? p ? P
- ?s?p ypsb ? ?p, ? b ? B, ? p ? P
- ?p?P ypsb ? ?sxsb, ? b ? B, ? s ? P
- ?b?B ztsb ? ?ts, ? s ? t, ? t ? T
- ?s?t ztsb ? 1, ? b ? B, ? t ? T
- ?t?T zpsb ? xsb, ? b ? B, ? s ? T
29Integrality
- Network (and other) problems often have
integrality property - Student and teacher variables do NOT have the
integrality property (although network-like) - Will this matter?
- Will we be lucky?
30Xavier College Senior School
- 4 Year Levels
- 68 Sessions (7 per day)
- 922 students
- 571 programs
- 91 subjects
- 242 classes
- 112 teachers
31Types of Subject
- Elective
- students choose a specified number with no
restrictions, classes need to be populated, same
number of sessions required - Streamed
- students already allocated to classes, all
lessons of all classes held in same set of
sessions - Core
- students already allocated to classes (same sets
for each subject in each year level)
32Subject Distribution
Year Level Type Subjects
12 Elective 6 Electives (10)
Streamed R.E. (4)
11 Elective 6 Electives (10)
Streamed R.E. (8)
10 Elective 3 Electives (6)
Streamed Mathematics (10), Science (8)
Core English (9), R.E. (6), 2 Humanities (6 each), P.E. Practical (4), P.E. Theory (1)
9 Elective 3 Electives (6)
Streamed Mathematics (10)
Core English (9), R.E. (8), Science (8), Geography (5), History (5), P.E. Prac(4), P.E. Theory (1)
33Pure Blocking (times/nodes)
M1 M1(ni) M2 M2 (ni)
9 (sec) 0.38 0.04 0.53 0.12
9(nodes) 10 0 10 0
10 (s) 1.01 0.07 1.99 1.17
10 (n) 30 0 32 20
11 (s) 385 26 680 70
11 (n) 280 90 376 130
12 (s) 90 2.5 71 43
12 (n) 220 0 180 20
34Applying Pure Blocking
- Works well for the elective subjects for each
year level - Problems arise over multiple year levels
- Subjects do not all require same number of lessons
35Adapting Pure Blocking
- Temporarily ignore core subjects
- One complex blocking scheme for years 11 and 12
- One simple blocking scheme for each of years 9
and 10 - Allow the three blocking schemes to overlap
36Blocks for Year 11 and 12
Year 12 Blocks
Block 1
Block 2
Block 3
Block 4
Block 5
Block 6
37Blocks for Year 11 and 12
Year 12 Blocks
Block 1
Block 2
Block 3
Block 4
Block 5
Block 6
Year 11 Blocks (Ideal Case)
Block 1
Block 2
Block 3
Block 4
Block 6
Block 5
RE
38Blocks for Year 11 and 12
Year 12 Blocks
Block 1
Block 2
Block 3
Block 4
Block 5
Block 6
Year 11 Blocks (Real case)
Block 1
Block 2
Block 3
Block 4
Bl 5
Block 6
R.E.
Bl 5
R.E.
39Blocks for Year 11 and 12
Year 12 Blocks
A
B
C
D
E
H
Year 11 Blocks (Real case)
Dummy subjects for year 12 added to blocks F, G,
I, J Dummy subjects for year 11 added to blocks
H, K, (E, F), (G, I)
Constraints added to prevent teachers from
taking classes in blocks which overlap
40Years 9 and 10
- Streamed subjects allocated in year 11 and 12
blocking scheme - Year 10 Maths one block
- Year 10 Science two blocks
- Year 9 Maths two blocks
- Elective subjects
- 3 block model for each year level
- Variables determine overlap between blocking
scheme
41Year 9 and 10 Blocking Scheme
Year 10 Blocks
Block 1
Block 2
Block 3
Year 9 Blocks
Block 2
Block 1
Block 3
42Overlap Areas
Year 11 and 12 Blocks
Block 1
Block 2
Block 3
Block 4
Block 5
Block 6
Block 1
Block 2
Block 3
Block 4
Bl 5
Block 6
R.E.
Bl 5
R.E.
Overlap Areas
1
2
3
4
5
8
7
6
9
1 0
Overlap variables specify the number of sessions
each lower year block has in common with
each overlap area
43Blocks for Year 9 and 10
Year 11 and 12 Blocks
Block 1
Block 2
Block 3
Block 4
Block 5
Block 6
Block 1
Block 2
Block 3
Block 4
Bl 5
Block 6
R.E.
Bl 5
R.E.
Year 10
Maths
Sci 1
Sci 2
El1
El2
El3
Year 9
Maths 1
Maths 2
El1
El3
El 2
2
44Results for Blocking
- Years 9 to 12 from a Victorian secondary school
- 922 students, 571 programs
- 91 subjects, 242 classes
- 112 teachers
- Modeled in AMPL
- Solves in 24 hours (8 hours with non-integer
variables) - Takes 2 months to solve by hand currently
45But we are only half done .
- Need to allocate blocks to sessions
- First construct new overlap areas
46Allocate overlap areas to sessions
- One idea for BTP is to allocate overlap areas to
sessions
47Model
- a ? A - sessions
- o ? O - overlap areas
- b ? B - blocks
- xoa - binary variable if overlap area o allocated
to session a - xba - binary variable if block b is allocated to
session a - ?o - number of lessons required by overlap area o
- ?b - number of lessons required by block b
- Fo - set of blocks in overlap area o
48Model
- Max ?a?A ?o?O xoa
- ?a?A xoa ? ?o , ? o ? O
- ?o?O xoa ? 1 , ? a ? A
- ?a?A xba ? ?b , ? b ? B
- xoa ? xba , ? b ? Fo, ? o ? O
- xba variables allow the model to keep track of
blocks to allow constraints for doubles, weekly
balance, etc. - Solutions produced in about 10 minutes
49But what about the Core Subjects?
- A third timetabling problem is solved after the
other two problems have been solved. - Core classes are allocated to sessions which are
not used by Year 9 or 10 blocked subjects - Clashing constraints are required
- Data 130 classes for 474 students
50Model
- a ? A - sessions
- c ? C - classes of core subjects
- b ? B - blocks
- xca - binary variable if class c is allocated to
session a - ?c - number of lessons required by class c
- ?c1c2 - binary parameter, 1 if classes c1, c2
have a student or teacher in common - ?bc - binary parameter, 1 if class c and block b
have a student or teacher in common - ?ba - binary parameter, 1 if block b was
allocated to session a
51Model
- Max ?a?A ?c?C xca
- ?a?A xca ? ?c , ? c ? C
- xc1a xc2a ? 2 - ?c1c2 , ? c1, c2 ? C
- xca ? 2 - ?bc - ?ba, ? c ? C, ? b ? B
- Solutions produced in under an hour
52And Year 10 Science?
- The subject that just refused to be timetabled
nicely - 8 Lessons - too small for upper block, too large
for lower block - Allocated to upper year blocks in CBPP, but
requires sessions from this block to be used in
core class timetabling - Need to unallocate after BTP and re-allocate in
core class timetabling problem.
53The Final Timetable
- Timetables for the school can be produced in
about 25 hours - Timetables took the entire summer break to
produce using a program that merely checked
feasibility - Achievements
- A model that solves the CBPP in one step
- New variables combining students with the same
program of subjects