Manuscript Offprint

arXiv:2608.29690

Transformer-Based Flow Shop Scheduling Using MILP-Generated Training Data

Roderich Wallrath

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Advances in machine learning (ML) have created new opportunities to complement traditional operations research (OR) methods. In particular, transformer models can capture complex interactions in token sequences by mapping tokens into a high-dimensional embedding space and propagating contextual information via attention. This makes them a candidate to model non-permutation flow shop scheduling with secondary resources as a next-token prediction task, where tokens represent job-machine-secondary resource tuples. For training, mixed-integer linear programming (MILP)-generated schedules are tokenized and used as next-token prediction data. During inference, partial token sequences (prefixes) are randomly generated and completed by the trained transformer through constrained decoding. A computational study is conducted on a flow shop with 8 jobs, 4 machines, and 3 secondary resources, where jobs are selected from a fixed pool of 20 jobs that is sampled during training and provides the candidates during prefix completion. The transformer achieves better solution quality (smaller makespans) compared to a genetic algorithm (GA), the NEH heuristic, and random search. It is outperformed only by the MILP model and the iterated greedy (IG) heuristic. The study concludes that transformer models can, to some extent, learn patterns from MILP-optimized non-permutation flow shop schedules and that transformer-based scheduling represents an interesting direction for future research, particularly in settings with a fixed, recurring job set.

Keywords— Flow shop scheduling, transformer models, mixed-integer linear programming, machine learning for combinatorial optimization

1 Introduction

The continuous development of new solution methods is one of the key success factors of operations research (OR). For the well-known NP-hard optimization problem of flow shop scheduling, methods have evolved from simple heuristics to more sophisticated and compute-intensive methods like genetic algorithms (GA), mixed-integer linear programming (MILP), and constraint programming (CP), enabling better solutions in shorter times. Recently, machine learning (ML) methods have become increasingly competitive alternatives to traditional OR methods for flow shop scheduling. ML is fundamentally based on pattern recognition in large datasets [Bishop and Nasrabadi, 2006]. The fact that there are general rules to construct good flowshop schedules, such as Johnson's rule [Johnson, 1954] or the NEH heuristic [Nawaz et al., 1983], indicates that good solutions share some structural regularities, which ML methods might be able to recognize and exploit. Furthermore, two properties motivate the exploration of ML methods for flowshop scheduling. First, they are based on observations of problems through data and do not require first-principle insights into problems. In industrial practice, this can be a key advantage when first principles are unknown, do not exist, or are too complex to formalize into tractable models. Consequently, if white-box methods like discrete-event simulation (DES), MILP, or CP are used, they often result in abstract or simplified models that possess structural validity¹ but lack the depth of real-world constraints or the inherent uncertainty of model parameters. ML models, however, are trained directly on raw, uncurated data that reflect the full complexity of real-world problems. Second, ML models can leverage an efficiency principle to represent complex data. As pointed out in the Johnson-Lindenstrauss

¹However, advantages, such as results explainability, extrapolation capability in data-sparse settings, rigorous validation, and the possibility to enforce constraints, result from structural validity.

lemma [Johnson et al., 1984], high-dimensional data can be mapped into a lower-dimensional space while approximately preserving the pairwise distances between datapoints. This principle enables ML models to map complex datasets into very compact representations without substantial loss of multidimensional structure, which raises the question of whether ML models can also learn to approximate NP-hard optimization problems like flowshop scheduling.

Motivated by advances in large language models (LLMs), this work investigates whether transformer models [Vaswani et al., 2017] can learn the language of optimal flow shop schedules. In a flow shop, operations can be interpreted as tokens, and a schedule as a structured sequence of tokens, analogous to a sentence. LLMs can restore syntactic and semantic coherence when a single word is modified, even if this requires rearranging the whole sentence. Similarly, in flow shops, changing a single job can render the entire schedule suboptimal due to precedence, machine, and secondary-resource interactions and necessitate global reordering. By using attention mechanisms [Bahdanau et al., 2014], transformer networks have demonstrated strong capability in modeling long-range and high-order interactions in discrete sequences. This makes them a candidate for learning the combinatorial optimization problem of flow shop scheduling.

To date, research on learning-based scheduling has mainly been focused on reinforcement learning (RL) featuring different neural network architectures [Wang et al., 2023a, Gebreyesus et al., 2024, Zhang et al., 2020], enhancements of the agent training loop like imitation learning or self-labeling [Pan et al., 2023, Li et al., 2024, Corsini et al., 2024], and clever reward or action space design [Wang et al., 2021, Shahrabi et al., 2017]. In contrast, this work uses supervised learning [Kotary et al., 2022, Ingimundardottir and Runarsson, 2018]. A decoder-only transformer is trained in next-token prediction on MILP-generated schedules of a non-permutation flow shop. The flow shop is studied on a fixed, recurring job pool and under limited secondary resources, which reflects individual problem instances, like weekly production planning in a plant over an established product portfolio. The goal of this work is to show at a limited problem scale that a generic sequence model such as the transformer can learn and reproduce patterns of rigorously optimized non-permutation flow shop schedules.

Next, the paper reviews related work. Thereafter, transformer-based flow shop scheduling is introduced, which is followed by a computational study and a concluding discussion.

References (29)