Building a Scheduling Algorithm Training Providers Can Trust: Instructors, Venues and Capacity

Featured image with a lavender pastel background and a hexagon pattern, showing the post title "Scheduling Logic for Instructors, Venues and Capacity"

Building a Scheduling Algorithm Training Providers Can Trust: Instructors, Venues and Capacity

A scheduling algorithm training providers can trust has two layers. Hard constraints decide whether a schedule is legal at all: one session per instructor at a time, one per room, enough seats, a qualified and available instructor. Weighted soft constraints then rank the legal schedules by preference, such as fewer empty seats or a fair instructor workload.

Many vendor pages describe training scheduling as a feature list. This guide shows the logic underneath, ending with a five-session example small enough to reproduce as a test.

Key takeaways

  • Write every rule down as hard or soft before writing any search code. Hard rules define legal schedules; soft rules rank them.
  • Keep one conflict checker as the single source of truth, and back it with a database constraint so two planners cannot double-book the same slot.
  • Place the most constrained sessions first. In the worked example, placing sessions in list order dead-ends, while fewest-options-first succeeds.
  • When no legal schedule exists, report which hard rules collide and offer ranked relaxations for a human to approve.

What is the core of a scheduling algorithm training teams can audit?

The core is a list of rules, each marked hard or soft. A hard rule, such as one instructor per session at a time, must hold in every schedule you publish. A soft rule, such as a preferred day, only lowers a schedule’s score when broken. Writing the list first makes the algorithm testable and every override visible.

The ITC 2019 problem description, written for a university timetabling competition, draws the same line: hard constraints “cannot be violated,” while soft constraints carry penalties that are weighted and summed. Its model also gives every room a capacity and adds travel times between rooms.

To classify a rule, ask whether the session could still be delivered honestly if the rule broke. If not, it is hard. If someone is merely unhappy, it is soft. Declaring every preference hard is the common mistake, and it can leave no legal schedule at all.

Rule Type How to state it
Instructor clash Hard An instructor cannot hold two sessions whose busy windows overlap
Room clash Hard A room, or a shared equipment pool, cannot hold two sessions at once
Capacity Hard Planned learners must not exceed the room’s seats or the session’s enrollment cap
Qualification Hard Only instructors cleared to teach the course on that date are candidates
Availability Hard Leave, holidays and room maintenance block the slot
Travel time Hard The gap between two venues must be at least the travel time for that venue pair
Preferred day or time Soft Add penalty points when a session lands outside its preferred window
Right-sized room Soft Add penalty points for each large block of empty seats

How do you detect instructor and venue conflicts correctly?

Treat each booking as a half-open window that includes the start and excludes the end, widened by setup and teardown time. Two bookings for the same instructor or room conflict when their widened windows overlap. Half-open windows stop a class starting at 12:00 from clashing with one that ends at 12:00.

def busy(b):                      # window the resource is tied up
    return (b.start - b.setup, b.end + b.teardown)   # [start, end)

def clash(a, b):
    a0, a1 = busy(a)
    b0, b1 = busy(b)
    return a0 < b1 and b0 < a1

def travel_ok(prev, nxt, travel):  # instructor moving between venues
    return nxt.start - prev.end >= travel[prev.venue][nxt.venue]

Run clash for the instructor, the room and shared equipment. Run travel_ok with a value for each venue pair, not one flat buffer. Qualification is a simple yes or no filter here; expiring certifications and candidate ranking are a separate problem.

How should capacity work for rooms and virtual sessions?

Effective capacity is the smaller of the room’s seats and the enrollment cap you set for commercial or teaching reasons, such as a hands-on ratio. Check it twice: when you place a session, so the room can hold the planned maximum, and at each enrollment, against the seats remaining.

A virtual session has no room but still has a cap. Meeting platforms publish participant limits that vary by plan, so store a virtual cap on the session as you store seats for a room. Treat minimum attendance as a go or no-go rule checked before a deadline, not a placement rule: an under-filled session is still a legal schedule.

Why do time zones break recurring sessions?

Store each session start as an exact instant plus the venue’s time zone name, and generate recurring dates in local time before converting. Adding a fixed number of days to a timestamp drifts when clocks change, and daylight saving dates differ by country.

In 2026 the UK moves its clocks back on October 25 and the US on November 1. For that week London is four hours ahead of New York instead of the usual five, so a weekly 14:00 London virtual class lands at 10:00 in New York instead of 09:00.

Pro tip: Keep buffers on the resource, not the course. A lab may need a reset after every class, whatever course runs in it. Store setup, teardown and travel values on the room, venue and instructor, so one edit corrects every future booking.

How do you keep two planners from double-booking the same slot?

Put the no-overlap rule in the database as well as the application. Two planners can both pass an application check in the same second and both save. A database exclusion constraint on a time range per resource rejects the second write, so the rule holds whichever screen, import or API call made the booking.

The PostgreSQL documentation explains that exclusion constraints on range types can express “non-overlapping,” and shows a room reservation table that combines equality on the room with overlap on the time range. Adapted for instructors, rooms and equipment in one table:

CREATE EXTENSION btree_gist;
CREATE TABLE resource_booking (
    resource_id int,
    busy        tstzrange,
    EXCLUDE USING GIST (resource_id WITH =, busy WITH &&)
);

Write one row per resource, in one transaction, each time you confirm a session. The two-argument range constructor includes the start and excludes the end by default, which matches the half-open rule above. Other databases need an equivalent, such as a lock on the resource row.

Which scheduling algorithm training providers should use: greedy, search or a solver?

Build three layers in order of effort. First, a conflict checker every booking must pass. Second, a suggestion engine that places the most constrained sessions first. Third, a solver for batch planning, once hand-fixing a schedule keeps triggering chains of changes. Most providers need the first two long before the third.

Approach How it works Strength Weakness Choose it when
First fit in list order Place each session in the first legal option Simple, fast, easy to explain Dead-ends when resources are scarce; depends on list order Few sessions and plenty of spare instructors and rooms
Fewest options first, then repair Sort by number of legal options, place, then swap to cut penalties Copes with scarce instructors and stays explainable Can stop short of the best schedule Weekly or monthly planning with a few bottleneck instructors or rooms
Solver such as CP-SAT Declare rules and penalties; the solver searches the whole schedule Weighs many interacting rules at once Needs modeling skill; harder to explain to planners Term-sized batch planning

Google’s OR-Tools documentation calls CP-SAT its primary constraint programming solver and describes employee scheduling as “well-suited for CP.” Assigning instructors and rooms to slots has the same shape. Whatever you pick, keep the checker separate from the search: the checker answers “is this legal?” and the search only proposes, so a planner can drag a session by hand and the same rules still apply.

What does a worked example with five sessions look like?

The example has four half-day slots, two rooms and three instructors. Five sessions need placing, and three can be taught by only one person. That scarcity, not the session count, makes the problem hard. The tables below give the inputs, the rules and the outcome.

Session Learners Who can teach Legal options
S1 Time management 8 Asha, Ben, Chen 16
S2 Excel for managers 14 Chen 3
S3 Safety induction 18 Chen 3
S4 Data privacy basics 10 Chen 6
S5 First aid refresher 10 Asha, Ben 10

Slots are Monday AM, Monday PM, Tuesday AM and Tuesday PM. Room A seats 12 and Room B seats 20, so larger classes need Room B. Asha is out Monday AM and Tuesday PM, Ben is out Monday AM, and Chen is out Tuesday PM. “Legal options” counts the slot, instructor and room combinations that pass availability, qualification and capacity, before any clash between sessions.

Soft rules and penalties: Safety induction on Tuesday costs 3, Ben on Tuesday PM costs 2, a room with 8 or more empty seats costs 1, and an instructor teaching both slots on the same day costs 1.

Why does placing sessions in list order fail?

Monday AM is the one slot where only Chen is free, so the first flexible session in the list takes him. In list order, Time management lands with Chen on Monday AM, Excel on Monday PM and Safety induction on Tuesday AM. Chen’s three free slots are gone before Data privacy basics is placed, so it has nowhere to go.

Sorting by fewest legal options first reverses the result. Excel and Safety induction (3 options each) go first, then Data privacy basics (6), First aid (10) and Time management (16). Every session is placed, with a penalty of 2: Chen teaches twice on Monday, and the 8-learner class sits in Room B with 12 empty seats.

How do soft weights pick the winner?

Enumerating every combination leaves 288 legal schedules out of 8,640 raw option combinations, with penalties from 1 to 9. Eight schedules reach the best score of 1. All eight put Excel on Tuesday AM and Safety induction on Monday PM, and keep the 8-learner class in Room A.

The fewest-options-first result is legal but not optimal, which is why a repair step or solver exists. A score of 1 is also the floor: Chen has only three free slots across two days for three sessions nobody else can teach, so two must share a day.

Pro tip: Store the penalty breakdown with every proposal. A planner who sees “score 2: Chen twice on Monday, 12 empty seats in Room B” can accept or override with confidence. A bare number invites distrust, and a distrusted scheduler gets bypassed.

What should the system do when no legal schedule exists?

Name the hard rules that collide and offer ranked ways to relax them, instead of returning “no schedule found.” A planner needs to know which resource ran out. A human then picks the relaxation, and the system records the override and who approved it.

A counting check finds many of these cases before any search. Add a sixth session only Chen can teach to the example. Chen has three free slots and now four sessions, so no schedule exists, and the report can say exactly that.

Offer fixes in order of cost: qualify another instructor, free one of Chen’s slots, move a session to another week, or reclassify a rule that was never truly hard. That last option is why the rule list needs an owner.

How do you test scheduling logic before it touches real sessions?

Test invariants, not just examples. For any schedule the system outputs, assert that no instructor or room overlaps, no session exceeds capacity, and every instructor is qualified and available. Run the assertions on random inputs, on a replay of last term’s real sessions, and on the five-session example.

Add these edge cases:

  • A class ending at 12:00 and another starting at 12:00 in the same room.
  • A session that crosses midnight in the venue’s time zone.
  • A weekly series that spans the October 25 and November 1, 2026 clock changes.
  • An instructor removed after being assigned.
  • Two planners saving the same slot at once.

What should you do next?

Start with a constraint register: one row per rule, marked hard or soft, with a weight for each soft rule and a named owner. Then build the half-open clash check and the database constraint before any optimizer. Reproduce the five-session example as your first automated test.

If you are comparing platforms instead of building, run the same example through each demo. SimpliTrain, Mundrisoft’s training management product, states on its training scheduling system page that each session has its own date, time, time zone and delivery mode. You can request a demo and bring your own tightest week as the test case.

Frequently asked questions

What is the best algorithm for course scheduling?

No single algorithm wins for every provider. For small schedules, placing the most constrained sessions first, with a legality checker behind it, usually works. For large batches with many interacting preferences, a constraint solver such as CP-SAT is a common choice. Choose by schedule size, how scarce your instructors are, and how clearly planners need results explained.

What is the difference between hard and soft constraints in scheduling?

A hard constraint must hold in every schedule you publish, such as an instructor teaching two sessions at once. A soft constraint is a preference that adds a penalty when broken, such as a learner-friendly start time. Hard rules decide whether a schedule is legal, and soft rules decide which legal schedule is better.

How do you prevent double-booking an instructor?

Check for overlapping busy windows in the application, then enforce the same rule in the database so concurrent saves cannot both succeed. Use half-open time ranges, add setup, teardown and travel time to the window, and write instructor, room and equipment bookings in one transaction so a failure rolls back the whole session.

How should room capacity be enforced when learners enroll online?

Use the smaller of the room’s seats and the session’s enrollment cap, and check it again at every enrollment, not only when the session is created. Two learners can try to take the last seat at once, so the seat count must be updated in a transaction that fails cleanly when the session is full.

What happens when an instructor cancels at short notice?

Treat the cancelled assignment as a fresh problem for the affected sessions only. Keep every other session fixed, list instructors who pass qualification, availability and clash checks, rank them by soft penalty, and let a planner confirm. Changing unrelated sessions to improve the score creates more learner notices than it saves.