Teacher constraints

How to minimize teacher gaps in a school timetable

A free period between two lessons is usually a workload issue, not a clash. Here is how to count gaps, see what forces them, and shrink them without breaking availability or room rules.

Juho Isola, Smootables founder

Constraint recipe

A teacher gap is a free period between two lessons on the same day. If a teacher has lessons in periods 1 and 4, the empty periods 2 and 3 are gaps, including when period 4 is their last lesson that day. Only time before the first lesson, lunch, and time after the final lesson are excluded. Rule out double-bookings and unavailable periods first, then tighten gap preferences or move lessons.

Key takeaways

  • Count gaps between lessons on the same day, including before the last lesson.
  • Fix clashes and unavailable periods before chasing zero gaps.
  • Part-time days, double periods, and specialist rooms often force gaps.
  • Every gap you close moves a lesson; check what the move breaks for the receiving class and room.

When a gap is a problem

Planners also call gaps idle periods, and one between lessons may be fine. Five on the same day may break local workload policy. Gaps cost paid staff time, but they do not stop the timetable from running. That makes them different from a clash, where the same teacher is assigned to two classes at once and the timetable is invalid.

Treat gaps as a quality target unless your policy makes a specific gap illegal. A hard rule cannot be broken; a soft rule is a preference the timetable system can bend when something more important blocks it. Gap limits are almost always soft: the generator reduces them where rooms, availability, and required lessons still allow it.

A worked example: three gaps in one week

Ms. Keller teaches 12 maths lessons across five classes. Filter the timetable to her week and count the free periods between lessons on each day. Tuesday has two gaps and Thursday one. Monday afternoon is empty, but that time falls after her last lesson, so it does not count.

Before: Tuesday P2 and P3, Thursday P2

MonTueWedThuFri
P17A8B9A
P27BGap7BGap
P39AGap8B7A
P49A
P57A7B
P68A
  • Lesson
  • Gap (idle period)
  • Moved lesson
Twelve lessons, three gaps. Wednesday P1 is not a gap because no lesson comes before it that day.

After: the same 12 lessons, zero gaps

MonTueWedThuFri
P17A8B9A
P27B9A7B7A
P39A7A8B
P4
P57B
P68A
  • Lesson
  • Gap (idle period)
  • Moved lesson
Tuesday's 9A and 7A lessons moved up two periods; Thursday's 7A moved up one.

The fix is not free. Moving 9A from Tuesday P4 to P2 means class 9A now has a different subject in P4, and the room Ms. Keller uses must be free in P2. Every closed gap is a move, and every move needs the receiving class, teacher, and room to be free. This is why a generator sometimes leaves a gap in place: the compact placement exists for the teacher but not for everyone else in the slot.

What keeps gaps in place

Teachers who work only two or three days leave fewer slots to pack lessons tightly. Double periods and lab blocks need adjacent time, which can open holes elsewhere in the day. Team teaching needs every assigned teacher free in the same period, which shrinks options for the whole group. A specialist room that is only free in P1 and P4 can force a gap between those lessons no matter what the generator tries.

See soft constraints for how quality preferences like gap limits give way to clashes, rooms, and availability.

Work through the gaps in order

Do the checks in this order so you do not chase a zero-gap target that availability makes impossible.

  1. Filter the timetable by one teacher at a time and count free periods between lessons on the same day, as in the example above.
  2. Check for double-bookings and for lessons placed in periods the teacher marked unavailable. Fix those first; they are validity problems, not quality problems.
  3. For each remaining gap, note whether the lessons around it are pinned, team-taught, double periods, or tied to a specialist room.
  4. Decide what matters more for your school: compact teacher days, subject spread across the week, or the shape of the students' day. Tightening one usually loosens another.
  5. Raise the gap preference, or move the blocking lessons by hand, then regenerate.
  6. Compare the gap count before and after. If a gap survives, record why: a part-time day, a room limit, or a team-teaching overlap usually explains it.

Mistakes that create more gaps

  • Treating every gap as a clash or a data error instead of a quality target
  • Pinning lessons early, then blaming the generator for the gaps the pins created
  • Demanding zero gaps from part-time staff who work only a few days each week
  • Closing a teacher's gap with a move that opens two gaps for a colleague

In Smootables

Teacher Gaps is a school-wide preference weight, not a rule that blocks generation.

A gap is a free period between two lessons on the same day. Empty slots between earlier lessons and the last lesson of the day count. Only time before the first lesson, lunch, and time after the final lesson are excluded. Smootables treats gaps as something to reduce when you want tighter days, not as a clash that makes a timetable invalid.

Open Settings → Timetabling and raise Teacher Gaps (0 to 200). Zero turns the preference off. A higher number asks the generator to pack each teacher's day more tightly when rooms, availability, and other rules still allow it.

  1. Run Generate timetable only after clashes and room rules already look feasible.
  2. Compare Teacher gaps in the analysis summary across two runs before committing to a heavy weight.

Quick answers

Are teacher gaps hard or soft constraints?

Usually soft. A double-booking or a lesson in an unavailable period makes the timetable invalid; an idle period between valid lessons is a workload quality issue.

Does free time before the first lesson count as a gap?

No. Gaps are free periods between two lessons on the same day. Time before the first lesson, lunch, and time after the last lesson are excluded.

Why won't the generator remove every gap?

Another rule may leave no compact placement. Check part-time days, team teaching, double periods, and specialist rooms before raising the gap weight again.

See how Smootables fits your school's constraints

Book a walkthrough. We will review your teacher load, rooms, and scheduling rules and show how they work in Smootables.