# Research on Grain Moisture Model Based on Improved SSA-SVR Algorithm
## 3 System Modeling Method Construction
### Improved Sparrow Search Algorithm  
Building on the basis of the SSA algorithm, the Circle chaotic mapping is introduced first. Chaotic sequences exhibit good randomness and coverage, aiding the algorithm in exploring a broader solution space and avoiding premature convergence to local optima during the search process. By replacing the Sparrow Search Algorithm's random initialization with chaos, population resources are more evenly distributed across the search space. The chaotic mapping helps rapidly approach the global optimal solution in the early stages of the search process and enhances convergence speed by effectively exploring different regions of the solution space. The formula is as follows:  
\[x_{i+1}=x_{i}+0.5-mod\left(\frac{2.2}{2\pi}sin(2\pi x_{i}),i\right) \tag{10}\]  
Since sentinels are often in poor positions, it is difficult for them to evade predators effectively. To address this issue, a reverse learning mechanism is introduced [27; 28]. In the search process, if the algorithm gets trapped in a local optimum, the reverse learning mechanism can provide an effective escape strategy. By exploring the opposite position of the current solution, it may discover a better solution, allowing it to break out of the local optimum. Introducing reverse learning periodically helps maintain a balance between detailed local search and extensive global search, thus preventing premature convergence. When sentinels evade predators, they move in the opposite direction. With this improvement, sentinels can easily escape local optima, enhancing their ability to search for the global optimum. The flowchart for constructing the improved SSA-SVR algorithm model is shown in Figure 2[29; 30]. Step one: This involves initializing the position and fitness of the sparrow population. This is carried out by assigning initial values to parameters \(N\), n, PD, SD, and \(ST\);  
Step two: begin the loop, iteration < \(N\);  
Step three: sort the population to find the current optimal sparrow's position and the best fitness;  
Step four: start foraging behavior and update the discoverers' positions according to Formula (7)[31; 32]. \[X_{i,j}^{t+1}= \begin{cases}X_{i,j}^{t+1}\cdot exp\left(\frac{-i}{a-N}\right)&,if\ R_{2}<ST\\ X_{i,j}^{t+1}+Q\cdot L&,if\ R_{2}\geq ST\end{cases}  \tag{11}\]  
In the formula, \(N\) represents the maximum number of iterations. n represents the population size. PD represents the number of discoverers. SD represents the number of sparrows sensing danger. \(ST\) represents the safety value. \(R_{2}\) represents the alert value, which is generated by a random number. \(Q\) represents a random number that follows a normal distribution. \(L\) represents a unit row vector. Lastly, '\(a\)' represents a random number between 0 and 1. Step five: update the joiners' positions according to Formula (12). \[X_{i,j}^{t+1}= \begin{cases}Q\cdot exp\left(\frac{X_{i,j}^{t}-X_{i,j}^{t}}{i^{2 }}\right)&,if\ i>n/2\\ X_{p}^{t+1}+\left|X_{i,j}^{t}-X_{p}^{t+1}\right|\cdot A^{+}\cdot L&,otherwise \end{cases}  \tag{12}\]  
Figure 2: Improved SSA-SVR algorithm flowchart. In the formula, \(X_{worst}^{t}\) represents the position of the sparrow with the lowest fitness. \(A^{+}\) is a row vector containing only elements 1 and \(-1\) randomly. Step six involves updating the position of the sparrow population to account for anti-predation behavior. \[X_{i,j}^{t+1}=\left\{ \begin{array}{l}X_{best}^{t}.\beta\left|X_{i,j}^{t}-X_{ best}^{t}\right|\,if\ f_{i}>f_{best}\\ X_{i,j}^{t}+K\cdot\left(\frac{\left|X_{i,j}^{t}-X_{worst}^{t}\right|}{f_{i}-f_ {worst}+\epsilon}\right)\,if\ f_{i}=f_{best}\end{array} \right. \tag{13}\]  
In the formula, \(\beta\) is a random number that follows a normal distribution, and its function is to control the step size of the update position. \(K\) is the random number between \([-1,\,1]\), and \(f_{i}\) is the individual fitness value. \(\epsilon\) is a constant close to zero to avoid cases where the denominator is zero.