Dynamic Scheduling Optimization Method for Flexible Job Shop Based on Digital Twin
Abstract:
With the in-depth implementation of the “Industry 4.0” and “Dual Carbon” strategies, the manufacturing of reducer boxes is accelerating its transformation towards intelligence and greenization. To address the frequent dynamic disturbances such as machine failures and urgent order insertions in actual production, as well as the difficulty for traditional scheduling methods to balance production efficiency and green energy saving, a green dynamic scheduling optimization method for flexible job shop driven by digital twin is proposed. First, a digital twin dynamic scheduling framework comprising a physical workshop, a virtual workshop, and a service system is constructed, and a high-fidelity simulation model of the reducer box flexible production line is built based on AnyLogic. Second, a multi-objective dynamic scheduling mathematical model is established by comprehensively considering the makespan, energy consumption, and rescheduling machine deviation. An Improved Multi-Objective Artificial Bee Colony (IMOABC) algorithm is designed to solve the problem, which enhances the global exploration and local exploitation capabilities by fusing Improved Precedence Operation Crossover (IPOX), uniform crossover strategies, and a variable step-size neighborhood search mechanism. Finally, multi-dimensional comparative validation is conducted based on standard benchmark instances and a reducer box manufacturing case. The results demonstrate that the proposed method can effectively cope with dynamic disturbances and outperforms traditional scheduling strategies in shortening production cycles, reducing equipment energy consumption, and maintaining system stability.1. Introduction
With the in-depth advancement of the “Industry 4.0” and “Dual Carbon” strategies, the manufacturing of reducer boxes is accelerating toward intelligence and greenization, and its production process exhibits typical characteristics of the Multi-Objective Flexible Job Shop Scheduling Problem (MOFJSP). Early studies mainly focused on time efficiency optimization under ideal static environments; however, the actual production shop is full of dynamic uncertainty, and disturbance events such as machine failures and urgent order insertions occur frequently, often leading to the failure of preset scheduling schemes. For machine failure disturbances, He and Sun [1] introduced multiple strategies combining idle time insertion, route change, and right-shift, and enhanced the robustness and stability of the system in response to machine failures by using a rescheduling algorithm. For the impact of urgent order insertions, He et al. [2] established a multi-constraint model and achieved rapid response to dynamic orders through the Non-dominated Sorting Genetic Algorithm III. In addition, to meet the requirements of green manufacturing, Küster et al. [3] analyzed the power differences of equipment states and proposed a multi-objective collaborative optimization method to simultaneously consider makespan and energy consumption. Liu et al. [4] developed a deep reinforcement learning-based hierarchical distributed framework for dynamic flexible job shop scheduling to enable real-time decision-making under continuous job arrivals. Luo [5] investigated the dynamic flexible job shop scheduling problem with new job insertions and proposed a deep Q-network method to achieve adaptive dispatching in real time.
Facing the high-dimensional Nondeterministic Polynomial-time hard problem with the coupling of energy consumption and dynamic disturbances, traditional algorithms are prone to falling into local optima. Therefore, researchers first focused on algorithm mechanism innovation. Mahmud et al. [6] designed a hybrid evolutionary algorithm based on switching strategies, balancing global exploration and local exploitation capabilities. Wang et al. [7] proposed an Artificial Bee Colony algorithm, combined with multi-strategy initialization and a local search based on the critical path, significantly optimizing the makespan of flexible job shop scheduling. Liu et al. [8] combined Digital Twin to construct an adaptive scheduling mechanism, further improving the ability of the algorithm to cope with processing fluctuations. At the same time, Digital Twin technology provides a new paradigm for the closed-loop verification of scheduling schemes. Sun et al. [9] designed an intelligent manufacturing system framework based on Digital Twin, realizing real-time monitoring of shop floor states. Liu et al. [10], for the scheduling optimization problem under the multi-variety small-batch production mode, constructed a “feature–process–machine tool” hypernetwork model based on the Digital Twin workshop, realizing centralized management of multi-type data and rapid and efficient generation of intelligent scheduling schemes. Wang and Wu [11], aiming at the problem that uncertainty factors affect shop scheduling, constructed a planning and scheduling system based on Digital Twin, realizing the control of uncertainty factors in production activities and the guidance of actual production. Asorose and Adams [12] integrated Lean Six Sigma methods with Digital Twin technology, constructed a data-driven decision system, and realized predictive optimization and efficiency improvement of supply chain and production operation processes. Chen et al. [13] proposed a digital twin-oriented collaborative optimization method for fuzzy flexible job shop scheduling under multiple uncertainties, considering processing time, due date, and maintenance cycle simultaneously. Luo et al. [14] proposed a deep reinforcement learning-based dynamic multi-objective scheduling framework for flexible job shops to handle disturbances such as new job insertions and machine breakdowns. Caldeira et al. [15] studied a MOFJSP considering new job arrivals and energy consumption, and solved it using an improved backtracking search algorithm.
In view of this, this paper proposes a joint optimization method for green dynamic flexible job shop driven by Digital Twin. First, a multi-objective dynamic scheduling model is established by comprehensively considering makespan, energy consumption, and machine deviation. Second, an Improved Multi-Objective Artificial Bee Colony (IMOABC) algorithm integrating Improved Precedence Operation Crossover (IPOX) and variable step-size search is designed to solve the problem. Finally, a workshop Digital Twin system is constructed based on AnyLogic to realize the dynamic verification of scheduling schemes.
2. Problem Description and Model Establishment
Aiming at the deficiency that traditional MOFJSP studies often ignore dynamic disturbances, this paper focuses on the scheduling optimization problem in workshops under random events such as machine failures and urgent order insertions. This problem can be described as: under the premise of satisfying given process constraints, $n$ reducer box workpieces set $\{P_1\text{,}\ P_2\text{,}\ \dots\text{,}\ P_n\}$ and their corresponding sequence of $J_i$ operations $\{O_{i1}\text{,}\ O_{i2}\text{,}\ \dots\text{,}\ O_{iJ_i}\}$ are reasonably assigned to $m$ processing machines set $\{M_1\text{,}\ M_2\text{,}\ \dots\text{,}\ M_m\}$. Due to varying equipment performance, identical operations differ greatly in processing time and energy consumption across machines. Against this backdrop, a rescheduling strategy is adopted to timely revise and reoptimize the initial scheduling scheme under dynamic disturbances, reducing disturbance impacts and ensuring efficient workshop production.
The relevant symbols of the model and their meanings are shown in Table 1.
| Indices | Description |
|---|---|
| $i$ | Index of workpiece |
| $j$ | Index of operation |
| $k$ | Index of machine |
| Parameters | Description |
| $n$ | Number of workpieces |
| $m$ | Number of machines |
| $J_i$ | Number of operations of workpiece $i$ |
| $O_{ij}$ | The $j$-th operation of workpiece $i$ |
| Variables | Description |
| $JF_i$ | Completion time of workpiece $i$ |
| $MF_k$ | Completion time of machine $k$ |
| $M_{ij}$ | Set of alternative machines for operation $O_{ij}$ |
| $MS^k_l$ | Start processing time of the $l$-th operation on machine $k$ |
| $MF^k_l$ | Finish processing time of the $l$-th operation on machine $k$ |
| $S_{ijk}$ | Start processing time of operation $O_{ij}$ on machine $k$ |
| $F_{ijk}$ | Finish processing time of operation $O_{ij}$ on machine $k$ |
| $P_{ijk}$ | Processing time of operation $O_{ij}$ on machine $k$ |
| $WP_k$ | Unit processing energy consumption of machine $k$ |
| $IP_k$ | Unit idle energy consumption of machine $k$ |
| $P(X_{ijk})$ | Probability that operation $O_{ij}$ is processed on machine $k$ |
| $T_{d1}$ | Time of machine failure occurrence |
| $M_k$ | Failed machine |
| $T_r$ | Expected repair time |
| $O_{i^*j^*}$ | Operation being processed when machine failure occurs |
| $\Omega_{insert}$ | Set of urgent inserted orders |
| $Md_{ij}$ | Machine change status of the $j$-th operation of workpiece $i$ |
| $MS_{ij}$ | Processing machine of the $j$-th operation of workpiece $i$ in the original scheduling scheme |
| $MS'_{ij}$ | Processing machine of the $j$-th operation of workpiece $i$ in the rescheduling scheme |
| Decision Variables | Description |
| $P_k$ | Decision variable, machine $k$ is in processing state, $P_k=1$, otherwise $P_k=0$ |
| $X_{ijk}$ | Decision variable, operation $O_{ij}$ is processed on machine $k$, $X_{ijk}=1$, otherwise $X_{ijk}=0$ |
Considering the complexity of the actual production system, the model is simplified as follows without loss of generality.
(1) All workpieces and machines are available at the initial time, and each machine can only process one task at the same time.
(2) Except for passive interruption caused by machine failure, the operation process is continuous and indivisible.
(3) The energy consumption model only considers processing energy consumption and idle energy consumption under steady state, ignoring transient fluctuations.
(4) For dynamic events, the executed scheduling scheme before time \(T_{d1}\) or \(T_{d2}\) is set as rigid constraints and remains unchanged, and only subsequent operations are reconstructed.
(5) It is assumed that the algorithm response is real-time, and the computational time cost of rescheduling decision is ignored.
This paper considers makespan, energy consumption, and machine deviation to construct the objective functions and establish constraints:
(1) Makespan \(C_{\max}\) is a key indicator to evaluate workshop production efficiency. The objective function of minimizing makespan is \(f_1\), that is:
(2) Total energy consumption $E_{\text {all}}$ can be divided into processing energy consumption $E_{\text {busy}}$ when the machine is in processing state and idle energy consumption $E_{\text {idle}}$ when the machine is in standby state. The objective function of minimizing energy consumption is $f_2$, that is:
(3) Machine deviation $D_{\text {all}}$ reflects the deviation between the actual processing machines of each operation in the rescheduling scheme and those in the original scheduling scheme. The objective function of minimizing machine deviation is $f_3$:
The constraints are established as follows:
Eq. (7) indicates that once an operation starts, it cannot be switched midway. Eq. (8) strictly constrains the process sequence relationship among operations of the same workpiece. In terms of resource exclusivity constraints, Eqs. (9), (12), and (13) jointly constitute machine capacity constraints, ensuring that each machine can only process one task at any time and each operation is assigned to only one processing unit. Eq. (10) indicates that the completion time of any operation must not exceed the makespan. Eq. (11) introduces the decision variable $X_{i j}^k$ to indicate whether a specific operation is affected by machine failure disturbance. Eq. (14) is physical constraints to ensure that all variables related to start time, finish time, and duration satisfy non-negativity requirements.
3. Scheduling Solution Method Based on Improved Multi-objective Artificial Bee Colony Algorithm
The reasonable and refined design of the encoding mechanism serves as an essential prerequisite for realizing accurate and effective mapping from the complex scheduling solution space to the limited algorithm search space in intelligent optimization solving.
This paper constructs a two-layer hybrid encoding structure including Operation Sequence (OS) and Machine Sequence (MS). In this structure, the lengths of the OS segment and MS segment are both equal to the total number of operations of the workpieces to be processed, which are used to represent the processing order of operations and machine assignment decisions, respectively.
Figure 1 takes the scheduling of 4 types of workpieces on 5 machines as an example to illustrate the feasible solution form of this encoding scheme. Through specific decoding operations, the chromosome sequence can be transformed into a uniquely determined scheduling scheme, thereby realizing the digital representation of the complex scheduling process.

The population initialization process should first respond to the real-time state constraints of the workshop. When a machine failure disturbance event occurs, the algorithm locks the interrupted operation of the workpiece currently being processed and re-inserts it into the available time window after machine repair; when an urgent order insertion disturbance event occurs, the system automatically integrates the new orders into the current unfinished queue. Subsequently, the initial solution set is generated using a random distribution function. The parameter $x_{id}$ of the $d$-th dimension of the $i$-th food source $x_i$ in the population can be expressed as:
where, $L_d$ represents the lower bound of the search space, and $U_d$ represents the upper bound of the search space.
There is a one-to-one correspondence between employed bees and food source positions. For the OS part, this paper adopts the IPOX crossover strategy to adjust the processing order of workpieces, so as to avoid generating infeasible solutions. As shown in Figure 2, the specific steps are as follows: first, all workpieces to be processed are randomly divided into two complementary subsets, Subset 1 and Subset 2. When generating offspring $C_1$, the operations belonging to Subset 1 in parent $P_1$ are directly copied into $C_1$ according to their original positions in $P_1$; then, the operations belonging to Subset 2 in parent $P_2$ are identified and sequentially filled into the remaining vacant positions of $C_1$ according to their order in $P_2$. The generation process of offspring $C_2$ is similar.

For the optimization of the MS dimension, a uniform crossover strategy is introduced to reconstruct the machine assignment scheme.
As shown in Figure 3, this strategy first generates a binary mask vector with the same length as the chromosome as the crossover template. Under the control of this template, the algorithm performs bitwise selection for each operation of the workpiece: for positions where the mask value is “0”, the offspring directly inherits the machine gene at the corresponding position of the parent; for positions where the mask value is “1”, the gene exchange mechanism is triggered, that is, the machine encoding of parent $MF_1$ is passed to offspring $MC_2$, and conversely, the encoding of $MF_2$ is passed to $MC_1$. Through this position-based random exchange, the recombination of processing resources among offspring is realized.

In the employed bee search stage, in order to ensure the evolution quality of scheduling solutions, this paper adopts a two-level greedy selection mechanism combining Pareto dominance and crowding distance to update the population.
The first level is dominance judgment: comparing the superiority between the newly generated solution $x^*$ and the original solution $x$. If $x^*$ dominates $x$, the new solution directly replaces the old solution, and the stagnation counter $\operatorname{Trail}_i$ is reset to zero; otherwise, if $x$ dominates $x^*$, the original solution is retained and the counter is increased. The second level is diversity judgment: when the two are non-dominated, the crowding distance is introduced as the evaluation indicator.
The individual with a larger crowding distance is preferentially retained to maintain the distribution breadth of the solution set. In addition, to prevent the loss of elite solutions, all generated non-dominated solutions are stored in the external archive, and the specific state transition rule of the stagnation counter is shown in Eq. (16).
The main task of onlooker bees is to perform in-depth exploitation of high-quality solutions transmitted by employed bees. In order to balance the global exploration and local exploitation capabilities of the algorithm in a multi-objective environment, this section designs a probability selection mechanism based on Pareto rank and a variable step-size search strategy.
(1) Probability Selection Based on Pareto Rank
Since there is no single optimal solution in multi-objective optimization, the fitness cannot be directly calculated using function values. Therefore, this paper introduces Pareto dominance rank and crowding distance to construct the fitness evaluation system.
As shown in Eqs. (17) and (18), the higher the Pareto rank of an individual, the more solutions it dominates, the larger its fitness value $\mathrm{fit}_i$, and the higher the probability $P_i$ of being selected by the onlooker bee through the roulette wheel mechanism, ensuring that computational resources in the population are biased toward high-quality individuals.
where, $i$ represents the index of the selected individual, $\mathrm{fit}_i$ represents the comprehensive fitness value of the individual, $\mathrm{rank}(i)$ denotes the Pareto non-dominated level of individual $i$ in the current population, and $m^i$ is used to count the number of inferior solutions dominated by individual $i$.
(2) Variable Step-Size Neighborhood Search Mechanism
The traditional fixed step-size search method is difficult to balance convergence speed and the ability to escape from local optima. Therefore, this paper introduces a search threshold $T$ to dynamically adjust the search step size.
When the number of searches for a solution is small, a small step-size strategy is adopted, in which only one pair of genes in the OS is exchanged to deeply explore the neighborhood of the current solution and accelerate convergence. When the solution has not been updated after multiple searches, a large step-size strategy is adopted, in which multiple pairs of operation genes are exchanged to expand the search radius, helping the algorithm escape from local optima and explore unknown solution space.
In this paper, insertion mutation is adopted for the OS layer, and random mutation within the alternative machine set is applied for the MS layer. Finally, the offspring individual with better fitness is retained and the external archive is updated.
The scout bee operation is mainly responsible for monitoring the population state and introducing new solutions when necessary. In order to ensure that excellent gene fragments are not lost during the evolution process, an elitism strategy is adopted to construct the next generation population. Specifically, the parent population of $N$ food source positions generated by initialization is denoted as $F$. The parent population $F$ and the offspring population $C$ generated by crossover and mutation are merged and denoted as $F \cup C$. Then, fast non-dominated sorting and crowding distance calculation are performed on the mixed population. According to the principle of “Pareto rank priority and crowding distance secondary”, the top $N$ optimal individuals are selected to enter the next generation population $P$.
While updating the population, the algorithm monitors the activity of each food source in real time through the exploitation degree $\mathrm{Trail}_i$. If the individual entering the next generation comes from the offspring population $C$, it indicates that evolution has occurred at this position, and the exploitation degree is reset to zero; if the individual still comes from the parent population $F$, it indicates stagnation, and the exploitation degree is accumulated. The update logic is shown in Eq. (19).
When the exploitation degree $\mathrm{Trail}_i$ of a food source exceeds the maximum exploitation degree $\mathrm{Limit}$, the solution is considered to have fallen into a local optimum trap.
At this time, the scout bee operation is triggered, the inferior solution is abandoned, and a new food source position is randomly generated in the solution space to replace it.
This mechanism introduces random disturbance and provides the possibility for the algorithm to escape from local optima in the later stage.
When solving the dynamic scheduling problem, due to the mutual restriction among the three objective functions, the algorithm finally generates a set of non-dominated Pareto optimal solution sets. However, in the actual workshop production site, when facing sudden disturbances such as machine failures or urgent order insertions, the scheduling system must quickly and decisively select a specific execution scheme from the solution set.
At present, the linear weighted method is commonly used. The linear weighted method with $n$ objectives can be defined as:
In Eq. (20), $\omega_i$ is the weight coefficient of the $i$-th objective function; $f_i^{\prime}$ is the normalized value of the $i$-th objective value $f_i$, which is calculated as follows:
where, $f_i^{\max }$ and $f_i^{\min }$ are the maximum and minimum values of $f$, respectively.
The IMOABC algorithm involves multiple new selection and search steps. The pseudocode of the algorithm is shown in Algorithm 1.
Algorithm 1 Algorithm pseudocode | |
Input: population size $N$, maximum iteration number $G e n_{\max }$, maximum exploitation degree Limit, search threshold $T$ Output: Pareto front solution set $\Omega$ | |
1 | $P, \Omega=$ PopInitialization() //Initialize population and construct external archive |
2 | while iteration < $G e n_{\text {max }}$ do |
3 | for each employed bee $X_i$ |
4 | $V_i=$ HybridCrossover $\left(X_i\right) / /$ Perform Improved Precedence Operation Crossover (IPOX) and multi-point crossover |
5 | ParetoGreedySelect $\left(X_i, V_i\right) / /$ Update solution and archive $\Omega$ based on dominance |
6 | end for |
7 | Calculate $\operatorname{Prob}(P)$ //Calculate selection probability based on Pareto rank and crowding distance |
8 | for each Onlooker bee (selected based on probability) |
9 | if Trail$_i$ < $T$ then |
10 | $V_i=$ SmallStepSearch $\left(X_i\right) / /$ Perform small step-size mutation |
11 | else |
12 | $V_i=$ BigStepSearch $\left(X_i\right) / /$ Perform large step-size mutation |
13 | end if |
14 | ParetoGreedySelect $\left(X_i\text{,}\ V_i\right) / /$ Greedy selection to update current food source |
15 | end for |
16 | for each Scout bee $X_i$ |
17 | if $X_i>$ Limit then |
18 | ReInitialize $\left(X_i\right)$ //Randomly reset the food source trapped in local optimum |
19 | end if |
20 | end for |
21 | ArchiveMaintain $(\Omega) / /$ Remove individuals with smallest crowding distance to maintain archive size |
22 | $Gen$ = $Gen$ +1 |
23 | end while |
24 | return $\Omega$ |
4. Simulation Experiments and Result Analysis
To fully verify the feasibility and effectiveness of the improved IMOABC algorithm proposed in this paper for practical workshop scheduling problems, comprehensive simulation experiments under both static scheduling and dynamic disturbance-based scheduling scenarios are reasonably established, and the experimental results are further summarized and analyzed in detail.
The relevant parameter settings of the IMOABC algorithm are as follows: population size $N$ = 200, maximum iteration number $\mathrm{Gen}_{\max}$ = 200, crossover probability $P_c$ = 0.8, mutation probability $P_m$ = 0.2, maximum exploitation degree $\mathrm{Limit}=20$, and strategy switching threshold $\mathrm{Threshold}$ = 5. The objective weights are set as follows: makespan weight $w_1$ = 0.64, energy consumption weight $w_2$ = 0.10, machine deviation weight $w_3$ = 0.26. The idle energy consumption of workshop machines is a random number in $[ 0\text{,}1]$, and the processing energy consumption is a random number in $[ 1\text{,}3]$.
The simulation test results based on benchmark instances are shown in Table 2, which further verify the advantages of the proposed algorithm in solving the MOFJSP problem. Among the 7 test cases, the scheduling schemes generated by this algorithm show obvious performance advantages in efficiency, energy consumption, and load balancing; among them, 6 cases achieve complete dominance over the solution sets of traditional algorithms.
Instance Set | ID | n × m | Traditional Artificial Bee Colony | Proposed Method | |||||
C$_\text{max}$ | E$_\text{all}$ | D$_\text{all}$ | C$_\text{max}$ | E$_\text{all}$ | D$_\text{all}$ | ||||
Kacem test set | K01 | 4 × 5 | 12.4 | 32.5 | 64.51 | 11.3 | 32.0 | 63.12 | |
K02 | 10 × 7 | 12.5 | 60.3 | 135.50 | 12.4 | 60.2 | 135.44 | ||
K03 | 10 × 10 | 10.1 | 42.6 | 87.95 | 8.4 | 41.8 | 88.26 | ||
K04 | 15 × 10 | 16.9 | 93.0 | 201.82 | 13.7 | 91.7 | 198.89 | ||
Brdata dataset | B05 | 6 × 10 | 51.8 | 153.5 | 322.24 | 45.9 | 152.1 | 309.06 | |
B06 | 10 × 6 | 36.3 | 142.8 | 305.82 | 33.2 | 141.3 | 312.14 | ||
B07 | 15 × 8 | 240.2 | 846.8 | 2256.18 | 242.0 | 872.8 | 2142.35 | ||
B08 | 15 × 4 | 192.4 | 676.9 | 1338.12 | 188.5 | 675.9 | 1327.80 | ||
In this paper, a complete Digital Twin simulation system oriented to the actual production of the reducer box flexible workshop is systematically constructed based on the mature AnyLogic simulation platform. Meanwhile, a reasonable two-dimensional comparative validation experiment is specially designed to conduct quantitative comparison and analysis. Under the unexpected machine failure disturbance scenario, the classic traditional “right-shift rescheduling strategy” is introduced as the baseline comparison method to intuitively analyze and discuss the practical optimization effect and application performance of the proposed IMOABC algorithm. Under the sudden urgent order insertion scenario, the common “original scheduling delay strategy” is selected as the control group, so as to comprehensively evaluate the machine load balancing capability and overall system robustness of the algorithm when coping with random sudden production loads.
The workshop is equipped with 8 machines and can produce 8 different types of workpieces. The relevant parameters are shown in Table 3. The processing energy consumption and idle energy consumption of machines are shown in Table 4.
Workpiece | Operation | Time of Operations | |||||||
$M_1$ | $M_2$ | $M_3$ | $M_4$ | $M_5$ | $M_6$ | $M_7$ | $M_8$ | ||
$J_1$ | $O_{11}$ | 8 | 10 | 5 | |||||
$O_{12}$ | 13 | 15 | |||||||
$O_{13}$ | 9 | 20 | 12 | 22 | |||||
$J_2$ | $O_{21}$ | 13 | 16 | 14 | |||||
$O_{12}$ | 11 | 16 | 9 | ||||||
$J_3$ | $O_{31}$ | 11 | 13 | 15 | 11 | ||||
$O_{32}$ | 6 | 12 | 19 | ||||||
$O_{33}$ | 8 | 18 | 25 | ||||||
$O_{34}$ | 18 | 22 | 28 | ||||||
$J_4$ | $O_{41}$ | 14 | 17 | ||||||
$O_{42}$ | 13 | 15 | 19 | 18 | |||||
$O_{43}$ | 20 | 19 | 22 | 21 | |||||
$O_{44}$ | 7 | 10 | 8 | 11 | 9 | ||||
$J_5$ | $O_{51}$ | 22 | 17 | 23 | |||||
$O_{52}$ | 18 | 19 | |||||||
$O_{53}$ | 19 | 17 | 16 | 16 | |||||
$J_6$ | $O_{61}$ | 16 | 17 | 15 | |||||
$O_{62}$ | 22 | 20 | 22 | ||||||
$O_{63}$ | 11 | 10 | 15 | ||||||
$J_7$ | $O_{71}$ | 14 | 10 | 12 | 19 | 16 | |||
$O_{72}$ | 8 | 13 | 11 | ||||||
$O_{73}$ | 14 | 16 | |||||||
$O_{74}$ | 18 | 16 | |||||||
$O_{75}$ | 10 | 15 | 16 | 18 | 8 | ||||
$J_8$ | $O_{81}$ | 7 | 6 | 5 | 10 | ||||
$O_{82}$ | 18 | 17 | 18 | ||||||
$O_{83}$ | 10 | 12 | 18 | ||||||
$O_{84}$ | 8 | 11 | 8 | 9 | |||||
| Energy Type | $\boldsymbol{M_1}$ | $\boldsymbol{M_2}$ | $\boldsymbol{M_3}$ | $\boldsymbol{M_4}$ | $\boldsymbol{M_5}$ | $\boldsymbol{M_6}$ | $\boldsymbol{M_7}$ | $\boldsymbol{M_8}$ |
|---|---|---|---|---|---|---|---|---|
| Processing energy consumption $WP_k$ | 2.1 | 1.5 | 1.8 | 2.3 | 2.4 | 2.7 | 3.2 | 1.8 |
| Idle energy consumption $IP_k$ | 0.6 | 0.4 | 0.3 | 0.4 | 0.5 | 0.3 | 0.6 | 0.5 |
To better illustrate the problem, the Gantt chart of the initial scheduling scheme is set as shown in Figure 4. On this basis, the initial scheduling scheme is rescheduled.

(1) Dynamic Scheduling Analysis under Machine Failure
Assume that machine $M_4$ fails at the 20th minute, and the duration is 10 minutes. The results of makespan $C_{\max}$, energy consumption $E_{\text{all}}$, and machine deviation $D_{\text{all}}$ under the right-shift rescheduling strategy and the complete rescheduling strategy based on the IMOABC algorithm are shown in Table 5.
| Scheduling Scheme | $\boldsymbol{C_\mathrm{max}}$ | $\boldsymbol{E_\mathrm{all}}$ | $\boldsymbol{D_\mathrm{all}}$ |
|---|---|---|---|
| Right-shift rescheduling | 87 | 360.0 | 15.76 |
| Complete rescheduling | 68 | 307.0 | 9.11 |
The production scheduling Gantt charts generated based on the right-shift rescheduling strategy and the complete rescheduling strategy are shown in Figure 5 and Figure 6, respectively.


The results show that, compared with the right-shift rescheduling strategy, the production scheduling scheme generated by the complete rescheduling strategy reduces the makespan $C_{\max}$ by 21.8% and decreases the energy consumption $E_{\text{all}}$ by 14.7%. This result fully demonstrates that, in response to this machine failure disturbance event, the complete rescheduling strategy has better performance in improving scheduling robustness and maintaining the stability of the workshop system.
(2) Dynamic Scheduling Analysis under Urgent Order Insertion
An urgent order insertion occurs at the 20th minute, introducing two urgent workpieces $J_4$ and $J_6$ marked as $NJ_4$ and $NJ_6$. The workshop’s original strategy schedules urgent tasks after ongoing workpieces, while the complete rescheduling strategy reoptimizes all unprocessed and urgent operations after the disturbance. Key indicators including makespan $C_{\max}$, energy consumption $E_{\text{all}}$ and machine deviation $D_{\text{all}}$ of the two scheduling methods are summarized in Table 6.
| Scheduling Scheme | $\boldsymbol{C_\mathrm{max}}$ | $\boldsymbol{E_\mathrm{all}}$ | $\boldsymbol{D_\mathrm{all}}$ |
|---|---|---|---|
| Original rescheduling | 149 | 471.0 | 21.40 |
| Complete rescheduling | 71 | 453.0 | 6.84 |
The detailed production scheduling Gantt charts corresponding to the two scheduling methods, which are separately generated based on the original scheduling strategy and the complete rescheduling strategy in this experiment, are visually presented in Figure 7 and Figure 8, respectively.


Experimental results show that, compared with the conventional original scheduling strategy, the optimal production scheduling scheme generated by the complete rescheduling strategy effectively reduces the makespan $C_{\max}$ by 52.4% and decreases the overall energy consumption $E_{\text{all}}$ by 3.8%. This distinct comparison result fully demonstrates that the optimized scheduling scheme obtained by adopting the complete rescheduling strategy can better adapt to complex production conditions and satisfy the high flexibility requirements of intelligent modern workshop production systems.
5. Construction of Digital Twin Dynamic Scheduling Workshop Model
The Digital Twin workshop relies on advanced information technology and intelligent manufacturing means to realize bidirectional mapping and real-time interaction between the Physical Workshop and the Virtual Workshop. Driven by workshop twin data, optimal integrated decisions are generated through analysis and prediction, thereby improving production management efficiency and system response capability. This paper designs a Digital Twin flexible job shop scheduling framework as shown in Figure 9, which mainly consists of four parts: simulation data layer, simulation function layer, simulation agent layer, and simulation scenario layer.

The scheduling framework includes the simulation data layer, simulation function layer, simulation agent layer, and simulation scenario layer: the data layer integrates inputs such as process data and models and uses Excel as the interface; the function layer, under dynamic disturbances, calls the IMOABC algorithm through the Python command line to complete data interaction and solution solving, and outputs executable scheduling results; the agent layer defines intelligent agents such as workpieces, machines, and Automated Guided Vehicles (AGVs), and configures attributes and behavior rules according to three types of objects: permanent entities, temporary entities, and system connections; the scenario layer completes the modeling of operation logic, logistics paths, and layout based on the process modeling library, material handling library, and space markup library of AnyLogic, and realizes visualization through 3D animation components.
AnyLogic is an object-oriented modeling and simulation platform based on standard Java, which supports multi-method integration, interactive simulation, and multi-experiment design, and provides data analysis tools and a visual modeling interface. It has been widely used in manufacturing and supply chain scenarios. In this paper, a manufacturing workshop simulation model is constructed based on AnyLogic. By establishing agents, the attributes and behaviors of workshop entities are simulated to analyze the response characteristics of the workshop under dynamic disturbance events.
In this paper, a Digital Twin simulation model of the workshop is constructed based on AnyLogic, and the operation logic diagram of the workshop simulation model is designed as shown in Figure 10. $P_i$ represents the $i$-th workpiece, and $M_{kl}$ represents the $l$-th workpiece processed by the $k$-th machine. The working state of the processing machine is busy, and the idle state is idle.

First, the relevant parameters of processable workpieces in the workshop and the configuration of the scheduling algorithm are initialized. After real-time orders arrive, the system generates corresponding workpieces to be processed and obtains the original scheduling scheme.
For the workpiece agent $P_i$, the processing machines and processing times of each operation are obtained, and the workpiece is transported to the designated processing machine $W_{ij}$ by AGV. At this time, the processing machine should belong to a certain machine $M_k$ in the processing machine agent group. If machine $M_k$ is currently idle and the next task of this operation is workpiece $P_i$, processing starts; otherwise, it enters the buffer for waiting. After the current operation is completed, if all processing tasks of the workpiece are finished, it is sent to the completion inspection area; otherwise, it is transferred to the processing machine of the next operation.
For the machine agent $M_k$ in the processing machine agent group, the sequence of workpiece agents to be processed is first obtained. If workpiece $P_i$ is the next task of machine $M_k$, processing starts; otherwise, the machine enters a waiting state. After completing all processing tasks of workpiece agents, the machine stops running; if not all tasks are completed, it continues to wait and process the next workpiece.
The interaction modules of the Digital Twin workshop model are constructed, and the parameter modules are shown in Figure 11, while the logical relationships among modules are shown in Figure 12. The interaction elements are mainly used for workshop environment initialization and real-time order storage; the production element module stores workpiece process data and basic parameters of the scheduling algorithm; the function element module is used for input, interaction, and type conversion of full-factor workshop data; the scheduling element module stores data related to workshop scheduling schemes; the collection element module stores workshop environment data and workpiece process data in a structured manner; the scheduling change element module is used for dynamic scheduling algorithm functions and rescheduling scheme storage; the AGV and conveyor elements store parameters related to AGVs and conveyors in the workshop. The main module types and their meanings are shown in Table 7.


Module Name | Module Type | Description |
|---|---|---|
EBArrival1-2 | Enter | Workpiece arrival |
moveToEnter1-2 | MoveTo | Workpiece enters production area |
moveToMA | MoveTo | Transport workpiece to processing area |
Processing | Delay | Workpiece processing |
moveToCA | MoveTo | Workpiece moves to temporary storage after operation |
onshelf | Rack Store | Workpiece enters buffer rack |
outshelf | Rack Pick | Workpiece leaves buffer rack |
WaitP | Delay | Workpiece waits for processing on rack |
inspectConvey | Convey | Workpiece enters inspection process |
moveToInspectA | MoveTo | Workpiece completes inspection process |
onCompleteShelves1-2 | Store | Workpiece enters finished buffer rack |
EBfinish | Exit | Workpiece leaves after completion |
The constructed workshop AnyLogic simulation model mainly includes four major areas: the incoming material area, the production processing area, the completion inspection area, and the finished goods storage area. The overall simulation effect of the workshop is shown in Figure 13 and Figure 14. It realizes the holographic mapping of the overall layout of the physical workshop and presents the execution process of workshop scheduling in a visual form, which is convenient for managers to make decisions and take direct actions.


Assume that when the simulation model runs to the 50th minute, machine $M_2$ fails, and the repair time is 20 minutes. The complete rescheduling schemes generated by the right-shift rescheduling strategy and the IMOABC algorithm are obtained, and the rationality of these two scheduling schemes is verified through simulation. The processing time data under the two rescheduling strategies are collected and organized, and the Probability Density Function (PDF) and Cumulative Distribution Function (CDF) of the processing time intervals are calculated. The distribution of workpiece processing time is presented, and the specific data are shown in Table 8. The histograms of workpiece processing time under the right-shift rescheduling strategy and the complete rescheduling strategy are plotted, including the mean line and cumulative distribution curve, as shown in Figure 15.
Distribution Interval (min) | Probability Density Function (PDF) | Cumulative Distribution Function (CDF) | Distribution Interval (min) | CDF | |
$[ 83.3\text{,}96.5)$ | 2 | 0.2 | $[ 83.3\text{,}100.9)$ | 2 | 0.2 |
$[ 96.5\text{,}109.7)$ | 1 | 0.3 | $[ 100.9\text{,}118.5)$ | 1 | 0.3 |
$[ 109.7\text{,}122.9)$ | 1 | 0.4 | $[ 118.5\text{,}136.1)$ | 2 | 0.5 |
$[ 122.9\text{,}136.1)$ | 1 | 0.5 | $[ 136.1\text{,}153.7)$ | 1 | 0.6 |
$[ 136.1\text{,}149.3)$ | 1 | 0.6 | $[ 153.7\text{,}171.3)$ | 2 | 0.8 |
$[ 149.3\text{,}175.7)$ | 1 | 0.7 | $[ 171.3\text{,}188.9)$ | 1 | 0.9 |
$[ 175.7\text{,}188.9)$ | 1 | 0.8 | $[ 188.9\text{,}206.5]$ | 1 | 1.00 |
$[ 188.9\text{,}202.1)$ | 1 | 0.9 | - | - | - |
$[ 202.1\text{,}215.3]$ | 1 | 1.00 | - | - | - |

From the comparison in Table 8, the workpiece processing time distribution under the digital twin scheduling strategy is more concentrated, indicating shorter overall processing duration, and thus higher solution quality. Combined with Figure 15, the average workpiece processing times under the right-shift rescheduling strategy and digital twin scheduling strategy are 142.72 min and 136.49 min, respectively; compared with the traditional strategy, the digital twin scheduling strategy reduces the average processing time by 4.37%, thereby improving workshop production efficiency and ensuring the rationality and effectiveness of scheduling decisions, which verifies the solution performance of the proposed method for flexible job shop scheduling problems.
At the 30th minute of the AnyLogic simulation model, emergency workpieces $J_1$, $J_2$, and one of each $J_8$ are inserted. A complete rescheduling scheme based on the IMOABC algorithm is generated and simulated together with the scheduling scheme generated by the original scheduling strategy. The processing time distribution of workpieces is shown in Table 9. Workpiece processing time histograms under the original scheduling strategy and complete rescheduling strategy, including mean lines and CDF, are shown in Figure 16.
Distribution Interval (min) | Probability Density Function (PDF) | Cumulative Distribution Function (CDF) | Distribution Interval (min) | CDF | |
$[ 74\text{,}92)$ | 2 | 0.15 | $[ 72.4\text{,}85.6)$ | 2 | 0.15 |
$[ 92\text{,}128)$ | 2 | 0.31 | $[ 85.6\text{,}112)$ | 1 | 0.23 |
$[ 128\text{,}146)$ | 1 | 0.38 | $[ 112\text{,}125.2)$ | 1 | 0.31 |
$[ 146\text{,}164)$ | 1 | 0.46 | $[ 125.2\text{,}138.4)$ | 1 | 0.38 |
$[ 164\text{,}182)$ | 3 | 0.69 | $[ 138.4\text{,}151.6)$ | 1 | 0.46 |
$[ 182\text{,}200)$ | 1 | 0.77 | $[ 151.6\text{,}164.8)$ | 2 | 0.62 |
$[ 200\text{,}218)$ | 2 | 0.92 | $[ 164.8\text{,}178)$ | 3 | 0.85 |
$[ 218\text{,}236]$ | 1 | 1.00 | $[ 178\text{,}191.2)$ | 1 | 0.92 |
- | - | - | $[ 191.2\text{,}204.4]$ | 1 | 1.00 |

From Table 9, the workpiece processing time distribution under the digital twin scheduling strategy is more concentrated, indicating shorter overall processing time and higher solution quality. Combined with Figure 16, the average workpiece processing times under the original scheduling strategy and digital twin scheduling strategy are 155.07 min and 143.31 min, respectively; compared with the traditional strategy, the digital twin scheduling strategy reduces the average processing time by 7.58%, thereby improving workshop production efficiency and enhancing the rationality and effectiveness of scheduling decisions, further verifying the solution performance of the proposed method for flexible job shop scheduling problems.
6. Conclusion
Facing the insufficient scheduling response and information opacity of flexible job shops under dynamic disturbances, this paper proposes a scheduling optimization method based on digital twin simulation. A digital twin job shop scheduling framework is constructed, and a digital twin workshop model is established based on AnyLogic to achieve virtual-real linkage and workshop operation simulation. On this basis, complete rescheduling schemes are generated by the IMOABC algorithm. Comparing different strategies in terms of average workpiece processing time, order completion time, and processing time distribution shows that the proposed method can effectively shorten processing cycles, improve production efficiency, and enhance the disturbance resistance and production agility of workshop systems under disturbance conditions, providing support for stable and efficient workshop operation.
Conceptualization, L.L.; methodology, L.L.; software, H.J.W.; validation, H.J.W. and Y.M.H.; formal analysis, H.J.W.; investigation, Y.M.H.; resources, L.L.; data curation, H.J.W.; writing—original draft preparation, Y.M.H.; writing—review and editing, L.L.; visualization, H.J.W.; supervision, L.L.; project administration, L.L. All authors have read and agreed to the published version of the manuscript.
The data used to support the research findings are available from the corresponding author upon request.
The authors declare no conflict of interest.
