Slides from my talk at the 27th European Conference on Operational Research (EURO 2015): Automated Timetabling, a case study with hybrid algorithms and GPU parallelization.
2. Automated Timetabling
A case study with hybrid algorithms and GPU
parallelization
Dionisio Chiuratto Agourakis
dionisio@jquant.com.br
Aeronautics Institute of Technology (ITA) – Brazil
Founder/CEO J!Quant – Brazil
3. 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
– …
4. 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
5. 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 true
BARDADYM, 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.
6. 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
12. Case Study I
Also...
• 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
14. 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
15. 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
18. 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.
19. 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?
20. Hybridization applied in Timetabling
Two 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
22. 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)
23. 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
25. 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
27. Case Study I - Results
• All hard constraints satisfied
• Multiple feasible timetables produced
• 40% reduction in teachers’ lecture-windows
28. 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
29. Case Study II
• Very large neighbourhood
• Serial approaches were all very time-consuming
• Answer: parallelization
30. 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?)
31. 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
32. 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
33. 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
34. Model
Teacher p is assigned to class t, timeslot h
Use dummy teacher id to denote the null case;