«When I was working on this text, I couldn't shake the thought: how much time and nerves do we waste on tasks that could have been solved differently long ago? Distributing teaching loads is a microcosm of a more global problem: we often fail to notice that routine can be automated, freeing people up for things that truly require human participation. I would like such approaches to stop being the exception and become the norm – not for the sake of technology itself, but for the sake of the people it can help.» – Dr. Anna Muller
Every year, at the start of the academic season, university and school administrators face the same old headache: assigning teachers to courses. It sounds simple, but in practice, it is a puzzle that consumes dozens of work hours. You have to ensure all courses are covered, that no one is overworked or sitting idle, that teachers continue with the same courses as before if possible, and ideally – that they get to teach what interests them. Usually, this is done manually, using spreadsheets, negotiations, and compromises.
But what if this task could be solved mathematically? Not roughly, not by “eyeballing it,” but precisely, with a guarantee of an optimal result? That is exactly what researchers from Chalmers University of Technology in Sweden did. They took real data from their Department of Signals and Systems, built a mathematical model, and tested how modern optimization algorithms handled it.
Teacher Assignment: A Common Problem with a Mathematical Solution
A Problem Everyone Knows, But Few Solve
The task of assigning teachers is a classic case of combinatorial optimization. In mathematics, such problems are called NP-hard, which means: the more teachers and courses you have, the harder it is to find the optimal solution. The number of possible distribution variants grows so fast that checking them all manually or even with a simple computer algorithm becomes impossible.
Imagine this: you have 20 teachers and 30 courses. Each teacher can lead several courses, but not just any random ones – someone specializes in control theory, someone in electronics, someone in programming. Everyone has a minimum and maximum workload: you can't give a person too few hours (it's economically inefficient) or too many (it violates labor standards and lowers teaching quality). Plus, there is history: if a teacher taught a course last year, it is desirable to keep them on it this year too – that way they spend less time preparing, and students get a more experienced mentor.
Add teacher preferences to the mix: one likes teaching basic courses, another prefers advanced topics. And all of this needs to be balanced so that no one feels shortchanged or overloaded. Manually, such a task takes hours, sometimes days – and the result remains a compromise, not an optimum.
Mathematical Formulation for Teacher Assignment Optimization
What is the Mathematical Formulation of the Task
For a computer to solve this task, it must be translated into the language of mathematics. In this case, the researchers used an approach based on binary variables. Every possible assignment – “Teacher X leads Course Y” – is represented as a variable that can take the value 0 (not assigned) or 1 (assigned).
Next come the constraints. First and foremost: every course must be covered. This means that for each course, the sum of assignments must be at least one, and the total number of hours usually allocated by teachers for the course must match its duration. If a course is calculated for 40 hours, then the teachers assigned to it must collectively cover exactly 40 hours.
The second constraint concerns teacher workload. Everyone has a minimum and maximum number of hours they must or can teach. For example, a full-time professor might have a minimum of 100 and a maximum of 150 hours per year. The sum of hours across all courses assigned to them must fall within this range.
The third constraint is stability. If a teacher taught a course last year, it is desirable to keep them on it in the current year. This is not a rigid requirement, but it affects the final score of the solution: the fewer changes, the better.
Finally, there are preferences. Each teacher can indicate which courses are more interesting to them. The system tries to account for these preferences, but not at the expense of more critical criteria – course coverage and workload balance.
Algorithmic Approaches to Teacher Assignment: MILP, SMT, and CP
Three Approaches to the Solution: MILP, SMT, and CP
The researchers tested three types of algorithms, each approaching the optimization task in its own way.
Mixed-Integer Linear Programming (MILP)
MILP is a classic method that has been used in industry for decades to solve logistics, production planning, and resource allocation problems. The essence is simple: the task is represented as a system of linear equations and inequalities, and the algorithm looks for variable values that simultaneously satisfy all constraints and minimize or maximize the objective function.
In the case of teacher distribution, the objective function is a combination of several criteria: minimizing workload deviation from the desired target, minimizing the number of course changes, and maximizing teacher satisfaction. Each criterion is assigned a weight, and the algorithm seeks a trade-off between them.
MILP solvers, such as Gurobi or CPLEX, handle medium-sized tasks very well. They use advanced methods, such as “branch-and-cut” and adding extra constraints on the fly, to speed up the search for the optimal solution.
Satisfiability Modulo Theories (SMT)
SMT is a more modern approach, initially developed for software verification and checking system correctness. Its peculiarity is that it can work not only with linear constraints but also with logical conditions, bitwise operations, array theories, and other complex structures.
For the teacher assignment task, SMT allows for more flexible constraint formulation. For example, you can easily add a condition: “If Teacher A leads Course X, they cannot lead Course Y because they run at the same time.” Or: “A teacher can run no more than two courses simultaneously.”
The study used the Z3 solver, developed at Microsoft Research. This is one of the most powerful SMT solvers, actively applied in the industry for code analysis, security checks, and automated theorem proving.
Constraint Programming (CP)
CP is an approach that focuses on expressing and processing constraints directly, without converting them into linear equations. Instead of searching for an optimum in a continuous space, CP works with discrete domains and uses constraint propagation methods to narrow down the search area.
Imagine you have a Sudoku puzzle. You don't iterate through all possible number combinations; you use the rules of the game to eliminate impossible options step by step. CP works in a similar way: at each step, the algorithm analyzes constraints and removes options from consideration that definitely won't fit.
For teacher distribution, CP is particularly convenient when you need to account for complex logical conditions or when quickly finding an acceptable solution is more important than global optimality.
Real-World Application of Optimization in Teacher Scheduling
Real Data: How It Works in Practice
The researchers didn't test their models on synthetic data. They took real information from the Department of Systems and Control at Chalmers University of Technology. This is a medium-sized faculty with several dozens of teachers and dozens of courses per year. The data included assignment history from previous years, teacher preferences, workload requirements, and the duration of each course.
Each of the three algorithms was run on this data, and the results were compared across several criteria:
- Workload Deviation: How much does the actual workload differ from the desired one? The ideal scenario is when all teachers have a roughly equal load, close to the middle of their allowable range.
- Number of Course Changes: How many teachers had to be reassigned to new courses compared to the previous year?
- Teacher Satisfaction: How well do the assignments match the stated preferences?
- Solution Time: How long does it take the algorithm to find an optimal or near-optimal solution?
The results were impressive. All three methods handled the task, but with varying efficiency.
Comparative Analysis of Optimization Algorithm Performance
What the Results Showed
The MILP solver showed the best results in terms of solution quality. It found a distribution with minimal workload deviation and the lowest number of course changes. This is not surprising: MILP is specifically tailored for tasks where you need to find a global optimum given linear constraints. The run time was a few minutes on a standard computer – perfectly acceptable for a task solved once a year.
The SMT solver also showed good results but lagged slightly behind MILP in speed. However, it demonstrated greater flexibility: when researchers added extra logical constraints (e.g., “a teacher cannot lead two courses back-to-back without a break”), SMT handled them without reformulating the entire model.
CP proved to be the fastest in the initial stages: it found an acceptable solution satisfying all hard constraints very quickly. But when it came to fine-tuning – minimizing course changes and maximizing satisfaction – CP lagged behind the other two methods. This is typical for Constraint Programming: it works excellently when you need to quickly find any valid solution, but searching for the optimum takes more time.
Automated vs Manual Teacher Assignment: A Detailed Comparison
Comparison with Manual Assignment
The most interesting part began when the automated distribution results were compared with what was done manually in previous years. It turned out that manual distribution had a significantly higher workload deviation: some teachers were overloaded, while others were underloaded. The number of course changes was also higher – apparently, when planning manually, it is difficult to keep the entire history of assignments in your head.
Moreover, manual distribution took the administration several days of work, including negotiations with teachers and multiple adjustments. The automated approach cuts this time down to a few hours: most of the time is spent preparing data and verifying results, while the calculation itself takes mere minutes.
Impact of Optimized Teacher Assignment on Education Quality
Why This Matters for Real Life
The task of assigning teachers is not an abstract mathematical game. The quality of education, teacher motivation, and the efficiency of the entire educational institution depend on its solution.
When the workload is distributed unevenly, everyone suffers. Overloaded teachers don't have time to prepare well for classes, do research, or improve their qualifications. Underloaded teachers feel undervalued and might look for work elsewhere. Students receive a lower quality of education because they are taught not by those best suited for the course, but by those who “happened” to get it by chance or administrative convenience.
Frequent course changes also create problems. Every time a teacher takes on a new course, they spend dozens of hours preparing: studying the material, creating lectures, assignments, and exams. If a course stays with the same teacher for several years in a row, they gradually polish the program, accumulate experience, and learn to answer typical student questions. Teaching quality goes up, and time costs go down.
Automating this process frees the administration from routine work and allows them to focus on more important tasks: developing curricula, interacting with students, and strategic planning. And teachers get a fairer and more predictable workload distribution.
Beyond Academia: Wider Applications of Teacher Assignment Algorithms
Can This Be Applied Elsewhere?
The approach described in the study is universal. It can be adapted not just for universities, but also for schools, colleges, and training centers. It can be used to allocate not only teachers but other resources as well: classrooms, laboratories, and equipment.
Moreover, the same mathematical structure applies to tasks outside of education. Assigning medical staff to shifts in a hospital, assigning engineers to projects in a company, planning support service schedules – these are all combinatorial optimization tasks with similar constraints and criteria.
It is important to understand that a mathematical model is not a rigid template. It can be tuned to specific needs. For example, in one university, the main priority might be minimizing course changes; in another, it might be accounting for teacher preferences. In a school, workload uniformity might be more important, while a training center might prioritize maximizing the use of each educator's specific qualifications. All these criteria can be encoded in the objective function by assigning them different weights.
Teacher Assignment Optimization: Current Limitations and Future Directions
Limitations and Next Steps
For all the merits of the approach, there are limitations. First, the quality of the solution depends directly on the quality of the input data. If the system lacks information about teacher preferences or assignment history, the algorithm won't be able to account for them. Second, the model doesn't account for informal factors: personal relationships between teachers, departmental politics, informal agreements between management and staff. These aspects still require human participation.
Another challenge is scalability. The study used data from a medium-sized faculty. For a large university with hundreds of teachers and thousands of courses, the solution time could increase significantly. Hybrid approaches might help here: for example, first breaking the task into several smaller ones (by faculties or departments), solving them independently, and then coordinating the results.
The researchers from Chalmers plan to continue working in several directions. First, adding conflict handling to the model: if two courses run at the same time, one teacher cannot lead both. Second, integrating the system with the university database to automatically retrieve current info on courses and teachers. Third, developing an interface that will allow administrators not just to run the algorithm, but to interactively adjust the solution if there are specific requirements.
Practical Benefits of Algorithmic Teacher Assignment
Practical Conclusion
The teacher assignment task is a typical example of a problem everyone knows, but few solve systematically. We are used to thinking of it as “just administration,” something done manually “because that's how we've always done it.” But the Chalmers study shows: even such seemingly routine tasks can be solved better, faster, and fairer with the help of math and modern algorithms.
This doesn't mean we need to completely remove humans from the process. Automation doesn't replace common sense and administrative experience; it complements them. The algorithm proposes an optimal solution from the point of view of formal criteria, and a human checks it against reality, accounts for nuances, and makes the final decision.
The result is time savings, fairer load distribution, and less stress for teachers and administration. And ultimately – higher quality education, because every teacher ends up in the right place, leading the courses closest to them, with an adequate workload.
Energy – in this case, intellectual and organizational – must be spent efficiently. Not on crafting schedules by hand for hours, but on improving course content, developing teaching methods, and supporting students. Math and algorithms free us up for more important tasks. And that, in my view, is the right direction.