# Research on Optimization of Target Positioning Error Based on Unmanned Aerial Vehicle Platform
## 4 Error Synthesis and Distribution
### Assigning Errors Using Improved Dung Beetle Optimization Algorithm
#### 4.2.3 Improving the Dung Beetle Optimization Algorithm  
As the number of iterations increases, the DBO algorithm adopts a low convergence accuracy and performs local optimization. To address the above shortcomings, this study carries out a longitudinal and transverse crossover strategy to determine the new position of a target after each update using the dung beetle optimization algorithm. The longitudinal crossover algorithm performs both horizontal and vertical crossovers in each generation during the iteration process, thus giving certain dimensions in the population that are trapped in dimensional local optimums a chance to jump out of the iteration. The two crossovers are combined by introducing a competition operator, which is introduced after each crossover operation to compete with the parent generation, and only the particles that are better than the parent generation are retained in the next iteration, and the resulting solution is called the dominant solution. Horizontal crossover is arithmetic between two different individual particles of the same dimension in the population; the formula is as follows:  
\[XS_{hc}(i,d)=r_{1}*x(i,d)+(1-r_{1})*x(j,d)+c_{1}*(x(i,d)-x(j,d)) \tag{26}\]  
\[XS_{hc}(j,d)=r_{1}*x(j,d)+(1-r_{1})*x(i,d)+c_{2}*(x(j,d)-x(i,d)) \tag{27}\]  
where \(x(i,d)\) and \(x(j,d)\) represent the \(d\)-\(th\) dimension of the individual particles \(x(i)\) and \(x(j)\) in the parent population, respectively; \(XS_{hc}(i,d)\) and \(XS_{hc}(j,d)\) denote the \(d\)-\(th\) dimension offspring of \(x(i,d)\) and \(x(j,d)\) generated by lateral crossover, respectively; \(r_{1}\) and \(r_{2}\) stand for \([0,1]\) random numbers; and \(c_{1}\) and \(c_{2}\) represent \([-1,1]\) random numbers. The obtained offspring are compared with the parents to retain the individuals with a smaller objective function. The upper and lower ranges of the same dimension are the same for different individual particles. \(c_{1}\) and \(c_{2}\) are the learning factor, so the third term can increase the search interval and find the best at the edge. Longitudinal crossover is arithmetic between two different dimensions of a particle in a population, where one instance per individual updates only one of the dimensions, leaving the other dimensions unchanged. This is denoted by the following formula:  
\[XS_{lc}(i,d_{1})=r*x(i,d_{1})+(1-r)*x(i,d_{2}) \tag{28}\]  
where \(x(i,d_{1})\) and \(x(i,d_{2})\) denote the \(d_{1}\) and \(d_{2}\) dimensions of the individual particle \(x(i)\); \(XS_{lc}(i,d_{1})\) represents the \(d_{1}\) dimensional offspring of the \(d_{1}\) and \(d_{2}\) dimensions of \(x(i)\) produced by longitudinal crossover. The resulting offspring are compared with their parents to retain the individuals with smaller objective functions. The principle of \(3\sigma\) is also introduced. Within the mathematical framework of normal distribution, the mean \(\mu\) represents the average of all the data, and standard deviation \(\sigma\) measures the dispersion of data points with respect to the mean, i.e., the probability of a value being distributed in the interval \((\mu-3\sigma,\mu+3\sigma)\) in a normal distribution is 0.9973, and the likelihood of exceeding this range is only 0.3%, so the data outside this interval are rounded off. A flowchart of the CCDBO algorithm is shown in Figure 4.  
1. Set the basic parameters of the CCDBO algorithm, including UAV position error, UAV attitude angle error, and pod attitude angle error. 2. The dung beetle population is first initialized, and then the initialized dung beetle population is sorted according to the size of the fitness to obtain the dung beetle location with the optimal fitness value. 3. Adjust the positioning of the dung beetle's rolling balls as per Equation (19), and in the event that a dung beetle strays from its path, execute a dance to redefine the direction using Equation (20). 4.