## 3 Proposed Method
### Route Generation
#### 3.5.3 Improved Genetic Algorithm
The specific process is to map the chromosome to the actual path, fill the gap in the path by the shortest path, and then code the edge that fills the gap into a gene, which is spliced to the corresponding position of the chromosome. After filling the gap, the path corresponding to the chromosome is the continuous feasible path in the actual road network. The schematic diagram of the gene splicing operation is shown in Figure 4. The path corresponding to the chromosome in the figure has a gap between edge \(c\) and edge \(e\), resulting in discontinuous paths. In this paper, the shortest path is used to find edge \(d\) (corresponding gene d), and gene \(d\) is spliced to the chromosome using the gene splicing operator to obtain a new chromosome. The corresponding path of this chromosome is a continuous and feasible path. 5. Gene Replacement. The gene replacement operation is a specific mutation operation with close to high probability based on pattern theorem and random operation. The core is to replace the inferior gene of the current chromosome with the better gene not included in the current chromosome with a higher probability of \(Pr\). Traditional GAs are prone to slow convergence and poor solutions when the amount of data in the search space is large. Therefore, this paper adds a gene replacement operator and, on the premise of not exceeding the travel time budget and the maximum replacement times, uses this operator many times to replace the inferior genes in the chromosome to improve the fitness value of the chromosome and accelerate algorithm convergence. After each execution of the gene replacement operator, the gene splicing operation needs to be performed again to ensure that the current chromosome mapping to the actual road network is continuous and feasible. Based on the above discussion, the pseudo code of the gene replacement operator is shown in Algorithm 2. In Line 2, chromosomes before replacement are temporarily stored for rollback. Line 3 is to calculate \(travelTime\), \(qualityRatio\) and \(scenicScore\) of genes in the current chromosome. Line 4 is to find the worst gene of \(travelTime\), \(qualityRatio\), and \(scenicScore\) from the current chromosome, that is, to find the replaced gene. Lines 5-9 select \(K\) genes with \(travelTime\) smaller than the replaced gene or \(qualityRatio\) and \(scenicScore\) larger than the replaced gene from the region close to the replaced gene, and add them to the candidate replacement gene set. Lines 10-11 randomly select a gene to be replaced from the candidate replacement gene set. Lines 12-13 were used for the gene splicing operation and new chromosome evaluation. Lines 14-18 indicate that when the new chromosome after replacement is better than that before, the replacement is successful; otherwise, the algorithm will return to the chromosome before replacement. A schematic diagram of the gene replacement operation is shown in Figure 5. In the figure, the short blue line represents the gene added to the current chromosome, and the short yellow line represents the neighbouring gene of \(c\). Figure 4: Schematic diagram of gene splicing operation.