# Concrete Dam Deformation Prediction Model Research Based on SSA-LSTM
## 2 LSTM and SSA Fundamentals
### SSA Principles  
The simple implementation and high search efficiency of the SSA algorithm make it one of the most promising intelligent optimization algorithms currently available [19; 23]. This algorithm divides the population of sparrows into finders and joiners, with finders searching for food and providing food locations for other groups and joiners foraging by following finders. Suppose a sparrow population consists of \(n\) sparrows and the dimension  
Figure 1: Structure diagram of LSTM. of the parameter to be optimized is \(d\). The position matrix \(X\) represents the \(n\) sparrows in a \(d\)-dimensional space and can be denoted as:  
\[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]\quad G_{x}=\left[ \begin{array}{cccc}g\big{(}\big{[}x_{1}^{1}&x_{1}^{2}&\cdots&x_{1}^{d}\big{]} \big{)}\\ g\big{(}\big{[}x_{2}^{1}&x_{2}^{2}&\cdots&x_{2}^{d}\big{]}\big{)}\\ \vdots\\ g\big{(}\big{[}x_{n}^{1}&x_{n}^{2}&\cdots&x_{n}^{d}\big{]}\big{)}\end{array} \right] \tag{9}\]  
where \(n\) represents the number of sparrows, while \(d\) represents the dimension of the variable being optimized, \(x\) is an individual sparrow, and the value of each row in \(G_{x}\) represents the fitness value of the individual. The joiner needs a large predation range to find better food, so in each iteration, the joiners position is updated as:  
\[X_{i,j}^{\text{iter }+1}=\left\{ \begin{array}{ll}X_{i,j}\cdot\exp\Bigl{(}- \frac{i}{\alpha\cdot iter_{\text{max}}}\Bigr{)}&R_{2}<ST\\ X_{i,j}+QL&R_{2}\geq ST\end{array} \right. \tag{10}\]  
where \(iter\) represents the current iteration, and \(iter_{max}\) is a constant representing the maximum number of iterations. \(X_{i,j}\) denotes the value of the \(j\)th dimension of the \(i\)th sparrow at iteration \(t\). \(\alpha\) is a random number within the range [0, 1]. \(R_{2}\) and \(ST\) denote the alarm value and safety threshold, respectively. \(L\) represents a matrix of size \(1\times d\), where each element is set to 1. When \(R_{2}<ST\), the surroundings are safe and the finder searches; when \(R_{2}\geq ST\), there is danger, and the population abandons food and flies to other safe areas. Joiners find food by monitoring and following the most adapted finder, and when the less adapted joiner does not get food, it makes a location change to get more food. The location change formula is:  
\[X_{i,j}^{iter+1}=\left\{ \begin{array}{ll}Q\cdot\exp\Bigl{(}\frac{X_{\text{ worst}}-X_{i,j}^{iter}}{t^{2}}\Bigr{)}&i>\frac{n}{2}\\ X_{p}^{iter+1}+\Bigl{|}X_{i,j}-X_{p}^{iter+1}\Bigr{|}A^{+}L&\text{otherwise} \end{array} \right. \tag{11}\]  
where \(X_{p}\) represents the best position currently occupied by the producer, while \(X_{worst}\) represents the worst position. \(A\) is a matrix of size \(1\times d\), where the elements are randomly assigned either \(1\) or \(-1\), and \(A^{+}=A^{T}(AA^{T})^{-1}\). \(i>n/2\) indicates that the \(i\)-th accession with a lower fitness value is hungry and unable to forage. Once the proportion of sparrows capable of recognizing danger reaches 10% to 20% of the total population, their initial positions are randomly generated. Afterwards, the initialized finders and joiners engage in competition for food and update their positions until the maximum number of iterations is reached. Finally, the sparrow with the highest global fitness value is identified as the global optimal solution. The specific algorithm flow chart is shown in Figure 2. The equation for updating the position of this class of sparrows is:  
\[X_{i,j}^{\text{iter }+1}=\left\{ \begin{array}{ll}X_{\text{best}}^{\text{iter }}&+\beta\Bigl{|}X_{i,j}^{\text{iter}}-X_{\text{best}}^{\text{iter}}\Bigr{|}& f_{i}<f_{g}\\ X_{i,j}^{\text{iter }}&+K\Bigl{|}\frac{X_{i,j}^{\text{iter }}-X_{worst}^{\text{iter}}}{(f_{i}-f_{w})+\varepsilon}&f_{i}=f_{g}\end{array} \right. \tag{12}\]  
where \(X_{best}\) represents the current best position.