This repository provides a portable implementation of the production-sequencing optimiser presented in “Machine learning and metaheuristic to optimise production scheduling in off-site construction factories”, accepted for the 19th International Conference on Integrated Modeling and Analysis in Autonomous Control and Cognitive Agents (IMAACA 2026), within I3M 2026.
The optimiser sequences products on a single semi-automated machine. It balances deadline performance against coil-change setup time while respecting weekday-only production and a fixed daily shift. In the wider cyber-physical system described by the paper, predicted machine work times become the optimiser input and the resulting sequence is returned to a manufacturing decision-support system.
The machine-learning work-time prediction stage is documented separately in asbaragli10/cycle-time-ml-benchmark. This repository focuses only on the simulated-annealing scheduler.
![]() |
![]() |
| Cyber-layer workflow linking work-time prediction to the sequence optimiser. | Case-study workload and coil configurations across production deadlines. |
For products
is a permutation of those products. A setup of duration
Work and setup may continue across multiple shifts. Saturdays and Sundays are non-working days. Once completion times have been simulated, the optimiser minimises
where [1, 10, 50, 200, 500, 1000].
Neighbourhoods are registered independently from the simulated-annealing engine. The four paper benchmarks and their hybrid are exposed through --moves:
| Paper move | CLI name | Scope | Entity | Move logic |
|---|---|---|---|---|
| Single swap global (SSG) | single_global |
Global | Product | Swap two products with different coil configurations. |
| Single swap within deadlines (SSwD) | single_deadline |
Deadline-constrained | Product | Swap different-coil products sharing a deadline. |
| Block swap within deadlines (BSwD) | block_deadline |
Deadline-constrained | Block | Remove a contiguous same-coil block and reinsert it within the same deadline. |
| Block swap global (BSG) | block_global |
Global | Block | Swap two contiguous blocks with different coils, independently of deadline. |
| Hybrid | multiple weighted names | Mixed | Block | Sample BSwD or BSG for each candidate. |
The default hybrid gives equal weight to block_deadline and block_global. To remove a move, omit it from the command; to use only one, provide only that name. Weights are normalised automatically:
# Default 50/50 block hybrid
python main.py --moves block_deadline=1 block_global=1
# Deadline-constrained block moves only
python main.py --moves block_deadline
# Custom weighted hybrid
python main.py --moves single_global=1 block_deadline=2 block_global=1Run python main.py --list-moves to see the complete registry. New moves only need the common function signature and one entry in machine_sequence_optimiser/neighbourhoods/selector.py.
The search starts from a stable Earliest Deadline First sequence. Unless --initial-temperature is supplied, it samples neighbours of this initial sequence, takes the 90th percentile absolute cost change, and calibrates the starting temperature for the requested acceptance probability.
At every temperature step, candidate sequences are generated and evaluated in mini-batches. Lower-cost candidates satisfy the acceptance rule directly; higher-cost candidates may pass the Metropolis criterion. The lowest-cost acceptable candidate in each batch becomes the current solution, while the best solution seen across the complete run is retained.
--workers 1 uses a deterministic single-process path suitable for examples and debugging. Any value greater than one enables a reusable process pool, while --workers 0 uses all detected CPU cores.
In the reported industrial case study, the hybrid search converged in 24.6 minutes, reduced setup time from 62 to 2 hours, and delivered 92.54% of products on time. These are the case-study results reported in the accompanying paper.
The optimiser reads a CSV containing four required fields:
| Column | Type | Description |
|---|---|---|
AssemblyRef |
string | Product or assembly identifier. |
Coil |
string or integer | Coil configuration; a change introduces setup time. |
Work Time |
positive number | Predicted machine processing time in seconds. |
Deadline |
date | Latest acceptable completion date in YYYY-MM-DD or DD-Mon-YY form. |
| Path | Purpose |
|---|---|
main.py |
Portable command-line workflow: load, calibrate, optimise, evaluate, and save. |
machine_sequence_optimiser/data/ |
CSV parsing, schema validation, and deadline preparation. |
machine_sequence_optimiser/initialisation/ |
Earliest Deadline First initial sequence. |
machine_sequence_optimiser/scheduling/ |
Weekday calendar and daily-shift simulation. |
machine_sequence_optimiser/objectives/ |
Weighted tardiness, severity, and setup objective. |
machine_sequence_optimiser/neighbourhoods/ |
Single- and block-swap moves plus their weighted registry. |
machine_sequence_optimiser/optimisation/ |
Temperature calibration and parallel mini-batch simulated annealing. |
machine_sequence_optimiser/evaluation/ |
Operational reports and portable CSV/JSON writers. |
examples/ |
Standalone Himmelblau and quadratic-assignment teaching examples. |
figs/ |
Figures describing the cyber layer and case-study workload. |
pdfs/ |
Accepted IMAACA 2026 paper. |
Python 3.10 or newer is recommended.
python -m venv .venvActivate the environment, then install the project:
python -m pip install --upgrade pip
python -m pip install -e .Optional plotting dependencies for examples/ can be installed with:
python -m pip install -e ".[examples]"Run the complete workflow with a schedule CSV:
python main.py --data path/to/schedule.csvFor a parallel full-size experiment:
python main.py \
--data path/to/schedule.csv \
--moves block_deadline=1 block_global=1 \
--temperature-steps 20 \
--neighbours-per-step 17670 \
--workers 12 \
--output-dir outputs/full_runPowerShell accepts the same arguments; place the command on one line or use PowerShell's backtick continuation character instead of the Bash backslashes shown above.
The output directory contains:
initial_schedule.csvandbest_schedule.csv;daily_utilization.csvanddelay_distribution.csv;cost_history.csv;run_summary.json, including the active moves and all run parameters.
No operating-system-specific path is embedded in the code. All input and output locations are command-line paths resolved from the current working directory.
The accompanying paper has been accepted for IMAACA 2026. The full proceedings citation will be added when it becomes available:
A. Sbaragli, X. Xie, Y. Wang, and M. Kassem, “Machine learning and metaheuristic to optimise production scheduling in off-site construction factories,” IMAACA 2026, forthcoming.

