## 3 IMOGWO Algorithm Design
### Basic GWO Algorithm Description
#### 3.2.1 Encoding and Decoding
The job is assigned to the factory with a greater number of machines for processing. If there are multiple choices, go to Step 4. 4. randomly select one from factories for processing the job. \begin{table}
\begin{tabular}{c c c c c c c c c c c} \hline \hline \multirow{2}{*}{**Jobs**} & \multirow{2}{*}{**Delivery**} & \multicolumn{6}{c}{**Facty 1 (Factory 2)**} \\ \cline{3-10}  & & \multicolumn{3}{c}{**First Processing**} & \multicolumn{3}{c}{**First Reentry**} & \multicolumn{3}{c}{**Second Reentry**} \\ \cline{3-10}  & & **Stage 1** & **Stage 2** & **Stage 3** & **Stage 1** & **Stage 2** & **Stage 3** & **Stage 1** & **Stage 2** & **Stage 3** \\ \hline Job1 & 13.2(11.1) & 1(2) & 2(2) & 2(2) & 1(0) & 2(2) & 1(2) & 2(0) & 2(2) & 1(1) \\ Job2 & 11.8(14.2) & 2(2) & 2(0) & 2(3) & 1(2) & 2(1) & 2(2) & 1(1) & 2(2) & 2(1) \\ Job3 & 15.6(15.1) & 1(2) & 1(0) & 2(2) & 0(1) & 2(2) & 1(0) & 2(2) & 2(2) & 1(0) \\ Job4 & 11.5(13.4) & 2(2) & 1(1) & 2(2) & 2(2) & 1(0) & 1(1) & 1(1) & 2(3) & 2(1) \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Processing time and delivery time of each job. The pseudocode for the core part of Step 1 is outlined in Algorithm 1. ```
Input: Table 3 and the number of machines at each stage in two factories. Output: The average processing time of job \(i\) in factory \(f\) (Table 4). Step: Description 1. For\(i=1\): \(n\)
2. For\(l=1\): \(s\)
3. Compute \(\overline{p_{i}^{f}}=\sum j\), \(\overline{p_{ijf}}\), where \(\overline{p_{ijf}}=\frac{p_{ii}^{f}}{m_{fi}}\)
4. End
5. End
```  
**Algorithm 1** Calculation of average processing time. We now use this test case to explain the DR rule. First, we calculate the average processing time of each job in two factories separately. The results are shown in Table 4. We use specific steps to calculate the average processing time of jobs in factory 1 as an example. \[\overline{p_{1}^{1}}=\sum j\,\overline{P_{11}}=\overline{P_{112}}+\overline{P_ {113}}+\overline{P_{141}}+\overline{P_{152}}+\overline{P_{183}}+\overline{P_ {171}}+\overline{P_{182}}+\overline{P_{193}}=\frac{1}{4}+\frac{2}{4}+\frac{2}{ 4}+\frac{1}{4}+\frac{2}{4}+\frac{1}{4}+\frac{2}{4}-9 \tag{13}\]  
\[\overline{p_{2}^{1}}=\sum j\,\overline{P_{221}}=\overline{P_{221}}+\overline{P_ {222}}+\overline{P_{231}}+\overline{P_{241}}+\overline{P_{2512}}+\overline{P_ {2813}}+\overline{P_{2711}}+\overline{P_{2821}}+\overline{P_{2933}}=\frac{2}{4}+ \frac{2}{4}+\frac{2}{4}+\frac{2}{4}+\frac{2}{4}+\frac{1}{4}+\frac{2}{4}+\frac{ 2}{4}-10 \tag{14}\]  
\[\overline{p_{3}^{1}}=\sum j\,\overline{P_{331}}=\overline{P_{331}}+\overline{P_ {3312}}+\overline{P_{3313}}+\overline{P_{3411}}+\overline{P_{3512}}+\overline{ P_{3613}}+\overline{P_{3711}}+\overline{P_{3821}}+\overline{P_{3933}}=\frac{1}{4}+ \frac{1}{4}+\frac{2}{4}+\frac{2}{4}+\frac{2}{4}+\frac{1}{4}+\frac{2}{4}+\frac{ 2}{4}+\frac{1}{4}-7.5 \tag{15}\]  
\[\overline{p_{4}^{1}}=\sum j\,\overline{P_{441}}=\overline{P_{4411}}+\overline{ P_{4421}}+\overline{P_{4411}}+\overline{P_{4512}}+\overline{P_{4512}}+ \overline{P_{4613}}+\overline{P_{4711}}+\overline{P_{4821}}+\overline{P_{4812}} +\overline{P_{4933}}=\frac{2}{4}+\frac{1}{4}+\frac{2}{4}+\frac{2}{4}+\frac{2}{4 }+\frac{1}{4}+\frac{2}{4}+\frac{1}{4}+\frac{2}{4}+\frac{2}{4}-9.5 \tag{16}\]  
Perform the decoding operation of the first phase according to [1; 3; 2; 4] encoding scheme. Because \(\overline{(P_{1}^{1}}=9)<\overline{(P_{1}^{2}}=9.5)\), the first job is scheduled to be processed in factory 1. For the second job \(\overline{(P_{3}^{1}}\!\!=7.5)=\overline{(P_{3}^{2}}=7.5)\), factory 1 and factory 2 have the same average processing time. Then, considering the number of jobs that have been assigned to the two factories. Job 1 has been assigned to factory 1. However, no job has been assigned to factory 2. Therefore, job 3 is assigned to factory 2. For the third job \(\overline{(P_{2}^{1}}\!\!=10)>\overline{(P_{2}^{2}}=8.5)\), job 2 is assigned to factory 2 for processing. For the last job \(\overline{(P_{4}^{1}}\!\!=9.5)>\overline{(P_{4}^{2}}=8.5)\), it is assigned to factory 2 as well.