Teachers
Each teacher has their own subjects, available periods, working days, and constraints that the timetable needs to respect.
Education · Scheduling · Optimization
The application for the Isidor Bajić Music School is not really a table-layout problem. It is a problem of connecting a large number of rules into one valid, practical, and high-quality solution.
Next.js · PostgreSQL · Prisma · Optimization · CP-SAT

Problem
If every lesson is simply placed somewhere inside an allowed time slot, the problem is still not solved.
A teacher can end up with too many gaps. Students can get a poorly structured day. The same subject can be repeated at inconvenient times. A classroom can introduce another conflict. Moving one lesson can damage the schedules of several other people.
The system therefore has to distinguish between rules that must never be violated and quality criteria that should be optimized as far as reasonably possible.
Constraints
Each teacher has their own subjects, available periods, working days, and constraints that the timetable needs to respect.
Lessons must fit without overlaps while keeping the daily schedule as practical as possible and minimizing unnecessary gaps.
Every activity needs an appropriate classroom, including subjects that use their own default or assigned room.
Not every time slot is equally possible. Different grades, teachers, and activities have different allowed time windows.
A single change can trigger a chain of problems elsewhere, so a locally good move may still make the overall timetable worse.
Being valid is not enough. The system also needs to reduce gaps, poor lesson repetition, and unnecessary teacher working days.
Approach
At some point it is no longer rational to repair the timetable one move at a time and hope that the same problem does not appear somewhere else.
The system therefore gained a solver-based approach that considers many activities and constraints as one connected problem, while clearly separating hard rules from quality objectives.
Hard constraints
Teacher, student, and classroom conflicts, as well as forbidden periods, must never exist in a valid solution.
Optimization
Among valid solutions, the solver searches for one that produces a better overall timetable.
Human control
Automatic optimization does not replace the editor. The system still supports review and controlled manual changes.
Validation
Every important version is validated before it can become a candidate for publishing.
System
A school does not need a mathematical model that only runs in a terminal. It needs a complete product where data enters the system, the timetable is generated, reviewed, edited, validated, and eventually published.
Import and processing of school data
Draft timetable for further work
Automatic conflict detection
Optimization across a large number of interacting constraints
Manual editing and controlled drag & drop
Versioning and timetable publishing
Public timetable view
Daily teacher view
Result
0
gaps in teachers' schedules in the validated candidate
The accepted optimization result reached zero gaps in teachers' schedules with only one remaining student gap — a level of quality good enough to stop aggressive further optimization and move into real use.
This is also why optimization is not an endless search for mathematical perfection. The goal is a system that solves the real problem well enough to be useful.
What this project demonstrates
This project is particularly important to me because it combines traditional full-stack development with constraint modelling, optimization, validation, and the real operating rules of a school.
The interface is only the final layer. Most of the value comes from understanding the problem correctly and turning a large number of interdependent rules into a usable system.
Next case study
RentalWorkers solves a completely different type of problem: user roles, marketplace logic, multilingual content, vendor workflows, and AI-assisted content processing inside one business platform.
RentalWorkers →