## 3 Methodology--Mathematical Modelling and Heuristic Optimization Method
#### 3.2.1 Black Hole Optimization-Based Clustering
We have chosen a simple scenario, which makes it possible to check the performance of the optimization algorithm and to validate the suggested model and solution algorithm. It makes sense to consider this specific scenario because both the clustering and the routing/rerouting problems can be demonstrated. In this scenario, 16 assembly stations are in a matrix grid and there are 16 supply-demands to be clustered, routed and scheduled. Table 7 shows the input parameters of the scenario, while Table 8 demonstrates the optimal clustering of the 16 supply-demands. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**Tasks**} & \multicolumn{2}{c}{**Relation**} & \multicolumn{2}{c}{**Time Frame Limit**} & \multirow{2}{*}{**Loading**} \\ \cline{2-2} \cline{4-5}  & **From** & **To** & **Lower** & **Upper** & \\ \hline
1 & 12 & 15 & 10:10 & 10:30 & 12 \\
2 & 1 & 4 & 10:20 & 10:50 & 9 \\
3 & 9 & 10 & 10:30 & 11:15 & 15 \\
4 & 5 & 8 & 10:40 & 11:05 & 8 \\
5 & 3 & 7 & 10:50 & 11:10 & 24 \\
6 & 14 & 8 & 10:10 & 10:40 & 7 \\
7 & 9 & 13 & 10:05 & 10:35 & 44 \\
8 & 6 & 9 & 10:12 & 10:38 & 7 \\
9 & 5 & 8 & 10:55 & 11:28 & 31 \\
10 & 15 & 10 & 11:25 & 11:40 & 21 \\
11 & 14 & 6 & 11:30 & 12:00 & 17 \\
12 & 1 & 5 & 11:05 & 11:30 & 56 \\
13 & 3 & 6 & 10:35 & 11:05 & 22 \\
14 & 6 & 12 & 10:25 & 10:55 & 11 \\
15 & 4 & 14 & 10:45 & 11:05 & 8 \\
16 & 14 & 16 & 10:50 & 12:00 & 9 \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Input parameters of the Scenario. Figure 15: Pseudocode of the implementation of flower pollination algorithm for extended and real-time rescheduling and reassignment of supply routes. The upper limit of loading capacity of the AGVs is 120 and the clustering algorithm has found the best clusters for extended scheduling and routing with a maximum capacity of 109, 79, and 113 LUs. Figure 16 demonstrates the solution of extended clustering and routing problem including three routes. The value of the objective function (total deviance of time frame) is 205.67 min, while the total length of unloaded sections is 372 m. The length of loaded routes is 444 m and the total length of the three supply routes is 816 m. The maximum loading of AGVs is 109, 79, and 113 LU, which means a capacity utilization of 91%, 66%, and 94%. The next phase of the optimization is the real-time scheduling. Within the frame of our scenario, one supply-demand must be performed. The optimization algorithm is responsible for the reclustering, rerouting, and rescheduling of the routes in order to find the most energy efficient way, while time frame and capacity related constraints are taken into consideration. The new supply-demand must be performed between matrix cell 2 and 12, the time frame to perform this supply chain is between 10:30 and 10:45 and the loading is 21 LU. The results of reclustering are shown in Table 9 and Figure 17.  
The value of the objective function (total deviance of time frame) is 237.75 min, while the total length of unloaded sections is 372 m. The length of loaded routes is 492 m and the total length of the three supply routes is 864 m. The maximum loading of AGVs is 114, 91, and 117 LU, which means a capacity utilization of 95%, 76%, and 98%. The AGVs are using electricity. As the comparison of the World Nuclear Association shows, the greenhouse gas (GHG) emission depends on the electricity generation source (Figure 18).