🧩 Constraint Solving POTD:Problem of the Day: Course Timetabling #41010
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Constraint Solving — Problem of the Day. A newer discussion is available at Discussion #41216. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem Statement
Course timetabling is the task of assigning lectures, tutorials, and exams to time slots and rooms while satisfying hard constraints (must be met) and soft constraints (should be met when possible).
Small Instance: Three Courses, Four Time Slots
Hard constraints:
Soft constraints:
Task: Find an assignment of courses to (time slot, room) pairs satisfying all hard constraints and minimizing violations of soft constraints.
Why It Matters
Educational institutions depend on timetabling to serve thousands of students and faculty each term. A poor schedule creates cascading effects: student conflicts, instructor overload, unused rooms, and student complaints.
Exam scheduling at universities must respect individual student exam timetables (no student takes two exams simultaneously) while minimizing back-to-back exams across days.
Workforce management in airlines, hospitals, and call centers relies on similar principles: staff skill assignments, shift timing, coverage requirements, and personal preferences all interact in complex ways.
Modeling Approaches
Approach 1: Constraint Programming (CP)
Decision variables:
schedule[c, i, t, r]: Boolean indicating whether coursec, lecturei, is in time slott, roomrtime[c, i, t]: Boolean indicating whether lectureiof coursecis at timet(aggregated over rooms)Key constraints (pseudo-code):
Strengths: Declarative modeling; strong global constraint propagation (e.g.,
alldifferent,cumulative); expresses hard and soft constraints naturally.Weaknesses: May require careful constraint ordering; solving large instances can be slow without good search heuristics.
Approach 2: Mixed Integer Programming (MIP)
Decision variables:
x[c, i, t, r] ∈ {0, 1}: 1 if coursec, lecturei, assigned to slott, roomrslack[s] ≥ 0: Penalty for soft constraintsKey constraints (mathematical notation):
Strengths: Mature LP/MIP solvers (CPLEX, Gurobi); integrates continuous relaxations for bounds; exploits structure via cutting planes.
Weaknesses: Large integer variable sets; global constraints must be reformulated as linear inequalities (verbose); soft constraints need auxiliary variables.
Approach 3: Local Search / Metaheuristic
Start with a greedy assignment, then repeatedly:
Strengths: Fast for medium-sized instances; naturally handles soft constraints; scales well to real-world sizes.
Weaknesses: May get stuck in local optima; no optimality guarantee; requires careful tuning of move operators and temperature schedules.
Example Model (MiniZinc)
Key Techniques
1. Constraint Propagation & Global Constraints
The
alldifferentandcumulativeglobal constraints enforce instructor and room constraints efficiently via:For large timetables, propagation often proves infeasibility early, avoiding futile search.
2. Symmetry Breaking
Timetables have inherent symmetries: swapping two empty rooms or two identical time slots generates equivalent solutions.
Techniques:
lecture_1_slot ≤ lecture_2_slot.Symmetry breaking can reduce search space by orders of magnitude.
3. Hierarchical Constraint Relaxation
Prioritize constraints:
Solve level 1 to feasibility, then optimize level 2 subject to level 1, etc. This avoids infeasible branches early.
Challenge Corner
Can you model this with fewer variables?
Instead of a 4-indexed boolean array
schedule[c, i, t, r], could you use a 2-indexed assignment:lecture_slot[lecture_id]mapping each lecture to a (slot, room) pair? What advantage or disadvantage would this bring for expressing instructor and room conflicts?What symmetry-breaking constraints would help?
How would you add symmetry-breaking to rule out time-slot permutations that don't materially affect the quality of the schedule? Hint: think about which lectures are interchangeable and impose a canonical ordering.
Handling robustness:
Real timetables need to accommodate last-minute cancellations and room changes. How would you model a "buffer" or "flexibility margin" in your solution to permit local modifications without breaking constraints?
References
Müller, T. (2009). Constraint-based timetabling. In: Recent Advances in Constraints (LNCS 5655). A concise survey of CP-based approaches with practical examples from university scheduling.
Kingston, J. H. (2013). Educational timetabling. In: Handbook of Constraint Programming (pp. 857–875). Comprehensive overview of problem variants and solving techniques.
Cambazard, H., & O'Sullivan, B. (2015). Propagating the cumulative constraint combining control and automaton-based reasoning. In: AAAI. Covers advanced propagation for resource constraints essential to scheduling.
Ceschia, S., & Schaerf, A. (2010). Local search for quantum SAT and related combinatorial optimization problems. Annals of Operations Research, 176(1). Explores metaheuristic techniques for large-scale instances.
Beta Was this translation helpful? Give feedback.
All reactions