This project was a collaboration with my friend for the combinatorial optimization course, instructed by Dr. Hooshmand. Our task was to create a mid-term exam schedule for the entire MCS department at the AmirKabir University of Technology.

The primary challenge was to devise a schedule that accommodated all students, ensuring that no student had more than one exam on any given day and that there were adequate gaps between exams. Given that each student had a unique set of courses, satisfying everyone’s schedule was a complex problem.

For data preprocessing, we used Numpy and Pandas, and we used the Python API of GAMS to solve our Mixed-Integer Non-Linear Programming (MINLP) models.

Constraints:

  • No exams could be scheduled on weekends.
  • Each exam had to be scheduled during its own course time.

Decision Variables and Parameters

Decision Variables and Parameters

Formulation 1: Non-Linear and Slow

In our first attempt, we used a non-linear model to penalize dense exam schedules. The model aimed to maximize the gap between exams within a two-week period. However, we quickly found that a two-week schedule was not feasible.

First Formulation

After extending the scheduling period to four weeks, we were able to find a feasible solution. We also identified 118 students whose schedules created conflicts. By excluding them, we found a two-week integer solution after running the model for seven hours.

First Formulation Results

Formulation 2: Linear and Fast, but Suboptimal

Our second approach was a linear model that minimized the maximum number of exams per week for each student. While this model was much faster, it didn’t adequately penalize dense exam schedules within the same week.

Second Formulation Second Formulation Schedule

Formulation 3: The Best of Both Worlds

Our final formulation combined the ideas from the previous two models.

Third Formulation

This model produced an integer solution after six hours. When we excluded the 118 problematic students, we found an optimal two-week schedule in just 15 minutes.

Third Formulation Results 1 Third Formulation Results 2

The complete source code is available in this GitHub repository.