Timetable creation is one of the most time-consuming administrative tasks in any school. A typical secondary school in Bangladesh with 30 sections, 60 teachers, 15 subjects, and constraints around room availability, teacher workload, and subject sequencing faces a scheduling problem with millions of possible combinations — most of which are invalid. Manual timetabling by a senior teacher can take 2-4 weeks at the start of each academic year and often produces suboptimal results. Automated timetable generation applies computational algorithms to produce feasible, high-quality schedules in minutes.
Understanding the Timetabling Problem
School timetabling is a constraint satisfaction problem (CSP). The goal is to assign teachers, subjects, rooms, and time slots such that all constraints are satisfied. Constraints fall into two categories:
Hard Constraints (Must Be Satisfied)
- No teacher can be assigned to two classes at the same time.
- No class can have two subjects scheduled simultaneously.
- No room can be double-booked.
- Subject-period allocations must match the curriculum-mandated hours (e.g., NCTB specifies 5-6 periods per week for Bangla and English at the secondary level).
- Teachers must not exceed their maximum weekly period load.
Soft Constraints (Should Be Optimized)
- Avoid scheduling the same subject in consecutive periods for a class.
- Place subjects requiring high concentration (mathematics, science) in morning slots.
- Distribute teacher workload evenly across days.
- Minimize the number of free periods ("gaps") in a teacher's daily schedule.
- Ensure lab-based subjects are assigned to rooms with appropriate facilities.
Algorithmic Approaches
1. Constraint Satisfaction with Backtracking
The most straightforward approach models the timetable as a CSP and uses backtracking search to find valid assignments. The algorithm assigns subjects to time slots one at a time, checking hard constraints at each step. When a conflict is detected, it backtracks to the most recent decision and tries an alternative. While guaranteed to find a solution if one exists, basic backtracking is too slow for large instances — a school with 300 weekly periods might explore billions of possibilities.
Enhancements like constraint propagation (arc consistency) and variable/value ordering heuristics dramatically reduce the search space. Most-constrained-first heuristics — assigning the teacher or class with the fewest available options first — prevent the algorithm from reaching dead ends deep in the search tree.
2. Genetic Algorithms
Genetic algorithms (GAs) treat timetabling as an optimization problem rather than a strict satisfaction problem. The process works as follows:
- Initialization: Generate a population of random (likely invalid) timetables.
- Fitness evaluation: Score each timetable based on the number of constraint violations. A timetable with zero hard constraint violations and minimal soft constraint violations has the highest fitness.
- Selection: Choose the fittest timetables as parents for the next generation.
- Crossover: Combine portions of two parent timetables to create offspring. For timetabling, single-point or uniform crossover on the period-assignment matrix is common.
- Mutation: Randomly swap teacher-period assignments to introduce diversity and avoid local optima.
- Iteration: Repeat for hundreds or thousands of generations until a satisfactory solution emerges.
GAs are well-suited for timetabling because they naturally handle both hard and soft constraints through the fitness function. They also produce good-quality solutions within predictable time bounds, unlike backtracking which can vary wildly in runtime.
3. Simulated Annealing
Simulated annealing starts with a random timetable and iteratively improves it by making small changes (swapping two period assignments). It accepts improvements unconditionally and accepts worse solutions with a probability that decreases over time — the "cooling schedule." This mechanism allows the algorithm to escape local optima early in the process while converging to a good solution as the temperature drops. For school timetabling, simulated annealing often produces results comparable to GAs with simpler implementation.
4. Integer Linear Programming (ILP)
Mathematical optimization formulates the timetable as a system of linear equations and inequalities. Decision variables represent whether a particular teacher-subject-time-room combination is active (1) or not (0). An objective function minimizes soft constraint violations. Solvers like CPLEX, Gurobi, or the open-source CBC can find provably optimal solutions for small-to-medium instances. However, the problem size grows quickly: a school with 60 teachers, 6 daily periods, and 5 days produces 1,800 binary variables before accounting for rooms and sections.
Practical Implementation for Bangladeshi Schools
Input Requirements
An automated timetabling system needs structured input: teacher list with subject qualifications, class/section list, subject-period requirements per the NCTB curriculum, room inventory, and any pre-fixed slots (e.g., assembly periods, lab sessions that require specific rooms). In Bangladesh, double-shift schools add complexity — the same rooms and some teachers serve morning and day shifts with different student cohorts.
Handling Double-Shift Schools
Many Bangladeshi schools operate morning and day shifts. The timetable generator must treat these as linked problems: shared resources (rooms, laboratory equipment) cannot be double-booked across shifts, but teachers may work in one or both shifts. The algorithm needs to optimize both shifts jointly, not independently.
Manual Override and Adjustment
No algorithm produces a perfect timetable on the first run. Administrators need the ability to lock specific assignments (e.g., "the principal always teaches Class 10 Period 1 on Sunday") and re-generate around those fixed slots. A drag-and-drop interface for post-generation adjustments, with real-time constraint violation warnings, bridges the gap between algorithmic output and practical requirements.
Integration with School Management Systems
Digital School by Nexis Limited incorporates automated timetable generation as part of its comprehensive school management platform. Rather than operating as a standalone scheduling tool, it pulls teacher, subject, and room data directly from the school's existing records and publishes the generated timetable to student and teacher dashboards instantly. This integration eliminates duplicate data entry and ensures the timetable reflects the school's current state.
For schools looking to eliminate the annual timetable headache, contact Nexis Limited to see automated scheduling in action, or explore the full range of services we offer.