## 3 Algorithms
### Parcel-Receiving Station and Public Route Planning Based on GA-MMAS
#### 3.2.1. Parcel-Receiving Station Location Based on GA  
1. Population initialization (1) Chromosome coding  
The logistics UAV parcel-receiving station location model is a 0-1 integer programming model. Randomly assign 0-1 variables to the alternative location of the parcel-receiving station during chromosome coding. Zero means no parcel-receiving station is set at this alternative location, and one means a parcel-receiving station is set at this alternative location, as shown in Figure 3:  
(2) Initial population generation  
According to the chromosome coding mode, \(N^{\text{U}}\) initial individuals are randomly generated to obtain the initial population. 2. Fitness calculation  
Individual fitness is an indicator to measure the degree of individual excellence. In this section, individuals are ranked according to their performance to determine the fitness of each individual. For each cost \(i\), generate a sequence \(X_{i}\) based on the performance of each individual to the cost, and the fitness of the individual to the cost is reflected by the  
Figure 3: Chromosome coding mode. order of individuals in the sequence. The fitness calculation formula of individual \(j\) to cost \(i\) is as follows:  
\[F_{j}(X_{i})=\left\{ \begin{array}{l}\left(N^{\text{U}}-\left(R_{j}(X_{i}) \right)^{2},R_{j}(X_{i})>1\\ k\left(N^{\text{U}}\right)^{2},R_{j}(X_{i})=1\end{array} \right. \tag{24}\]  
where \(F_{j}(X_{i})\) refers to the fitness of individual \(j\) to cost \(i\); \(N^{\text{U}}\) refers to the total population; \(R_{j}(X_{i})\) refers to the sequence number of individual \(j\) in sequence \(X_{i}\) after all individuals in the population rank the cost \(i\); and \(k\) is a constant in the interval [1,2] that can increase the fitness of the best individual with a single objective. According to the optimization objective, the overall fitness of the individual population is:  
\[F(X_{j})=\sum\limits_{i=1}^{n}\omega_{i}F_{i}(X_{j}) \tag{25}\]  
where \(\sum\limits_{i=1}^{n}\omega_{i}=1\); \(n\) refers to the number of costs to calculate. 3. Genetic operator operation (1) Select  
Ranking-based selection is used in this section. The individuals in the population are sorted from the best to the worst, and the parent individuals are selected by ranking and roulette. We use ranking-based selection instead of the absolute fitness value to prevent premature convergence of the algorithm. (2) Crossing and mutation operators  
In order to avoid overmodifying the original solution and the potentially superior solution, double-point crossover and 0-1 single-mutation change are used. Double-point crossover refers to selecting two cross nodes and exchanging the sequence between the corresponding nodes in two-parent individuals. A 0-1 single-mutation change refers to modifying the 0-1 variable at a certain position of an individual chromosome. The crossing and mutation operators are shown in Figures 4 and 5. Figure 4: Schematic diagram of double-point crossover. Figure 5: Schematic diagram of 0–1 single mutation. (3) Genetic parameter adaptation  
The main factors affecting the behavior of the genetic algorithm include the crossing probability \(P_{c}\) and mutation probability \(P_{m}\). The choice of crossing probability \(P_{c}\) and mutation probability \(P_{m}\) will affect the convergence of the algorithm. In this section, the genetic parameters are adaptively adjusted. The adjustment formula is as follows:  
\[P_{c}=\left\{ \begin{array}{l}P_{c1}-\frac{(P_{c1}-P_{c2})(A^{\prime}-A_{avg})} {A_{max}-A_{avg}},A^{\prime}\geq A_{avg}\\ P_{c1},A^{\prime}<A_{avg}\end{array} \right. \tag{26}\]  
\[P_{m}=\left\{ \begin{array}{l}P_{m1}-\frac{(P_{m1}-P_{m2})(A_{max}-A)}{A_{max} -A_{avg}},A\geq A_{avg}\\ P_{m1},A<A_{avg}\end{array} \right.