# Location Selection Methods for Urban Terminal Co-Distribution Centers with Air-Land Collaboration
## 4 Algorithm Design
### Co-Distribution Center Site Selection Method Based on GWO
#### 4.2.2 Processing of Site Selection Data  
The set of alternative points for the co-distribution center is \(\overset{\rightarrow}{I}=[I_{1},I_{2},\cdots,I_{n}]\). Each point \(I_{k}\) is evaluated according to  
\[\begin{cases}I_{k}=1,&\text{not constructed}\\ I_{k}=2,&\text{constructed as UAV center},k\in n\\ I_{k}=3,&\text{constructed as Truck center}\end{cases} \tag{20}\]  
In the traditional GWO algorithm, all computations are performed in the real number domain, and solutions are generally continuous in the real number space [26]. However, in the site selection problem, when updating the wolf positions, non-integer solutions may be generated, and these cannot be directly used for site selection. Therefore, these solutions must be processed so that they conform to the form specified in Equation (20) for the computational needs of the site selection problem.  
The position vector \(\overset{\rightarrow}{X}\) is rounded as follows to generate a new position vector \(\overrightarrow{X\_I}\):  
\[\overrightarrow{X\_I}=round(\overset{\rightarrow}{X}) \tag{21}\]  
If any element in \(\overrightarrow{X\_I}\) does not satisfy Equation (20), further truncation is applied according to  
\[\overrightarrow{X\_I}_{m}=\begin{cases}\overrightarrow{X\_I}_{m}=1, \overrightarrow{X\_I}_{m}\leq 1\\ \overrightarrow{X\_I}_{m}=2,1<\overrightarrow{X\_I}_{m}\leq 2\\ \overrightarrow{X\_I}_{m}=3,3\leq X\_I}_{m}\end{cases},\quad m\in K \tag{22}\]  
\begin{table}
\begin{tabular}{l} \hline Initialization: \\
1. Initialize the size of the gray wolf pack, N (i.e., the number of solutions). \\
2. Randomly initialize the position of each gray wolf \(X_{i}(i=1,2,\cdots,N)\), where each position represents a potential site solution. \\
3. Initialize \(\alpha\), \(\beta\), and \(\delta\) as the best three solutions in the population. \\
4. Set the maximum number of iterations as MaxIteration and the current iteration as iter = 0. \\ Iteration starts: \\ While iter \textless{} MaxIteration do \\ for each wolf i in Pack do \\  1. Calculate the feasibility and penalty of the solution \(Feasible(i)\) and \(Penalty(i)\) \\  2. Calculate \(Fitness(i)\). \\  3. Modify the fitness based on the results in steps 1 and 2 \\  4. Locate the best three wolves based on \(\alpha\), \(\beta\), and \(\delta\) \\  5. Calculate the distances of the other wolves in the pack from \(\alpha\), \(\beta\), and \(\delta\) according to \(\left|\overset{\rightarrow}{C}_{1}\cdot\overrightarrow{X_{\alpha}}- \overset{\rightarrow}{X}\right|\), \(\left|\overset{\rightarrow}{C}_{2}\cdot\overrightarrow{X_{\beta}}- \overset{\rightarrow}{X}\right|\), and \\  6. Calculate new positions around \(\alpha\), \(\beta\), and \(\delta\) as \(\overset{\rightarrow}{X_{1}}\), \(\overset{\rightarrow}{X_{2}}\), and \(\overset{\rightarrow}{X_{3}}\) \\  7. Update the position of the wolves \(\overset{\rightarrow}{X}(t+1)=\frac{\overset{\rightarrow}{X_{1}}+\overset{ \rightarrow}{X_{2}}+\overset{\rightarrow}{X_{3}}}{3}\), where \(\overset{\rightarrow}{X_{k}}=\overset{\rightarrow}{X_{\alpha}}- \overset{\rightarrow}{A_{k}}\cdot\left|\overset{\rightarrow}{C}_{k}\cdot \overrightarrow{X_{\alpha}}-\overset{\rightarrow}{X}\right|\), \(k\in 1,2,3\) \\  8. Apply rounding according to Equation (21) and truncation according to Equation (22) \\ _end for_ \\  9. Check for new \(\alpha\), \(\beta\), and \(\delta\) \\  10. Update the coefficients a, A, and C, which control the search behavior of the wolves, decreasing as the iteration proceeds \\  11. iter = iter + 1 \\ end while \\ Output: \\ Location of \(\alpha\) as the best siting option. \\ \hline \end{tabular}
\end{table}
Table 2: Pseudocode of the site selection method based on GWO.