EURO Conference 2015 - Automated Timetabling

41
EURO2015

Transcript of EURO Conference 2015 - Automated Timetabling

Page 1: EURO Conference 2015 - Automated Timetabling

EURO2015

Page 2: EURO Conference 2015 - Automated Timetabling

Automated TimetablingA case study with hybrid algorithms and GPU

parallelization

Dionisio Chiuratto [email protected]

Aeronautics Institute of Technology (ITA) – BrazilFounder/CEO J!Quant – Brazil

Page 3: EURO Conference 2015 - Automated Timetabling

The problem

• Build a timetable– i.e. all tuples (professor, timeslot, room, subject,

students) such as hard constraints are satisfied and soft constraints are solved to (near)optimality

• Many variations depending on what is being solved– Post-Enrollment Class-Course– Faculty Assignment– Classroom assignment– …

Page 4: EURO Conference 2015 - Automated Timetabling

My problem

• Design a system to be general enough to solve other instances of the problem without parameter fine-tuning.

• Timetabling-as-a-Service

• Create a product

Page 5: EURO Conference 2015 - Automated Timetabling

Food for thought

• BARDADYM(1996)

• Critic/Myth: “My students can design a timetabling program within a month.”

• Ans: “Let them try.”• 20 years ago – still trueBARDADYM, V. Computer-aided school and university timetabling: The new wave.In: BURKE, E.; ROSS, P. (Ed.). Practice and Theory of Automated Timetabling. Springer Berlin Heidelberg, 1996, (Lecture Notes in Computer Science, v. 1153). p. 22–45.

Page 6: EURO Conference 2015 - Automated Timetabling

Case Study I

• Brazilian Basic Education School• Build a full working optimized timetable to be used in the

next academic period• Some data:– 8 academic periods (years)– 147 subjects– 44 teachers– 222 teacher-subject relationships

Page 7: EURO Conference 2015 - Automated Timetabling

Case Study I

teacher

subject

timeslot

class

if it is assigned

otherwise

Page 8: EURO Conference 2015 - Automated Timetabling

Case Study I

Some subjects needed to be assigned on adjacent slots

Page 9: EURO Conference 2015 - Automated Timetabling

Case Study ISome subjects needed to be assigned on the same

timeslots across different classes

Page 10: EURO Conference 2015 - Automated Timetabling

Case Study ITeachers’ availability constraint (red is unavailable)

Page 11: EURO Conference 2015 - Automated Timetabling

Case Study I

Objective Funcion: Weighted Penalties + Aux Variables

Page 12: EURO Conference 2015 - Automated Timetabling

Case Study IAlso...

• Some subjects had fixed timeslots• No clashes of any kind were allowed• There were classes with multiple teachers (up to 4)• The same teacher needed to be assigned to every class of the same

subject of a course• There were different timeslots (overleaping) for different courses

Page 13: EURO Conference 2015 - Automated Timetabling

Case Study IObj: Minimize Teachers’ “Lecture Windows”

Page 14: EURO Conference 2015 - Automated Timetabling

How to solve it?Mathematical Programming

• It just works (doesn’t it?)• The modelling forces you to not cheat (overfitting)• You know where you are (bounds, performance, ...)• You have (very good) support from vendors• Easier to separate between modelling and computational issues

• Hard (complex) to model some constraints/objectives• Inflexible – it’s hard to make small changes• The solver vendor will be your partner forever ($$$)• Doesn’t scale well to bigger problems ($$$)• Hard to integrate with other problems

CONS

PROS

Page 15: EURO Conference 2015 - Automated Timetabling

How to solve it?Metaheuristics

• Easy(er) to code• Flexible as your coding skills allows• Guidelines provided by frameworks• (might) Scale well• Open source, you are free to make changes

• No support. You are alone with your own code forever• (very) Easy to overfit a problems with “ifs” in the code• Easy to have a poor model that does not generalize• Hard to assess performance and make comparissons• No guarantees, no bounds, nothing...• Are you certain that you’re doing better than simple

hillclimbing/local search/blind random search/greedy ?

CONS

PROS

Page 16: EURO Conference 2015 - Automated Timetabling

Hybridize!Let’s have the best of both worlds!

Page 17: EURO Conference 2015 - Automated Timetabling

Hybridize!But...

How to hybridize effectively?

Page 18: EURO Conference 2015 - Automated Timetabling

Hybridize!Worst-case (sometimes appealing) scenario

GA-SA-IP approach with LS, enhanced by a Master-Slave-ACO-Optimized-ANN

There is a large chance you don’t know anymore what the original problem was.

Page 19: EURO Conference 2015 - Automated Timetabling

Hybridize!One way to avoid that:

What is your hybridization intended to achieve?

Does the new hybrid solution performs better as a problem solver or just exploits problem-specific features?

Page 20: EURO Conference 2015 - Automated Timetabling

Hybridization applied in TimetablingTwo main reasons:

Simulated Annealing was inneficient to converge (taking too long)Results were poor - even with greedy initialization.

Careful study showed that:

Too many iterations spent on already-known impossible swaps

Very large neighbourhood good solutions often missed because obvious-but-specific moves never occurred by chance

Page 21: EURO Conference 2015 - Automated Timetabling

I.P

Greedy

S.A.

L.S.

Initialization

Solution Proposed

Page 22: EURO Conference 2015 - Automated Timetabling

Solution Proposed

• S.A. did a good job on the overall optimization scheme but was failing at easier subproblems

• Integer programming was applied as a first pre-processor– Set boundary conditions in which the greedy initialization and sa-permutations

(swaps) would apply– Check overall model feasibility– Very simple model – solved by open source solver (GLPK) in ms– Act as an automatic domain knowledge discovery for every timetable problem– Output: How many assignments of each subject (MAX) might be placed in

each day, for each academic class (year)

Page 23: EURO Conference 2015 - Automated Timetabling

Solution Proposed

classes

subjects

days

Weekly assignment need for subject d

Main decision variable – how many assignments for each day, class and subject were allowed

(pre-processed) – Max assignment feasible for class t, day k, subject d

Page 24: EURO Conference 2015 - Automated Timetabling

Solution Proposed

Constraints:

Objective:

Page 25: EURO Conference 2015 - Automated Timetabling

Solution Proposed

• S.A. did a good job on the overall optimization scheme but was failing at making the “right” swaps

• Local Search applied as a neighbourhood enhancer– “Specialized” swaps intended to exploit common root causes of poor solutions– E.g. try to swap the class assignment without teacher assigned to it– E.g. try to swap the other class, that has the missing teacher assigned to it and

is in the conflicting timeslot

Page 26: EURO Conference 2015 - Automated Timetabling

Case Study I - Results

Page 27: EURO Conference 2015 - Automated Timetabling

Case Study I - Results

• All hard constraints satisfied• Multiple feasible timetables produced• 40% reduction in teachers’ lecture-windows

Page 28: EURO Conference 2015 - Automated Timetabling

Case Study II

• One of the world’s largest university (publicly traded)• Faculty Assignment – classes pre-scheduled• Large instance• Some data:– 23 undergraduate courses– 218 teachers– 485 subjects– 1.197 classes

Page 29: EURO Conference 2015 - Automated Timetabling

Case Study II

• Very large neighbourhood• Serial approaches were all very time-consuming• Answer: parallelization

Page 30: EURO Conference 2015 - Automated Timetabling

GPGPU

• General Purpose Graphics Processing Unit• Using GPUs to make computations (NVIDIA CUDA /

OpenCL)• GPU recently found it’s “killer application” – Deep learning• But it is also capable of changing the way we do

optimization (Deep Optimization?)

Page 31: EURO Conference 2015 - Automated Timetabling

GPU-Parallelism

• Massively parallel Simulated Annealing• 64x1024 annealing chains on a single consumer GPU

(3GB)• Solution-space exploration greatly expanded• Special data structures needed• Scalable to multiple GPUs and multiple nodes

Page 32: EURO Conference 2015 - Automated Timetabling

GPU-Challenges

• Need to efficiently generate random numbers (offset from an unique seed)

• To communicate (within chains) or not?• Memory use• Data structures !!!– Sparse incompatibility matrix – efficient creation and update

routine– Evaluation function speedup

Page 33: EURO Conference 2015 - Automated Timetabling

GPU-Challenges

• Remember: (simple) computations are cheap and memory traffic is expensive and limited

• Motto: keep the GPU busy• Know when to stop – gpu low-level optimizations might be

an infinite path with exponential code complexity

Page 34: EURO Conference 2015 - Automated Timetabling

Model

Teacher p is assigned to class t, timeslot h

Use dummy teacher id to denote the null case;

Page 35: EURO Conference 2015 - Automated Timetabling

Model

Simple objetive funcion – penalizing missing teachers and total cost

Page 36: EURO Conference 2015 - Automated Timetabling

ModelConstraints:

• Follow the pre-scheduled classes• Respect teacher-subject relationships• Respect teacher availability• Minimize 0-credit assignments (firing...)• Respect 20% margin of workload change across semesters (!)• Respect titles (MSc, PhD, etc)

Page 37: EURO Conference 2015 - Automated Timetabling

ModelTournament-wise communication between annealing chains

Must find good “depth” and “breadth”

Page 38: EURO Conference 2015 - Automated Timetabling

Case Study II - Results

Number of classes without teachers assigned

Page 39: EURO Conference 2015 - Automated Timetabling

Case Study II - Results

Average overall academic credit cost

Page 40: EURO Conference 2015 - Automated Timetabling

Case Study II - Results

Page 41: EURO Conference 2015 - Automated Timetabling

Thanks!Questions?

E-mail: [email protected]