
Every semester, universities have to deal with the same big problem: making a schedule for exams. At first, it seems straightforward to put tests in rooms and at certain times. But when there are hundreds of classes, thousands of students, not enough rooms, and strict rules to follow, things get very complicated very quickly.
Being OR practitioners, we tried our own way to solve this problem for a U.S. university using Google's OR-Tools, which is an open-source optimization solver. We didn't use spreadsheets or trial and error; instead, we wrote down all the university's rules as constraints, then used the solver to automatically generate a valid exam schedule.
These were the main rules that we established as constraints in the model:
In our model, the solver had to decide:
The model solves for the following objective:
A feature of constraint programming is that if the university wants to generate a valid schedule (without worrying about compactness), we can run the model without regard for an objective funaction and find any feasible timetable in the fastest time.
By turning these rules into a mathematical formulation and utilizing the Or-tools solver, we were able to generate an optimized exam schedule for the university. The model output is a binary array that represents the schedule that adheres to all of the mentioned constraints and minimizes the objective. Each exam is assigned to its own time slot, the schedule ensures that no room was too crowded, there were no conflicts between time slots, and the schedule respected lead time and room compatibility requirements. Rescheduling is now streamlined so if scheduling changes are needed, they can be immediately tested with a few clicks. It used to take days of manual work, but now exam scheduling can be performed in just a few minutes. The optimization model produced a complete exam schedule, assigning each exam to a room and a time slot while respecting all of the desired constraints. After some post-processing of the output, we can produce a final schedule to a user. Here is a subset of the final output representing the schedule of a small department within the university. Keep in mind that the exam schedule for this department was jointly scheduled with all other departments:
The complete schedule was exported to Excel, making it easy for administrators to review, share, and make updates if last-minute changes are required.
This method speeds up the scheduling process, improves student and faculty satisfaction, and makes the exam schedule more equitable for all students. Instead of spending days changing spreadsheets, the model makes a schedule that follows all the rules we impose automatically. The model also quickly rebuilds the schedule if courses or rooms change. This usecase demonstrates how optimization can help universities to make a positive impact on faculty by reducing operational friction, and on their students by improving the quality of exam schedules.