Project · Personal project
A solver that turns a school's teachers, classes, subjects and periods into a conflict-free weekly timetable, in seconds rather than days.
Making a school timetable by hand is a classic headache. Every teacher, every class and every period interacts with every other, and moving one lesson can break the week somewhere else.
I treated it as what it really is, a constraint-satisfaction problem, and let a solver do the juggling. The result is a generator that produces a timetable where nobody is in two places at once, while still respecting the softer preferences that make a timetable pleasant to live with.
How the problem is modelled and solved.
Described the school as data: the teachers, the classes, the subjects each class needs, and the periods in a week.
Set up decision variables for each possible assignment of a teacher and subject to a class in a period.
Wrote the constraints that must always hold, such as a teacher or class never being booked twice in the same period.
Added softer goals so that, among all valid timetables, the solver prefers the better ones.
Ran Google OR-Tools' CP-SAT solver and checked the output for any conflicts.
Built a standalone HTML and JavaScript constraint-satisfaction version that runs entirely in the browser, with nothing to install.
Too many rules can make a timetable impossible. A good model makes it clear when the inputs themselves are the problem.
Schools want an answer quickly. Constraint programming lets the solver prune huge numbers of bad options early.
Separating must-have rules from preferences is what lets the solver produce a timetable that is both valid and sensible.
The browser version means someone at a school can use it without setting up Python.