# Parallel Hybrid Particle Swarm Algorithm for Workshop Scheduling Based on Spark
## 3 Parallelized Hybrid Particle Swarm Algorithm Based on Spark
### Parallel Hybrid Particle Swarm Algorithm
## 4 Instance Verification

### Examples of Mixed Mixed-Flow Workshop Scheduling

Now, we take the loader manufacturing workshop as an example [15] to verify the model and algorithm. The production system is composed of the parts-processing workshop, component-assembly workshop and product-assembly workshop. The four products produced are Q1, Q2, Q3, and Q4. The corresponding parts and component demand matrix of the products are shown in Table 1, below. The parts-processing workshop mainly produces eight kinds of self-made parts. The set of parts is {A, B, C, D, E, F, G, H} and the set of machines in the workshop is {M1, M2, \(\cdots\), M10}. The parts in batches are processed on the machine. The processing time and process sequence are shown in Table 2 below and the time unit is s.

The component-assembly workshop is mainly responsible for the assembly of components X and Y. The assembly time and steps are shown in Table 3 below and the unit is s.

The final assembly line of the product has 33 assembly stations and the corresponding assembly time and procedures for products Q1, Q2, Q3 and Q4 are shown in Table 4 below and the unit is s. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Parts** & **Q1** & **Q2** & **Q3** & **Q4** & **X** & **Y** \\ \hline A & 1 & 1 & / & / & / & / \\ B & / & / & 1 & 1 & / & / \\ C & 1 & 1 & / & / & / & / \\ D & / & / & 1 & 1 & / & / \\ E & 1 & 1 & / & / & / & / \\ F & / & / & 1 & 1 & / & / \\ G & / & / & / & / & 1 & / \\ H & / & / & / & / & / & 1 \\ Component X & 1 & 1 & / & / & / & / \\ Component Y & / & / & 1 & / & / & / \\ \hline \end{tabular} Note: “/” means that the product has no relationship with the required parts.

\end{table} 
Table 1: Product demand matrix. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline  & \multicolumn{10}{c}{**Parts**} \\ \hline
**Machine** & **A** & **B** & **C** & **D** & **E** & **F** & **G** & **H** \\ \hline M\({}_{1}\) & 300.1 & 375.1 & 0 & 0 & 0 & 0 & 0 & 0 \\ M\({}_{2}\) & 375.2 & 450.2 & 0 & 0 & 0 & 0 & 0 & 0 \\ M\({}_{3}\) & 375.3 & 450.3 & 0 & 0 & 0 & 0 & 0 & 0 \\ M\({}_{4}\) & 0 & 0 & 450.1 & 450.1 & 0 & 0 & 450.1 & 525.1 \\ M\({}_{5}\) & 0 & 0 & 0 & 0 & 450.1 & 525.1 & 375.2 & 450.2 \\ M\({}_{6}\) & 0 & 0 & 525.2 & 525.2 & 0 & 0 & 0 & 0 \\ M\({}_{7}\) & 0 & 0 & 0 & 0 & 525.2 & 450.2 & 0 & 0 \\ M\({}_{8}\) & 0 & 0 & 375.3 & 375.3 & 375.3 & 375.3 & 0 & 0 \\ M\({}_{9}\) & 0 & 0 & 0 & 0 & 0 & 0 & 600.3 & 600.3 \\ M\({}_{10}\) & 0 & 0 & 375.4 & 375.4 & 600.4 & 600.4 & 0 & 0 \\ \hline \end{tabular}
\end{table} 
Table 2: Parts-processing time and process sequence. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Process** & **Component X** & **Component Y** \\ \hline
1 & 147 & 126 \\
2 & 126 & 147 \\
3 & 126 & 168 \\
4 & 105 & 105 \\
5 & 157 & 168 \\
6 & 126 & 105 \\
7 & 168 & 168 \\
8 & 147 & 126 \\
9 & 147 & 168 \\ \hline \end{tabular}
\end{table} 
Table 3: Component-assembly process and time. During the planning period, the tasks for the production of products Q1, Q2, Q3 and Q4 are divided into 320 units, 160 units, 320 units and 320 units. The minimum production ratio is 2:1:2:2. According to the known conditions, it can be known that the required parts X and Y are divided into 480 and 640 and the minimum production ratio is 3:4. The required parts A-H are 480, 640, 480, 640, 480, 640, 480 and 640, respectively, and the minimum production ratio is 3:4:3:4:3:4. Calculate according to the parallelized particle swarm algorithm, set the size of the population to 20 and the number of iterations to 300. It runs in a 64-bit stand-alone Windows 10 operating system, 32 G running memory, 10 cores and 20 threads. In Spark's Local mode, parallel computing of algorithms is realized.