Predrag Božić
← Projects

Education · Scheduling · Optimization

How do you build a timetable when almost every move affects ten other things?

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

Public timetable view for the Isidor Bajić Music School

Problem

A valid timetable is not the same as a good timetable.

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

One timetable. Many different kinds of rules.

01

Teachers

Each teacher has their own subjects, available periods, working days, and constraints that the timetable needs to respect.

02

Students and classes

Lessons must fit without overlaps while keeping the daily schedule as practical as possible and minimizing unnecessary gaps.

03

Classrooms

Every activity needs an appropriate classroom, including subjects that use their own default or assigned room.

04

Allowed periods

Not every time slot is equally possible. Different grades, teachers, and activities have different allowed time windows.

05

Conflicts

A single change can trigger a chain of problems elsewhere, so a locally good move may still make the overall timetable worse.

06

Timetable quality

Being valid is not enough. The system also needs to reduce gaps, poor lesson repetition, and unnecessary teacher working days.

Approach

When local adjustments stop being enough, the problem becomes global optimization.

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.

01

Hard constraints

Teacher, student, and classroom conflicts, as well as forbidden periods, must never exist in a valid solution.

02

Optimization

Among valid solutions, the solver searches for one that produces a better overall timetable.

03

Human control

Automatic optimization does not replace the editor. The system still supports review and controlled manual changes.

04

Validation

Every important version is validated before it can become a candidate for publishing.

System

The solver is only one part of the application.

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.

01

Import and processing of school data

02

Draft timetable for further work

03

Automatic conflict detection

04

Optimization across a large number of interacting constraints

05

Manual editing and controlled drag & drop

06

Versioning and timetable publishing

07

Public timetable view

08

Daily teacher view

Result

0

gaps in teachers' schedules in the validated candidate

Quality starts to matter once the system stops being merely “valid”.

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

Not every problem is a CRUD application.

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

From optimization to a marketplace platform.

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 →