the school course timetabling problem or how the messiness of real life can obscure a nice model

53
Problem or 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

Upload: marc

Post on 13-Jan-2016

15 views

Category:

Documents


0 download

DESCRIPTION

The School Course Timetabling Problem or 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. First Some Terminology. Session Subject Content, Year Level, Capacity, No. Classes, No. Lessons - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

The School Course Timetabling Problem

or

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

Page 2: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

First 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

Page 3: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Problem 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)

Page 4: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Problem 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)

Page 5: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocking 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.

Page 6: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocking Example:

Hist

Chem

Mat 3

Mat 2

Mat 1

Phys Eng 2

Eng 3

Geog

Cook

Art

Eng 1

Lit

PhilPsyc

Bio

Page 7: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocking Example:

Hist

Chem

Mat 3

Mat 2

Mat 1

Phys Eng 2

Eng 3

Geog

Cook

Art

Eng 1

Lit

PhilPsyc

Bio

Hist Mat 3 LitBlock 1

Page 8: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocking Example:

Hist

Chem

Mat 3

Mat 2

Mat 1

Phys Eng 2

Eng 3

Geog

Cook

Art

Eng 1

Lit

PhilPsyc

Bio

Hist Mat 3

Mat 1 Eng 2 Cook Art

LitBlock 1

Block 2

Page 9: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocking Example:

Hist

Chem

Mat 3

Mat 2

Mat 1

Phys Eng 2

Eng 3

Geog

Cook

Art

Eng 1

Lit

PhilPsyc

Bio

Hist Mat 3

Mat 2

Mat 1

Phys

Eng 2 Cook Art

Lit

Phil

Block 1

Block 2

Block 3

Page 10: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocking Example:

Hist

Chem

Mat 3

Mat 2

Mat 1

Phys Eng 2

Eng 3

Geog

Cook

Art

Eng 1

Lit

PhilPsyc

Bio

Hist

Chem

Mat 3

Mat 2

Mat 1

Phys

Eng 2

Geog

Cook Art

Lit

Phil

Bio

Block 1

Block 2

Block 3

Block 4

Page 11: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocking Example:

Hist

Chem

Mat 3

Mat 2

Mat 1

Phys Eng 2

Eng 3

Geog

Cook

Art

Eng 1

Lit

PhilPsyc

Bio

Hist

Chem

Mat 3

Mat 2

Mat 1

Phys

Eng 2

Eng 3

Geog

Cook Art

Eng 1

Lit

Phil

Psyc

Bio

Block 1

Block 2

Block 3

Block 4

Block 5

Page 12: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocking Example:

Hist

Chem

Mat 3

Mat 2

Mat 1

Phys

Eng 2

Eng 3

Geog

Cook Art

Eng 1

Lit

Phil

Psyc

Bio

Block 1

Block 2

Block 3

Block 4

Block 5

Page 13: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocking Example:

Hist

Chem

Mat 3

Mat 2

Mat 1

Phys

Eng 2

Eng 3

Geog

Cook Art

Eng 1

Lit

Phil

Psyc

Bio

Block 1

Block 2

Block 3

Block 4

Block 5

M T W T F

Timetable

Page 14: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocking Example:

Hist

Chem

Mat 3

Mat 2

Mat 1

Phys

Eng 2

Eng 3

Geog

Cook Art

Eng 1

Lit

Phil

Psyc

Bio

Block 1

Block 2

Block 3

Block 4

Block 5

Page 15: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocking Example:

Hist

Chem

Mat 3

Mat 2

Mat 1

Phys

Eng 2

Eng 3

Geog

Cook Art

Eng 1

Lit

Phil

Psyc

Bio

Block 1

Block 2

Block 3

Block 4

Block 5

Lit

Mat

Phys

Chem

Eng

Student 25

Page 16: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Advantages and Disadvantages

+ Allows some information from timetabling to be used in student allocation

+ Greatly reduced search space– Problem becomes difficult across year

levels– Doesn’t work if teacher’s have significant

time restrictions

Page 17: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

PCTP 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)

Page 18: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Pure 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

Page 19: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Innovations in Our Model

• Students with the same set of subjects (program) are combined

• CBPP is solved in one step

Page 20: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Pure 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

Page 21: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Pure Blocking Model

• Subject Network Model:

1 2 3 4 5 6

A B C D E FSubjects

Blocks

G H I J K L

Page 22: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Pure Blocking Model

• Subject Network Model:

A B C D E FSubjects

Blocks

G H I J K L

3

1

1 4 1 1 6 1 2 1 3 1 1 2

1 2 3 4 5 6

No. Classes

Page 23: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Pure Blocking Model

• Network Models for each discrete program and teacher.

• For example: program 7 taken by 4 students:

1 2 3 4 5 6

A B C D E FSubjects

Blocks

Page 24: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Pure Blocking Model

• Network Models for each discrete program and teacher.

• For example: program 7 taken by 4 students:

1 2 3 4 5 6

A B C D E FSubjects

Blocks

44

4 22

2

13

11

Total capacity for each Subject-Block combination dependent on Subject-Block allocation

4

4 4 4 4 4 4

4 4 4 4 4

Page 25: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Model 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

Page 26: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Model 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

Page 27: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Model 1

Max p wp + t s b ztsb

Subject to:

bB xsb = s, s S

wp p, p P bB ypsb = wp, s p, p P

sp ypsb = wp, b B, p P

pP ypsb sxsb, b B, s PbB ztsb ts, s t, t T

st ztsb 1, b B, t T

tT zpsb xsb, b B, s T

Page 28: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Model 2

Max p s b ypsb + t s b ztsb

Subject to:

bB xsb = s, s S

bB ypsb p, s p, p P

sp ypsb p, b B, p P

pP ypsb sxsb, b B, s P

bB ztsb ts, s t, t T

st ztsb 1, b B, t T

tT zpsb xsb, b B, s T

Page 29: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Integrality

• 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?

Page 30: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Xavier College Senior School

• 4 Year Levels• 68 Sessions (7 per day)• 922 students• 571 programs• 91 subjects• 242 classes• 112 teachers

Page 31: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Types 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)

Page 32: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Subject 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)

Page 33: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Pure 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

Page 34: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Applying 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

Page 35: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Adapting 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

Page 36: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocks for Year 11 and 12

Block 1

Block 2

Block 3

Block 4

Block 5

Block 6

Year 12 Blocks:

RE

Page 37: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocks for Year 11 and 12

Block 1

Block 2

Block 3

Block 4

Block 5

Block 6

Year 12 Blocks:

Block 1

Year 11 Blocks (Ideal Case):

Block 2

Block 3

Block 4

Block 6

Block 5

RE

RE

Page 38: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocks for Year 11 and 12

Block 1

Block 2

Block 3

Block 4

Block 5

Block 6

Year 12 Blocks:

Block 1

Year 11 Blocks (Real case):

Block 2

Block 3

Block 4

Bl 5 Block 6Bl 5

R.E.

R.E.

RE

Page 39: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocks for Year 11 and 12

A B C D E H

Year 12 Blocks:

Year 11 Blocks (Real case):

A B C D E J

G

I

F

K

Dummy subjects for year 12 added to blocks F, G, I, JDummy 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

Page 40: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Years 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

Page 41: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Year 9 and 10 Blocking Scheme

Block 1

Block 2

Block 3

Block 2

Year 10 Blocks:

Block 1

Block 3

Year 9 Blocks:

Page 42: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Overlap Areas

Block 1

Block 2

Block 3

Block 4

Block 5

Block 6

Year 11 and 12 Blocks:

Block 1

Block 2

Block 3

Block 4

Bl 5 Block 6Bl 5

R.E.

R.E.Overlap Areas:

1 2 3 4 5 876

RE

9 10

Overlap variables specify the number of sessions each lower year block has in common with each

overlap area

Page 43: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Blocks for Year 9 and 10

Block 1

Block 2

Block 3

Block 4

Block 5

Block 6

Year 11 and 12 Blocks:

Block 1

Block 2

Block 3

Block 4

Bl 5 Block 6Bl 5

R.E.

R.E.Year 10:Maths Sci 1 Sci 2El1 El2 El3

Year 9:Maths

1Maths

2El1 El3El

22

RE

Page 44: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Results 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

Page 45: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

But we are only half done ….

• Need to allocate blocks to sessions• First construct new overlap areas:

New Overlap Areas (15):

Page 46: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Allocate overlap areas to sessions

• One idea for BTP is to allocate overlap areas to sessions:

Page 47: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Model

• 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

Page 48: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Model

Max aA oO xoa

aA xoa o , o O

oO xoa 1 , a A

aA 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

Page 49: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

But 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

Page 50: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Model

• 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

Page 51: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

Model

Max aA cC xca

aA 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

Page 52: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

And 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.

Page 53: The School Course Timetabling Problem or How the Messiness of Real Life Can Obscure a Nice Model

The 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