Genetic Algorithm — Defense Scheduling Optimization
A genetic algorithm that automates academic defense scheduling by assigning a date, time slot, room and jury (rapporteur and president) to each student's defense, penalizing conflicts and poorly grouped professor sessions.
By Jawher Ennaceur
View on GitHub- Genetic Algorithms
- Optimization
- Python
- Constraint Satisfaction
- Scheduling
- Data Processing
The Problem
Scheduling academic defenses means giving each student a date, time slot, room and jury while respecting several constraints. A room can host only one defense at a time, a professor cannot be in two defenses in the same slot, and the supervisor, rapporteur and president must be three different people. Beyond avoiding conflicts, a good schedule keeps each professor's sessions compact, with few idle gaps, a reasonable number of sessions per day and few late-slot defenses.
The Approach
I developed a genetic algorithm in Python in which each candidate schedule is a list of defense assignments. The initial population is built from Excel files of students, supervisors and rooms: for each student the generator picks a random room, date and one of seven daily slots, then a rapporteur and a president, retrying when a room or professor is already booked. Each professor's jury roles are capped at the number of students they supervise. An evaluation function subtracts 1,000 points for each hard violation (double-booked room or professor, wrong supervisor, repeated person in the jury) and applies weighted penalties for late slots, gaps between sessions, gaps between working days and an uneven number of days per professor. Selection keeps the top half of the population and picks parents by tournament, preserving the best individual (elitism). Crossover keeps part of one parent's schedule and takes the remaining defenses from another parent when they fit, reassigning them randomly otherwise, and mutation moves defenses to a different date or room. The final schedule is exported to Excel with OpenPyXL.
Results
- Automated schedule generation from Excel inputs (students, supervisors, rooms) and exported the result to Excel
- Built a constructive generator that produces schedules with no double-booked rooms or professors across seven daily slots
- Capped each professor's rapporteur and president roles at the number of students they supervise to share the jury load
- Implemented tournament selection with elitism, crossover and mutation operators
- Designed a constraint-based evaluation function with a 1,000-point penalty for hard violations and four weighted soft criteria