*2.2. Parameters in the Model*

The parameters used in this study are as follows:


*Wpi*: Workpiece *i*, *i* ∈ {1, ... , *n*};

*Stagej*: Stage *j*, *j* ∈ {1, ... , *m*};

*Mj*: Total number of workstations in stage *Stagej*, *j* ∈ {1, ... , *m*};

*WSj*,*l*: Workstation *l* of stage *Stagej*, *j* ∈ {1, ... , *m*}, *l* ∈ 1, ... , *Mj* ;

*LBuj*: Limited buffer of stage *Stagej*, *j* ∈ {2, ... , *m*};

*Klj*: Maximum buffer capacity in the limited buffer *LBuj* of stage *Stagej*, *j* ∈ {1, ... , *m*};

*Blj*,*k*: Buffer position *k* of limited buffer *LBuj*, *j* ∈ {2, ... , *m*}, *k* ∈ 1, ... ,*Klj* ;

*WAlj*(*t*): At the *t* time, the workpieces in the limited buffer *LBuj*;

*PBu*: Public buffer;

*Kp*: Maximum buffer capacity in the public buffer *PBu*, 1 <sup>≤</sup> *Kp* <sup>≤</sup> *<sup>n</sup>* <sup>−</sup> min *Klj* ;

*Tsi*,*j*: The start time of the workpiece *Wpi* at stage *Stagej*, *j* ∈ {1, ... , *m*};

```
Tci,j: The completion time of the workpiece Wpi at stage Stagej, j ∈ {1, ... , m};
```
*Tbi*,*j*: The standard processing time of the workpiece *Wpi* at stage *Stagej*, *j* ∈ {1, ... , *m*};

*Tii*,*j*: The entry time of the workpiece *Wpi* into stage *Stagej*, *j* ∈ {1, ... , *m*};

*Toi*,*j*: The departure time of the workpiece *Wpi* out of stage *Stagej*, *j* ∈ {1, ... , *m*};

*Tlii*,*j*: The entry time of the workpiece *Wpi* into limited buffer *LBuj*, *j* ∈ {2, ... , *m*};

*Tloi*,*j*: The departure time of the workpiece *Wpi* out of limited buffer *LBuj*, *j* ∈ {2, ... , *m*};

*Tpii*,*j*: The entry time of the workpiece *Wpi* into public buffer *PBu* at stage *Stagej*, *j* ∈ {2, ... , *m*};

*Tpoi*,*j*: The departure time of the workpiece *Wpi* out of public buffer *PBu* at stage *Stagej*, *j* ∈ {2, ... , *m*};

*Tbt*: The standard processing time for transferring the workpiece;

*Rpi*: The workpiece *Wpi* is on the way from the workstation to the public buffer;

*Rli*: The workpiece *Wpi* is on the way from the public buffer to the limited buffer;

*Rbi*: The workpiece *Wpi* is on the way back to the limited buffer;

*Cfp*: The time for electric flat carriage to finish the current task and return to the public buffer;

*Ttwi*,*j*(*t*): At the *t* time, the transit time of the workpiece *Wpi* from the workstation of stage *Stagej* to the public buffer.

#### *2.3. Constraints*

The variables used in this study and the constraints that exist between variables are as follows:

#### 2.3.1. Assumptions

$$
\begin{aligned}
\text{At}\_{i,j}&= \begin{cases}
\text{1} & \text{Workpipe } Wp\_i \text{ is assigned to be processed on workshop } WS\_{jf} \\
\text{0} & \text{Workpipe } Wp\_i \text{ is not assigned to be processed on workshop } WS\_{jf} \\
\text{0} & \text{At time } t, \text{ rovnicce } Wp\_i \text{ is in limited buffer } LB\_{jf}
\end{cases} \\
\text{0} & \text{At time } t, \text{ working} \text{ } Wp\_i \text{ is not limited buffer } LB\_{jf} \\
\text{0} & \text{At time } t, \text{working} \text{ } Wp\_i \text{ is not limited buffer } LB\_{jf} \\
\text{0} & \text{At time } t, \text{working} \text{ } Wp\_i \text{ that should have entered} \\
\text{0} & \text{At time } t, \text{ workers} \text{ } Wp\_i \text{ that should have entered} \\
\text{0} & \text{limited buffer } LB\_{ij} \text{ is not in public buffer} \\
\text{0} & \text{At time } t, \text{ workpiece } Wp\_i \text{ that should have} \\
\text{0} & \text{At time } t, \text{ worker} \text{ } Lugp\_i \text{ that should have} \\
\text{0} & \text{At time } t, \text{ workpiece } Wp\_i \text{ that should have} \\
\text{0} & \text{At time } t, \text{select drift carrying is not robust} \\
\text{1} & \text{At time } t, \text{ electric flat carrier is in limited buffer} \\
\text{2} & \text{At time } t, \text{ electric flat carrier is in initial buffer} \\
\text{0} & \text{worstation to public buffer} \\
\text{4} & \text{At time } t, \text{ electric flat carrier is in transit from} \\
\text{3} & \text{Multiple buffer to limized buffer} \\
\end{aligned}
$$

#### 2.3.2. General Constraint of Flexible Flow Shops Scheduling

$$\sum\_{l=1}^{M\_j} A t\_{i,j,l} = 1, \; i \in \{1, \dots, n\}, \; j \in \{1, \dots, m\} \tag{6}$$

$$Tc\_{\bar{i},\bar{j}} = Ts\_{\bar{i},\bar{j}} + Tb\_{\bar{i},\bar{j},\ \text{i}} \in \{1, \dots, n\}, \ \text{j} \in \{1, \dots, m\} \tag{7}$$

$$Tc\_{i,j-1} \le Ts\_{i,j}, \ i \in \{1, \ldots, n\}, \ j \in \{2, \cdots, m\} \tag{8}$$

Equation (6) indicates that the constraint that the workpiece *Wpi* can only be processed at one workstation of the stage *Stagej* during the processing. Equation (7) indicates the constraints that the completion time of the workpiece *Wpi* in the stage *Stagej* is equal to the sum of its start time and standard processing time in the stage *Stagej*, which guarantees close machining between the workpieces. Equation (8) indicates the constraint that the workpiece *Wpi* needs to complete the processing task of the current stage before the processing task of the next stage. This constraint limits the processing sequence of each workpiece in all stages. Equations (6)–(8) ensure that the whole processing is in accordance with the processing characteristics of the flexible flow shop.

2.3.3. Constraints of the Limited Buffers

$$T l i\_{i,j} \ge T c\_{i,j-1}, \ j \in \{2, \dots, m\} \tag{9}$$

Equation (9) indicates the constraint that time *Tlii*,*<sup>j</sup>* for the workpiece to enter the limited buffer *LBuj* cannot be less than the completion time *Tci*,*j*−<sup>1</sup> of this workpiece processed at the previous stage *Stagej*−1.

$$\mathcal{W}Al\_{\dot{j}}(t) = \left\{ l\_{i} \middle| \mathcal{O}Al\_{i,\dot{j}}(t) = 1 \right\} \tag{10}$$

Equation (10) indicates the constraint and the workpieces in the limited buffer *LBuj* at the *t* time.

$$\text{card}\left(\mathsf{W}Al\_{j}(t)\right) \leq \mathsf{K}l\_{j} \tag{11}$$

Equation (11) indicates the constraint that at any time, the total number of workpieces in the collection *WAlj* waiting to be processed cannot be greater than the maximum buffer capacity *Klj* in the limited buffer. This constraint guarantees that the characteristics of the limited buffer correspond to the actual processing.

$$\text{Tlo}\_{i,j} \ge \text{Tli}\_{i,j}, \ j \in \{2, \dots, m\} \tag{12}$$

Equation (12) denotes that time for the workpiece to leave the limited buffer *LBuj* cannot be less than the time for the workpiece to enter the limited buffer *LBuj*.

2.3.4. Constraints of the Public Buffer

$$Tpo\_{i,j} \ge Tpi\_{i,j}, \ j \in \{2, 3, \dots, m\} \tag{13}$$

Equation (13) indicates the time for the workpiece in the public buffer *PBu* that should have entered the limited buffer *LBuj* to leave the public buffer *PBu* should not be less than the time for it to enter the public buffer *PBu*. This constraint ensures that the moving in and out of the public buffer conforms to the actual processing.

$$\mathbb{V}Ap\_{j}(t) = \left\{ \mathbb{V}p\_{i}[OAp\_{i,j}(t) = 1] \right\} \tag{14}$$

Equation (14) represents the collection of all workpieces contained in the public buffer *PBu* at time *t*.

$$
card(\mathsf{VAp}\_{\vec{\jmath}}(t)) \le \mathsf{Kp} \tag{15}
$$

Equation (15) indicates the constraint that at any time, the sum of workpieces contained in the to-be-processed collection *WApj* is less than or equal to the maximum buffer capacity *Kp* of the public buffer. This constraint guarantees that the characteristics of the public buffer conform to the actual processing.

$$T t w\_{\dot{l}, \dot{l}}(t) = (t - T o\_{\dot{l}, \dot{l}}) \tag{16}$$

Equation (16) shows that at time *t*, the time for the workpiece *Wpi* to be transferred from the workstation of the stage *Stagej* to the public buffer is equal to the difference between the time for the workpiece *Wpi* to leave the workstation of stage *Stagej* at time *t*.

$$T t w\_{i,j}(t) \le Tbt\tag{17}$$

Equation (17) indicates the constraint that at time *t*, the time for the workpiece *Wpi* to be transferred from the workstation of the stage *Stagej* to the public buffer should be less than the standard processing time for transferring the workpiece.

2.3.5. Other Constraints


#### **3. Research on FFSP–PB Local Scheduling Rules**

During production, when the limited buffer capacity of the current stage reaches the upper limit, the finished workpiece of the previous stage is directly transferred to the public buffer. The available workstation at this stage allows the processing of the workpiece in limited buffer at the current stage. Strikingly, there is available space in the limited buffer at this stage. If the workpiece is directly transferred from the public buffer to the limited buffer of the current stage, the available space would not be occupied by the finished workpiece of the previous stage during the period when the workpiece is transported back to the limited buffer of the current stage; otherwise, the workpiece transferred from the public buffer will collide with the completed workpiece of the previous stage while entering the available space. In order to prevent this conflict and as long as the workpiece in the public buffer starts to be transported to the available space in the limited buffer of the current stage, this space cannot be occupied, which might block the finished workpiece of the previous stage at its processing workstation. According to the above analysis, after adding the public buffer to the workshop, if the corresponding local scheduling rules are not established, the production blockage and completion time of gross workpieces cannot be reduced effectively. In order to play the role of public buffer and further alleviate the production blockage, the reentrant rules of the electric flat carriage and the workpiece transfer rules in the public buffer are designed. These local heuristics rules can control the transit of the workpiece among limited buffer, public buffer, and workstation. These rules exert the role of public buffer to reduce the production blockage.

#### *3.1. Reentrant Rules of Electric Flat Carriage*

At time *t*, if there is available space in the limited buffer *LBuj*+<sup>1</sup> and workpieces that have completed the processing task of stage *Stagej* and transferred to public buffer *PBu*, the already-spent transit time *Ttwi*,*j*(*t*) of the workpiece in transit will be compared to the estimated minimum completion time min *Tci*,*<sup>j</sup>* − *t Tsi*,*<sup>j</sup>* − *t* <sup>≤</sup> 0, *Tci*,*<sup>j</sup>* − *t* > 0 of all workpieces at the current stage *Stagej*. If the estimated minimum completion time is longer than the already-spent transit time of the workpiece, the electric flat carriage will begin to turn back, transporting the workpiece back to the limited buffer *LBuj*+<sup>1</sup> of the next stage *Stagej*+1.

At time *<sup>t</sup>*, if *card OAli*,*j*+1(*t*) <sup>&</sup>lt; *Klj*+<sup>1</sup> & *OAti*,*j*+1(*t*) · *Ttwi*,*j*(*t*) <sup>&</sup>lt; min *Tci*,*<sup>j</sup>* − *t Tsi*,*<sup>j</sup>* − *t* <sup>≤</sup> 0, *Tci*,*<sup>j</sup>* − *t* > 0 & *Pan*\_*Car*(*t*) = 3 & *OAti*,*j*+1(*t*) - 0, the workpiece begins to be transported, and the state of electric flat carriage becomes *Pan*\_*Car*(*t*) = 4.

#### *3.2. Workpiece Transfer Rules in Public Bu*ff*er*

At time *t*, there is available space in the limited buffer *LBuj*+<sup>1</sup> and workpieces in the public buffer that should have entered the limited buffer *LBuj*+1. If the electric flat carriage is in the public buffer *Pan*\_*Car*(*t*) = 2, the standard processing time for transferring the workpiece *Tbt* will be compared to the estimated minimum completion time min *Tci*,*<sup>j</sup>* − *t Tsi*,*<sup>j</sup>* − *t* <sup>≤</sup> 0, *Tci*,*<sup>j</sup>* − *t* > 0 of all workpieces at stage *Stagej*. If the estimated minimum completion time is longer than the standard processing time for transferring the workpiece, the workpieces currently in the public buffer *PBu* that should have entered the limited buffer *LBuj*+<sup>1</sup> are transported back to the limited buffer *LBuj*+1; however, if the estimated minimum completion time is short, the available space in the limited buffer *LBuj*+<sup>1</sup> will remain idle until the workpiece with the estimated minimum completion time at the current stage is accessed.

If the electric flat carriage is not in the public buffer, i.e., *Pan*\_*Car*(*t*) - 2, the sum of the standard processing time for transferring the workpiece *Tbt* and the time *Cfp* for electric flat carriage to the public buffer after completing the current task will be compared to the estimated minimum completion time min *Tci*,*<sup>j</sup>* − *t Tsi*,*<sup>j</sup>* − *t* <sup>≤</sup> 0, *Tci*,*<sup>j</sup>* − *t* > 0 of all workpieces at stage *Stagej*. If the estimated minimum completion time is longer than that described above, the workpieces currently in the public buffer *PBu* that should have entered the limited buffer *LBuj*+<sup>1</sup> are transported back to the limited buffer *LBuj*+1. If the estimated minimum completion time is shorter than that mentioned above, the available space in the limited buffer *LBuj*+<sup>1</sup> will remain idle until the workpiece with the estimated minimum completion time at the current stage is processed and accessed.

At time *<sup>t</sup>*, if *card OAli*,*j*+1(*t*) <sup>&</sup>lt; *Klj*+<sup>1</sup> & *OApi*,*j*+1(*t*) · *Tbt* <sup>&</sup>lt; min *Tci*,*<sup>j</sup>* − *t Tsi*,*<sup>j</sup>* − *t* <sup>≤</sup> 0, *Tci*,*<sup>j</sup>* − *t* > 0 & *Pan*\_*Car*(*t*) = 2 & *OApi*,*j*+1(*t*) - 0, the workpiece begins to be transported, and the state of electric flat carriage becomes *Pan*\_*Car*(*t*) = 4.

At time *<sup>t</sup>*, if *card OAli*,*j*+1(*t*) <sup>&</sup>lt; *Klj*+<sup>1</sup> & *OApi*,*j*+1(*t*) · *Tbt* <sup>+</sup> *Cfp* <sup>&</sup>lt; min *Tci*,*<sup>j</sup>* − *t Tsi*,*<sup>j</sup>* − *t* <sup>≤</sup> 0, *Tci*,*<sup>j</sup>* − *t* > 0 & *Pan*\_*Car*(*t*) - 2 & *OApi*,*j*+1(*t*) - 0, the workpiece begins to be transported, and the state of electric flat carriage becomes *Pan*\_*Car*(*t*) = 2 after time *Cfp*.

#### **4. Local Scheduling Rules for Multi-Queue Limited Bu**ff**ers**

In this study, HNN is primarily used for optimization. The energy function in the continuous HNN is monotonically decreasing, and the gradually decreasing process of the energy function is the process of neural network optimization. The algorithm employs this feature to solve the optimization problem and search for the optimal solution [27].

When the standard HNN algorithm solves the NP-hard problem, it establishes a non-linear correlation between the input and output of the network, since the activation function of the analog neurons in the neural network is a non-linear transfer function. Moreover, the output of the problem solution is a non-linear space, which might encompass multiple poles, renders the algorithm as an optimal local solution in the event of failure to obtain the optimal global solution. Also, the algorithm cannot break after falling into local extremum, which makes the overall evolutionary trend irreversible. Thus, the simulated annealing algorithm is introduced into the standard HNN algorithm to prevent its premature convergence, expand the search ability of the feasible solution, and improve the global optimization effect.

#### *4.1. HNN Algorithm*

#### 4.1.1. Establishing the Permutation Matrix

The permutation matrix is a bridge connecting the buffer dynamic capacity-increase problem in a flexible flow shop with public buffer and the improved HNN algorithm. This study applied the workpiece processing sequence in the first stage to construct the matrix. For example, the FFSP permutation matrix of the six workpieces to be processed is shown in Table 1. The permutation matrix in Table 2 indicates the processing sequence of the six workpieces *Wp*2, *Wp*1, *Wp*5, *Wp*3, *Wp*4, *Wp*<sup>6</sup> .


**Table 1.** FFSP permutation matrix of six workpieces.


**Table 2.** Algorithm test result.

#### 4.1.2. Establishing the Energy Function

As a major feedback of the network, the energy function can easily determine the stability of the system.

(1) Energy function row constraint

$$E\_1 = \frac{A}{2} \sum\_{\mathbf{x}=1}^{n} \sum\_{i=1}^{n-1} \sum\_{j=i+1}^{n} V\_{xi} V\_{xj} = 0 \tag{18}$$

Equation (18) indicates that the sum *<sup>n</sup> x*=1 *n*−1 *i*=1 *n j*=*i*+1 *VxiVxj* of all elements of *n* rows multiplied by each other in order should be 0, i.e., each row in the FFSP permutation matrix only has one '1', indicating that a workpiece can only be processed once at each stage. *Vxi* represents the element of the *i* column of the *x* row of the FFSP permutation matrix, and *A* is the coefficient.

(2) Energy function column constraint

$$E\_2 = \frac{B}{2} \sum\_{i=1}^{n} \sum\_{x=1}^{n-1} \sum\_{y=x+1}^{n} V\_{xi} V\_{yi} = 0 \tag{19}$$

Equation (19) denotes that the sum *<sup>n</sup> i*=1 *n*−1 *x*=1 *n y*=*x*+1 *VxiVyi* of all elements of *n* columns multiplied by each other in a specific order should be 0, i.e., each column in the FFSP permutation matrix only has one '1', indicating that a workpiece can only be processed once at one stage, and *B* is the coefficient.

(3) Energy function overall constraint

$$E\_3 = \frac{C}{2} \left( \sum\_{i=1}^{n} \sum\_{x=1}^{n} V\_{xi} - n \right)^2 \tag{20}$$

Equation (20) indicates that the sum *<sup>n</sup> i*=1 *n x*=1 *Vxi* − *n* of all elements should be 0, i.e., there are *n* '1' in the FFSP permutation matrix, indicating that all workpieces are to be processed at one stage. In the Equation, *C* is the coefficient, and the square value is used to conform to the expression of energy, as well as embody a punishment for not meeting the constraint.

#### (4) Energy function target item

Since the main optimization goal of the FFSP–PB is the makespan, the fourth item of the energy function needs to be expressed in combination with the makespan, as shown in Equation (21), and *D* is the coefficient.

$$E\_4 = \frac{D}{2} C\_{\text{max}} \tag{21}$$

Combining Equations (18)–(21), the energy function for constructing FFSP–PB is as follows:

$$E = \frac{A}{2}E\_1 + \frac{B}{2}E\_2 + \frac{C}{2}E\_3 + \frac{D}{2}E\_4 = \frac{A}{2}\sum\_{\substack{x=1 \ i=1}}^n \sum\_{\substack{j=-i+1 \end{x}}^n V\_{xi}V\_{xj} + \frac{B}{2}\sum\_{i=1}^n \sum\_{\substack{x=1 \ y=x+1}}^{n-1} V\_{xi}V\_{yj} + \frac{C}{2}\left(\sum\_{i=1}^n \sum\_{x=1}^n V\_{xi} - n\right)^2 + \frac{D}{2}C\_{\max} \tag{22}$$

According to a previous study [26], Equation (22) can be improved to:

$$E = \frac{A}{2} \sum\_{x=1}^{n} \left(\sum\_{i=1}^{n} V\_{xi} - 1\right)^{2} + \frac{B}{2} \sum\_{i=1}^{n} \left(\sum\_{x=1}^{n} V\_{xi} - 1\right)^{2} + D C\_{\text{max}} \tag{23}$$

To ensure the symmetry for the solution of HNN algorithm, the value of *A* in Equation (23) needs to be equal to the value of *B*.

#### 4.1.3. Establishing HNN Dynamic Differential Equation

According to another study [27], the connection weight coefficient is calculated as follows:

$$\frac{du\_{\text{xi}}}{dt} = -\frac{\partial E}{\partial V\_{\text{xi}}}\tag{24}$$

Equations (23) and (24) can derive HNN dynamic equation as follows:

$$\frac{du\_{xi}}{dt} = -A\left(\sum\_{i=1}^{n} V\_{xi} - 1\right) - A\left(\sum\_{y=1}^{n} V\_{yi} - 1\right) \tag{25}$$

The correlation function between input *uxi* and output *Vxi* of the simulating neuron in HNN algorithm is:

$$\mathcal{V}\_{\rm xi}(t\_0) = \varphi\_{\rm xi}(\mu\_{\rm xi}) = \frac{1}{2} \Big[ 1 + \tanh\left(\frac{\mu\_{\rm xi}(t\_0)}{\mu\_0}\right) \Big] \tag{26}$$

According to the HNN dynamic equation, the input bias Δ*uxi* is:

$$
\Delta u\_{xi}(t\_0) = \frac{du\_{xi}}{dt} V\_{y\bar{j}} \tag{27}
$$

In the evolution process of HNN, the input is updated by the first-order Euler Equation, which is shown in Equation (28):

$$
\mu\_{\rm xi}(t\_0 + \Delta t) = \mu\_{\rm xi}(t\_0) + \left. \frac{d\mu\_{\rm xi}}{dt} \right|\_{t=t\_0} \Delta t \tag{28}
$$

#### *4.2. Improvement of the HNN Algorithm*

Since the energy function of the standard HNN algorithm decreases monotonically, the optimization range of the algorithm is narrow with a fixed optimization direction, which ultimately leads the algorithm to easily fall into a local extremum and is difficult to jump out. The idea of the simulated annealing algorithm exists between the given solution and the new solution is generated in the local area by the given solution. The solution with the better fitness is accepted by Metropolis acceptance criteria [28], while the solution with the poorer fitness is selected to expand the searching range of the solution space. Therefore, in the process of optimizing the standard HNN algorithm, the idea of the simulated annealing algorithm is introduced to expand the optimization range of the standard HNN algorithm and further achieve a better solution.

After the standard HNN algorithm is introduced, the idea of the simulated annealing algorithm during each training process of the standard HNN algorithm causes the neuron input to increase the random disturbance in the HNN algorithm after energy function value, which is computed. The energy function value of the HNN after disturbance input is computed. Energy function value of the original input is compared to the energy function value of the disturbance input; if the energy function value is smaller, it indicates that the value is better. If the original energy function value is not smaller than the energy function value of the disturbance input, the energy function value of the disturbance input is selected to replace the original energy function value, and then the HNN algorithm starts the next generation of optimization. If the original energy function value is smaller than the energy function value of the disturbance input, according to the Metropolis acceptance criteria, the energy value function of the disturbance input is compared to the original energy function value. If the Metropolis acceptance criteria are fulfilled, the energy function value of the disturbance input is chosen to replace the original energy function value, and then the HNN algorithm starts the next generation optimization. Otherwise, the original energy function value does not change and enters the next generation of optimization. After the above process of algorithm optimization is repeated several times, a part of the energy function does not show monotone decreasing characteristic during convergence. However, the global convergence trend of the energy function still shows a decreasing tendency and converges to the optimal equilibrium point. Finally, the ability of the standard HNN algorithm to jump out of local extremum is improved.

The main steps for the HNN algorithm based on the simulated annealing algorithm for solving the scheduling problem are as follows:

Step 1: Set the initial parameters *A*, *D*, *u*0, *t*0, Δ*t* of the HNN algorithm.

Step 2: Set the maximum generation *K*max and the evolutionary generation *K* = 0.

Step 3: Set the initial value of *uxi*(*t*0), whose value is within the interval [−1, 1].

Step 4: Set the initial value of each element *Vxi* in the network initial permutation matrix to 0.

Step 5: Calculate the output *V*(*t*0) of each neuron according to Equation (26), and judge whether the permutation matrix at this time point is valid. The validity of the permutation matrix needs to be judged strictly by the energy function constraint. If the permutation matrix is legal, the output is obtained, *C*max is calculated, and continue to step 6; if not, return to step 2.

Step 6: Calculate the energy *E*(*t*0) of the network at this time point according to Equation (23).

Step 7: Calculate *duxi dt* according to Equation (24).

Step 8: Increase the random disturbance Δ*t*<sup>0</sup> to the input of neuron *uxi*(*t*0), and the neuron input changes into *uxi*(*t*<sup>0</sup> + Δ*t*0) at this time. *uxi*(*t*<sup>0</sup> + Δ*t*0) is calculated according to Equation (28), and the permutation matrix *V*(*t*<sup>0</sup> + Δ*t*0) is updated by *uxi*(*t*<sup>0</sup> + Δ*t*0).

Step 9: Calculate the value of energy function in network *E*(*t*<sup>0</sup> + Δ*t*) at this time.

Step 10: If *E*(*t*<sup>0</sup> + Δ*t*0) ≤ *E*(*t*0), then *E*(*t*0) = *E*(*t*<sup>0</sup> + Δ*t*0); if not, then judge whether the result satisfies the Metropolis acceptance criteria. If the criteria are fulfilled, then *E*(*t*0) = *E*(*t*<sup>0</sup> + Δ*t*0); if not, then *E*(*t*0) = *E*(*t*0).

Step 11: If the permutation matrix output is legal at this time, then continue to step 12, otherwise return to step 5. At the same time point, evolutionary generation *K* is processed as *K* = *K* + 1.

Step 12: If the iteration *K* has reached the maximum generation *K*max and the permutation matrix output is legal at this time point, then output the result, otherwise return to step 3. The flowchart of the SAA–HNN algorithm is shown in Figure 2.

**Figure 2.** The flowchart of the SAA–HNN algorithm.
