Skip to content

Repository files navigation

Multi-threaded simulated annealing for industrial machine scheduling

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 connecting work-time prediction and simulated annealing Aggregate work time and coil configurations across deadlines
Cyber-layer workflow linking work-time prediction to the sequence optimiser. Case-study workload and coil configurations across production deadlines.

Optimisation problem

For products $i=1,\ldots,N$, the input specifies a product identifier, coil configuration, machine work time, and deadline. A candidate solution

$$ X=(x_1,\ldots,x_k,\ldots,x_N) $$

is a permutation of those products. A setup of duration $T_{setup}$ is introduced whenever consecutive products require different coils:

$$ S_1=0, \qquad S_k = \begin{cases} T_{setup}, & \text{if } Coil_{x_k} \neq Coil_{x_{k-1}},\\ 0, & \text{otherwise.} \end{cases} $$

Work and setup may continue across multiple shifts. Saturdays and Sundays are non-working days. Once completion times have been simulated, the optimiser minimises

$$ J(X)=W_{tardiness}\sum_{k=1}^{N}R_{x_k} +W_{severity}\frac{1}{N}\sum_{k=1}^{N}RR_{x_k} +W_{setup}\sum_{k=2}^{N}S_k, $$

where $R_{x_k}$ is product tardiness and $RR_{x_k}$ is its severity score. The default delay thresholds are 6 hours, 12 hours, 24 hours, 3 days, and 7 days, with scores [1, 10, 50, 200, 500, 1000].

Benchmarked neighbourhood moves

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=1

Run 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.

Parallel simulated annealing

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.

Dataset interface

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.

Repository structure

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.

Installation

Python 3.10 or newer is recommended.

python -m venv .venv

Activate 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]"

Running the optimiser

Run the complete workflow with a schedule CSV:

python main.py --data path/to/schedule.csv

For 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_run

PowerShell 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.csv and best_schedule.csv;
  • daily_utilization.csv and delay_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.

Citation

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.

About

Parallel simulated annealing for setup- and deadline-aware machine scheduling in off-site construction, with modular neighbourhoods and calendar-aware evaluation

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages