## 3. MPSO for Inter-Layer Contact Plan
A static termination condition is adopted in the algorithm, that is if a certain number of iterations is reached, the algorithm will terminate, otherwise it enters the optimization process of MPSO again. \begin{table}
\begin{tabular}{c c c} \hline \hline  & **Traditional Way** & **Grid-Based Initialization** \\ \hline Transfer amounts & 0.4004 & 0.0628 \\ Average building time & 0.9592 & 0.7521 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The relevancy of grid-based initialization. By comparing the current position with the optimal position, the search direction of particles in the traditional PSO [38] can be correctly guided. However, the single form of the PSO may cause particles to quickly fall into local optimization traps, and it is difficult to obtain a good solution. In light of this, MPSO expands the optimization direction by a quaternary optimization strategy. In other words, the search direction of the particles in MPSO can be corrected by the optimal position as well as the worst position. Since the optimization requires historical information, the algorithm then judges whether to update the historical information after the evaluation is completed. The algorithm updates the historical extremum by comparing the current fitness with the worst and the optimal historical fitness, and also reserves the corresponding position of the fitness. The constraints on the number of transponders will cause a large proportion of zeros in a binary string. If the search direction of the particles is reversely adjusted by the historical worst position, most of the bits in the string will change to 1, which means that the constraints will be broken by the renewed string. And finally, MPSO will repair the strings in a large scale, which will greatly affect the performance of the optimization. To this end, the algorithm calculates the average position of the current group by Equation (16) and uses the calculated position to pick out the bits in the worst string which can correctly guide the search direction. Specifically, at a certain position of a string, if the bit of the worst position is different from the mean value, the bit will have a guiding effect on the direction of the current particle, and vice versa. The average value of the \(j\)th bit in the current group is calculated in Equation (16):  
\[b_{ave,j}=\left\{ \begin{array}{cc}1&\sum\limits_{pl=1}^{N_{pl}}b_{pl,j}/N_{ pl}>0.5\\ 0&\sum\limits_{pl=1}^{N_{pl}}b_{pl,j}/N_{pl}<=0.5\end{array} \right. \tag{16}\]  
where \(N_{pl}\) is the group size and \(b_{pl,i}\) is the value of the \(j\)th bit of CP \(pl\). After traversing all the bits in the string according to Equation (16), the average position of the group is determined. Then the MPSO uses the quaternary optimization to update the search direction and position:  
\[v_{p|,i}(c+1) =w_{pl}(c)\cdot v_{pl,i}(c)+a_{1}\cdot r_{1}\cdot[x^{o}_{p|,i}(c) -x_{pl,i}(c)]+a_{2}\cdot r_{2}\cdot[x^{o}_{g,i}(c)-x_{pl,i}(c)] \tag{17}\] \[v_{p|,i}(c+1) =w_{pl}(c)\cdot v_{pl,i}(c)+a_{1}\cdot r_{1}\cdot[x_{p|,i}(c)-x^{ w}_{pl,i}(c)]+a_{2}\cdot r_{2}\cdot[x^{o}_{g,i}(c)-x_{pl,i}(c)]\] (18) \[v_{p|,i}(c+1) =w_{pl}(c)\cdot v_{pl,i}(c)+a_{1}\cdot r_{1}\cdot[x^{b}_{p|,i}(c) -x_{pl,i}(c)]+a_{2}\cdot r_{2}\cdot[x_{pl,i}(c)-x^{w}_{g,i}(c)]\] (19) \[v_{p|,i}(c+1) =w_{pl}(c)\cdot v_{pl,i}(c)+a_{1}\cdot r_{1}\cdot[x_{p|,i}(c)-x^{ w}_{pl,i}(c)]+a_{2}\cdot r_{2}\cdot[x_{pl,i}(c)-x^{w}_{g,i}(c)] \tag{20}\]  
where \(w_{pl}(c)\) is inertia weight of particle \(pl\) at state \(c\), \(v_{p|,i}(c+1)\) is the speed of particle \(pl\) at the \(j\)th bit in state \(c\), which is decided by Equation (20). \(a_{1}\) and \(a_{2}\) are the learning factors, \(r_{1}\) and \(r_{2}\) are the random numbers in the range of \([0,1]\). Under the state \(c\), \(x^{b}_{p|,i}(c)\) and \(x^{w}_{p|,i}(c)\) are the historical optimal and worst positions at \(i\)th found by particle \(pl\), \(x^{b}_{g,i}(c)\) and \(x^{w}_{g,i}(c)\) are the historical optimal positions and the worst positions found by the group, respectively.