# Routing Design for Pipe System Considering Natural Frequency
## 4 A Novel Path Planning Method for Pipe Arrangement with Considering Natural Frequency
### Initial Population  
The genetic algorithm is a powerful and widely applicable stochastic search optimization technique that is highly effective in solving problems that are difficult for traditional methods. Therefore, the genetic algorithm has become an effective approach for solving pipe routing problems. Previous researchers have applied genetic algorithms to single-pipe arrangements [19; 27]. Some of these algorithms randomly select several spatial points to form the initial paths. However, due to the arbitrary nature of these paths, most of them intersect with obstacles or contain numerous illegal gene segments, which limits the convergence of the genetic algorithm [28]. To avoid generating a large number of illegal solutions due to random initial paths, some researchers have used deterministic algorithms such as the A* algorithm to generate initial paths and then applied random mutation or random crossover on these paths to construct the initial population.  
Although these approaches reduce the number of illegal gene segments to some extent, they introduce the same gene segments in each generation due to the use of the A* algorithm, thereby reducing the global search capability of the genetic algorithm. Therefore, generating a reasonable initial population with a large number of valid gene segments becomes an effective means to address the issues of the genetic algorithm in path planning. This section utilizes the RRT algorithm to generate the initial population.  
Rapidly Exploring Random Tree (RRT) Algorithm  
The RRT is an incremental random sampling-based path search algorithm that can quickly find a collision-free path within the search space. In recent years, it has been widely applied in various fields and has demonstrated practicality. The RRT algorithm consists of four steps (See Figure 7).  
1 At the beginning, the RRT algorithm only contains the start points, some path points, and goal points.  
2 Secondly, computing the position of the node nearest to the random sample point.  
3 Thirdly, extending a new node from the nearest node to the random sample point.  
4 Fourthly, the length of the branches grown is determined by a predefined step size. RRT uses a global random sampling method to explore its directions. It ensures that the probability of expanding each node is related to the area of its Voronoi region, resulting in RRT always expanding the node in the largest surrounding empty space. This helps evenly cover the entire search space.  
Figure 7: Rapidly Exploring Random Tree.  
In this study, the RRT algorithm is utilized to generate the initial population for the genetic algorithm in the pipe routing problem. The effectiveness of the RRT algorithm is demonstrated in Figure 8, which illustrates the results of RRT with obstacles. The green and red stars represent the start and goal points, respectively, while the blue line represents the final path obtained by the RRT algorithm. Additionally, the yellow points represent the locations of supports.  
Although the RRT algorithm does not guarantee finding an optimal solution when obstacles are present, it exhibits randomness in pathfinding and generates paths with reasonable characteristics, such as obstacle avoidance and proximity to the shortest path. By using the RRT algorithm as the initial paths for the genetic algorithm, certain issues such as blind initialization and illegal gene segments can be addressed, leading to improved convergence speed.  
To generate the initial population for the genetic algorithm, the RRT algorithm is executed multiple times (four times, listed in Figure 8) to obtain paths with the same start and goal positions. These resulting paths are discretized into spatial nodes, which form the initial population for the genetic algorithm. This approach leverages the strengths of both the RRT algorithm and the genetic algorithm to enhance the efficiency of the overall pipe routing optimization process.