## 2 Slime Mold Algorithm
The stable value \(D_{ij}\) and \(Q_{ij}\) will be obtained by carrying out iteration, and the iterative condition of termination is defined as:  
\[\left|D_{ij}(n+1)-D_{ij}(n)\right|\leq\delta \tag{6}\]  
(7) According to the final flow values, the next selected point is determined, and the path will be obtained by selecting the point of largest flow, from the starting point, one by one. After completing the selection of one point, the selected point \(P_{next}\) will become the current point \(i\) in the next point selection process. The point \(i\) is recorded into \(L_{best}\) by Equation (8), and the path result \(L_{best}\) is finally obtained by SMA. The concrete formula is shown as:  
\[Q_{inext}=\max\{|Q_{i1}|,|Q_{i2}|,\ldots\ldots,|Q_{im}|\} \tag{7}\]  
\[L_{best}=\{i_{1},i_{2},\ldots\ldots,i_{n}\} \tag{8}\]  
where \(Q_{inext}\) represents the pipeline flow with the largest value from the current point \(i\) to the other points. At the same time, it is the flow of next path point selected. \(L_{best}\) is the path result by SMA. **3. Two-Way Parallel Slime Mold Algorithm by Flow and Distance**  
Due to the short development time, the research depth of SMA is insufficient and many details of the model have to be explored. As far as the \"pipeline cultivation\" model of SMA, the path point selection is only based on the flow value, and there is only one path to be obtained, so it makes the optimization results limited. Moreover, SMA cannot jump out of the local optimum, especially in the complex situation of points. Therefore, TPSMA is designed by using two-way parallel optimization on flow and distance in this paper. As shown in Figure 3, it uses two reference indicators of flow and distance to search for next point, instead of the original principle, which is selecting the next point only by flow. At the same time, a random factor is added when points are selected by the flow and distance, to increase the diversity of result. The schematic diagram of TPSMA is illustrated in Figure 3. Firstly, the flow value between points is obtained by using the \"pipeline culture\" model of SMA. Secondly, the path point can be selected by the flow and distance, according to the newly designed rule. The distance difference needs to be calculated between the path with the largest flow and the path with the second largest flow. If the distance difference is large, and the distance with the largest flow is shorter, the point with the largest flow will be selected as the next point. Otherwise, we need to form a point set that includes the shortest path point, the shorter path point, and the path point with the larger flow. Then, a random factor is added to achieve the selection of the next point when we select the points in point set. Finally, the optimized result of TPSMA will be obtained by iterating. According to the principle of TPSMA on flow and distance, the algorithm is applied to the solution of TSP. As illustrated in Figure 4, the specific steps are as follows:  
(1) Variables initialize. (2) According to the Formulae (1)-(3), the distance \(L_{ij}\) and the flow \(Q_{ij}\) are calculated. (3) According to (2), we are going to complete the updating of conductivity and flow by Formula (5) and (3). Then, the final flow values are obtained by iterating until the condition (6) of termination is satisfied. (4) According to the two indexes of flow and distance, the point is selected in a two-way parallel method, and the specific contents are as follows:  
(i) We select the \(Q_{\textit{listed}}\) of the largest flow value and the \(Q_{\textit{libetter}}\) of the second largest flow value from the points to be selected and define the point of \(P_{\textit{Qlibest}}\) and \(P_{\textit{Qlibetter}}\). At the same time, the shortest distance \(L_{\textit{ibest}}\) and the second shortest distance \(L_{\textit{libetter}}\) are respectively found out and defined the point of \(P_{\textit{Libest}}\) and \(P_{\textit{Libetter}}\).