## 2 Materials and Methods
### Theory of Algorithms
#### 2.2.2 Sparrow Search Algorithm  
SSA (Sparrow Search Algorithm) is a new swarm intelligence optimization algorithm. Its design inspiration comes from the group foraging behavior of the sparrow population in nature. Individuals in the sparrow population adapt to the environment by constantly adjusting their distribution position, so as to obtain better food resources and avoid the attack of predators [26]. The sparrow search algorithm has been shown to outperform many traditional population intelligence optimization algorithms in terms of its ability to find the best and avoid being trapped in local extremes [27; 28]. The mathematical model of SSA is as follows:  
In the simulated population, assuming that the virtual sparrow is foraging, the sparrow population composed of N sparrows can be represented by matrix (5):  
\[X=\left[ \begin{array}{cccc}x_{1,1}&x_{1,2}&\cdots&x_{1,d}\\ x_{2,1}&x_{2,2}&\cdots&x_{2,d}\\ \vdots&\vdots&\vdots&\vdots\\ x_{n,1}&x_{n,2}&\cdots&x_{n,d}\end{array} \right] \tag{5}\]  
where \(n\) signifies the number of all sparrows in the population and d describes the dimension of the decision variables. Figure 2: XGB model diagram. The fitness values of all sparrows can be expressed by Equation (6):  
\[F_{X}=\left[ \begin{array}{cccc}f\Big{[}&x_{1,1}&x_{1,2}&\cdots&x_{1,d}\\ f\Big{[}&x_{2,1}&x_{2,2}&\cdots&x_{2,d}\\ &&\vdots\\ &&\vdots\\ f\big{[}&x_{n,1}&x_{n,2}&\cdots&x_{n,d}\end{array} \Big{]}\end{array}\right] \tag{6}\]  
Sparrow populations are divided into producers and scroungers. Producers have higher energy reserves and are responsible for searching for areas with more food, providing foraging areas and directions for scroungers. When individual sparrows detect predators, they will sound an alarm signal. If the alarm value is higher than the safety value, the producers will take the scroungers to a safe area for foraging. In the iterative process of the algorithm, the update rule of the producer's position is shown in Equation (7):  
\[X_{i,j}^{t+1}=\left\{ \begin{array}{ll}X_{i,j}^{t}\cdot\exp\Big{(}-\frac{i}{ \alpha\cdot M}\Big{)}&if&R_{2}<ST\\ X_{i,j}^{t}+Q\cdot L&if&R_{2}\geq ST\end{array} \right. \tag{7}\]  
where \(t\) is the current number of iterations, \(X_{ij}\) is the location information of the sparrows, \(\alpha\) is a random number with a value range of \([0,1]\), \(M\) is the maximum number of iterations, \(Q\) is a random number which obeys to normal distribution, and \(L\) is a \(1\times d\) matrix, in which the elements are all \(1\). \(R_{2}\in[0,\ 1],\ ST\in[0.5,\ 1]\), respectively represent safety value and alarm value; when \(R_{2}<ST\), there is no predator invasion, and the producers can carry out a wide range of search operations. When \(R_{2}\geq ST\), it means that the individuals in the population have detected the predators, and all sparrows need to fly to a safe area immediately. Scroungers will keep an eye on the producers. Once the producers find a better foraging area, the scroungers will immediately compete with them. If the scroungers win, they will seize the resources from producers instantly. The rule for updating the scrounger's location is as follows:  
\[X_{i,j}^{t+1}=\left\{ \begin{array}{ll}Q\cdot\exp\left(\frac{X_{current}-X_{i,j}^{t}}{i^{2}}\right)&if&i>\frac{n}{2}\\ X_{p}^{t+1}+\left|X_{i,j}^{t}-X_{p}^{t+1}\right|\cdot A^{+}\cdot L&\text{ otherwise}\end{array} \right. \tag{8}\]  
where \(X_{p}\) is the best position occupied by the current producers, \(X_{avrst}\) is the global worst position, and r. \(A\) describes a \(1\times d\) vector such that the elements are randomly assigned \(1\) or \(-1\), \(A^{+}=A^{T}\big{(}AA^{T}\big{)}^{-1}\), and n is the total number of sparrows in the populations. When \(i>n/2\), it means that the i-th scroungers with low fitness do not get any food and need to fly to other areas for foraging. The initial positions of the sparrows which are aware of the danger are as follows:  
\[X_{i,j}^{t+1}=\left\{