# Radar Error Correction Method Based on Improved Sparrow Search Algorithm
## 3 Improved Sparrow Search Algorithm  
### Sparrow Search Algorithm  
The sparrow search algorithm (2020) is proposed, inspired by sparrow foraging and vigilance behavior [32], and the process can be modeled as a producer-scrounger-guard model. The producers search for food and direct the scroungers' foraging. The scroungers follow the more energetic producers for a local search and acquire energy from a better food source, during which the producers and scroungers can converse with each other. When the guards find that the population is threatened, the sparrows on the edge of the population will quickly move to the safe area, while the sparrows in the middle of the population will randomly move closer to other sparrows. When the warning value exceeds the threshold, the producers will lead the scroungers to the safe area for foraging. Suppose that the D-dimensional search space is composed of n sparrows, the position of each sparrow can be expressed as follows:  
\[\mathbf{X}= \begin{bmatrix}\mathbf{X_{1}}\\ \mathbf{X_{2}}\\ \vdots\\ \mathbf{X_{n}}\end{bmatrix} = \begin{bmatrix}x_{1,1}&x_{1,2}&\cdots&x_{1,D}\\ x_{2,1}&x_{2,2}&\cdots&x_{2,D}\\ \vdots&\vdots&\ddots&\vdots\\ x_{n,1}&x_{n,2}&\cdots&x_{n,D}\end{bmatrix}  \tag{14}\]  
The fitness of the corresponding sparrow can be expressed as follows:  
\[\mathbf{F}= \begin{bmatrix}F_{1}\\ F_{2}\\ \vdots\\ F_{n}\end{bmatrix} =\begin{bmatrix}f( \begin{bmatrix}x_{1,1}&x_{1,2}&\cdots&x_{1, D}\\ f(\begin{bmatrix}x_{2,1}&x_{2,2}&\cdots&x_{2,D}\\ &\vdots\\ f(\begin{bmatrix}x_{n,1}&x_{n,2}&\cdots&x_{n,D}\end{bmatrix}\end{bmatrix}) \end{bmatrix}  \tag{15}\]Producers usually make up 10% to 20% of the population and guide the flow of the entire population, whose position update formula is  
\[x_{i,j}^{iter+1}= \begin{cases}x_{i,j}^{iter}\cdot\exp\left(\frac{-i}{\pi\cdot iter _{max}}\right),R_{2}<S_{T}\\ x_{i,j}^{iter}+QL,R_{2}\geq S_{T}\end{cases}  \tag{16}\]  
where \(x_{i,j}^{iter}\) is the position information of the \(i\)-th sparrow in the \(j\)-th dimension when the number of iterations is iter, \(iter_{\max}\) is the maximum number of iterations, and \(\alpha\in(0,1]\) is a random number. \(R_{2}\in[0,1]\) and \(S_{T}\in[0.5,1]\) are warning values and safety values, respectively; \(R_{2}<S_{T}\) indicates that the foraging environment is safe and the producers can search in a large area, and \(R_{2}\geq S_{T}\) indicates that the guard finds a threat and warns other sparrows, at which time all sparrows need to move to a safe area. \(Q\) is a normally distributed random number and \(\mathbf{L}\) is the matrix of \(1\times D\). The scrounger forages under the guidance of the producer and may compete with the producer for food, with its location updated to the following:  
\[x_{i,j}^{iter+1}= \begin{cases}Q\exp(z\frac{x_{worst_{j}^{iter}-x_{i,j}^{iter}} }{i^{2}}),i>\frac{n}{2}\\ xbest_{j}^{iter+1}+\frac{1}{D}\sum\limits_{j=1}^{D}\left(\left|x_{i,j}^{iter}- xbest_{j}^{iter+1}\right|\cdot\mathrm{rand}\{-1,1\}\right),i\leq\frac{n}{2}\end{cases}  \tag{17}\]  
where \(x_{worst_{j}^{iter}}\) is the worst position of the sparrow (the sparrow's position when the individual fitness value is lowest) in the \(j\)-th dimension at the \(iter\)-th iteration, and \(xbest_{j}^{iter+1}\) is the best position of the producer (the sparrow's location when the individual fitness value is highest) in the \(j\)-th dimension at the (\(iter+1\))-th iteration. \(\mathrm{rand}\{-1,1\}\) indicates a random value in [\(-1\),1]. When \(i>n/2\), the \(i\)-th scrounger with low fitness does not receive food and will fly to other places in order to continue foraging. When \(i\leq n/2\), the \(i\)-th scrounger will search for food near the optimal position \(xbest_{j}^{iter+1}\), and the corresponding algorithm enters the local search stage.