## 2 Urban Pipeline Gas Leak Sensor Placement Method
### Layout Optimization Using the Ant Colony Algorithm  
The optimization of pipeline sensor placement is approached as a path planning problem, where the ACO algorithm offers distinct advantages. The core mechanism of the ACO algorithm is pheromone updating, which simulates ants leaving pheromones along the paths they traverse and the gradual evaporation of these pheromones over time. The fundamental formula governing pheromone updates is  
\[\tau_{ij}(t+1)=(1-\rho)\times\tau_{ij}(t)+\Delta\tau_{ij}(t) \tag{14}\]  
where \(\tau_{ij}\) (\(t\)) is the pheromone concentration on the path from \(i\) to \(j\) at time \(t\); \(\rho\) is the pheromone evaporation rate, typically between 0 and 1; and \(\Delta\tau_{ij}\) (\(t\)) is the total amount of pheromone left by all ants that traversed the path from \(i\) to \(j\) during the current iteration. The probability of an ant selecting its next node is calculated based on the pheromone concentration from the current node to other nodes and the accessibility (or attractiveness) between the nodes. The formula is as follows:  
\[p_{ij}^{k}=\frac{\tau_{ij}^{\alpha}\times\eta_{ij}^{\beta}}{\sum_{l\in allowed} \tau_{il}^{\alpha}\times\eta_{ll}^{\beta}} \tag{15}\]  
where \(p_{ij}^{k}\) is the probability of ant \(k\) moving from node \(i\) to node \(j\); \(\tau_{ij}\) is the pheromone strength from node \(i\) to node \(j\); \(\eta_{ij}\) is the visibility from node \(i\) to node \(j\), usually a function of the inverse of the distance or path quality; \(\alpha\) and \(\beta\) are parameters that control the importance of pheromones and heuristic information (such as the inverse of the distance); and \"_allowed_\" is the set of nodes that ant \(k\) can choose to visit, typically unvisited nodes. Figure 4 illustrates the process of the ant colony algorithm. Figure 4: Algorithm flowchart. The performance evaluation of the algorithm typically relies on multiple metrics, including coverage rate, convergence speed, and the adaptability of the algorithm to different scales and complexities of urban pipeline networks. In this study, the influence of the pheromone importance factor \(\alpha\) and the heuristic importance parameter \(\beta\) in the ant colony algorithm is analyzed in detail to assess their specific impact on the algorithm's performance. First, the \(\alpha\) parameter is adjusted, ranging from 0.5 to 1.0, with increments of 0.1, and the performance changes of the algorithm were recorded over 100 iterations. The performance evaluation is based on coverage rate, convergence speed, and the algorithm's adaptability to different scales and complexities of urban pipeline networks. Figure 5 indicates that when the \(\alpha\) value is set between 0.7 and 0.8, the algorithm's performance improves rapidly, eventually stabilizing at a high-performance value of around 0.840. This indicates that higher \(\alpha\) values significantly enhance the efficiency of the algorithm, especially in the early stages, where it quickly achieves high-quality solutions. In contrast, lower \(\alpha\) values, such as 0.5 and 0.6, result in slower performance improvements, with final performance values reaching only around 0.820. When the \(\alpha\) value is set to 0.9 and 1.0, although the performance improvement curve is smoother, the final performance is slightly lower, stabilizing at approximately 0.835 and 0.830, respectively. Next, the \(\beta\) parameter is adjusted, ranging from 0.5 to 1.0, with increments of 0.1. The performance changes over 100 iterations were recorded and displayed in Figure 6. The experimental results indicate that when the \(\beta\) value is set between 0.7 and 0.8, the algorithm's performance improves rapidly and ultimately stabilizes at around 0.70, the highest performance value. This result shows that moderately high \(\beta\) values help the algorithm explore effectively during iterations and quickly reach high-quality solutions.