Case 07 / Scheduling + simulation
Production scheduling under uncertainty.
Kairos plans flexible assembly work, then replays the plan in a factory simulation. The second step reveals how processing variation, travel, calendars, and breakdowns change a schedule that looked feasible on paper.
- CP-SAT
- SPT / LPT
- EDD / WSPT
- SRPT
- McNaughton
- OR-Tools
- SimPy
- Plotly
- Streamlit
- 01 / DEFINEProduction problemJobs, operations, resources, and constraints
- 02 / PLANBuild a scheduleCP-SAT or a selected heuristic
- 03 / REPLAYSimulate executionDeterministic or stochastic factory events
- 04 / CHECKCompare outcomesTiming, feasibility, and Gantt views
- Deterministic demo
- 200operations compared one by one
- Schedule mismatches
- 0in the deterministic replay
- Stochastic experiment
- 100replications of a fixed schedule
A feasible plan is only the beginning.
Flexible assembly scheduling involves precedence between tasks, alternative machines, setup requirements, release dates, due dates, and competing objectives. A solver can satisfy those rules while still relying on idealized execution times.
The project asks a practical follow-up question: what happens to the plan when the factory runs? I wrote the factory simulation component and contributed to the wider Kairos design project. The simulator makes it possible to compare the planned operation sequence with an execution trace under controlled or uncertain conditions.
Plan, adapt, replay, validate.
Scheduling model
The scheduler assigns operations to machines and start times using OR-Tools CP-SAT or a selected scheduling heuristic. Its model includes machine no-overlap and task precedence rules, alternative resources, setup times, makespan, and tardiness.
Factory simulation
An adapter converts the schedule into simulation-ready machines, batches, routes, calendars, and events. The SimPy engine tracks actual operation timing, transfers, idle and setup time, downtime, batch completion, and unfinished work. Deterministic replay checks the adapter and execution logic; stochastic replay adds processing-time distributions, travel delays, shifts, failures, and repairs.
Validation views
Operation-level comparisons show planned versus simulated start, finish, and machine assignment. Gantt charts share a machine-oriented layout so differences are visible rather than hidden in summary statistics.
Check the plan against execution.
Two included demonstrations test different schedules. The deterministic case tests exact agreement. The stochastic case estimates variation around its own fixed baseline.
| Demonstration | Measure | Recorded result |
|---|---|---|
| Deterministic | Problem size | 35 machines · 32 jobs · 200 operations |
| Deterministic | Planned / simulated makespan | 567.0 / 567.0 hours |
| Deterministic | Mismatched operations | 0 |
| Stochastic | Replications | 100 |
| Stochastic | Baseline / mean completion | 394.00 / 457.62 hours |
| Stochastic | 95% confidence interval | 453.91–461.32 hours |
In the stochastic experiment, mean completion was 16.15% above that experiment's deterministic baseline. The repository also reports 137 automated test functions and an independent JSPLIB ft06 benchmark check that found the known makespan of 55 without feasibility violations.
What the result means.
The zero-mismatch replay supports the scheduler-to-simulator translation on the documented deterministic demonstration. The 100-replication experiment shows how execution uncertainty can change completion time for a different fixed schedule.