# Research on the Prediction of Insertion Resistance of Wheel Loader Based on PSO-LSTM
## 3 LSTM and PSO  
### LSTM Structure and Principle  
LSTM is a special kind of recurrent neural network. Compared with traditional recurrent neural networks, LSTM introduces the structure of the gate into its structure. Therefore, it can show a good ability to deal with timeseries regression and classification tasks [31, 32]. Its structure is shown in Figure 14. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{**Cylinder**} & \multicolumn{3}{c}{**Gravel**} & \multicolumn{3}{c}{**Sand**} \\ \cline{2-7}  & **600 mm** & **800 mm** & **1000 mm** & **600 mm** & **800 mm** & **1000 mm** \\ \hline \multirow{2}{*}{\begin{tabular}{c} \(\mathrm{Tilt\ cylinder}\) \\ large chamber \\ \end{tabular} } & \multirow{2}{*}{0.8958} & \multirow{2}{*}{0.9231} & \multirow{2}{*}{0.8866} & \multirow{2}{*}{0.9802} & \multirow{2}{*}{0.9795} & \multirow{2}{*}{0.9968} \\ \hline \multirow{2}{*}{\begin{tabular}{c} \(\mathrm{Tilt\ cylinder}\) \\ small chamber \\ \end{tabular} } & \multirow{2}{*}{\(-0.936\)} & \multirow{2}{*}{\(-0.9716\)} & \multirow{2}{*}{\(-0.9161\)} & \multirow{2}{*}{\(-0.9770\)} & \multirow{2}{*}{\(-0.9118\)} & \multirow{2}{*}{\(-0.8337\)} \\ \hline \multirow{2}{*}{\
\begin{tabular}{c} \(\mathrm{Lift\ cylinder}\) \\ large chamber \\ \end{tabular} } & \multirow{2}{*}{0.9708} & \multirow{2}{*}{0.9876} & \multirow{2}{*}{0.9830} & \multirow{2}{*}{0.9953} & \multirow{2}{*}{0.9957} & \multirow{2}{*}{0.9952} \\ \hline \multirow{2}{*}{
\begin{tabular}{c} \(\mathrm{Lift\ cylinder}\) \\ small chamber \\ \end{tabular} } & \multirow{2}{*}{\(-0.7687\)} & \multirow{2}{*}{\(-0.8494\)} & \multirow{2}{*}{\(-0.6946\)} & \multirow{2}{*}{\(-0.7552\)} & \multirow{2}{*}{\(-0.5794\)} & \multirow{2}{*}{\(-0.7176\)} \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Pearson correlation coefficient. Figure 13: Cylinder pressure data. (**a**) Tilt cylinder for gravel sample; (**b**) Lift cylinder for gravel sample; (**c**) Tilt cylinder for sand sample; (**d**) Lift cylinder for sand sample. For a traditional neural network, there is only one input, \(x_{t}\). In the LSTM, there are two sets of inputs, the input vector \(x_{t}\) of the current unit and the output vector \(h_{t-1}\) of the previous unit, and a series of complex processes is performed by the unit state \(C_{t}\). \(C_{t}\) as a critique of the LSTM consists of the forget gate \(f_{t}\), the input gate \(i_{t}\), and the output gate \(o_{t}\)[33]. 1. Forget gate: The role of the forget gate is to choose to retain or discard part of the information; it receives the information of \(x_{t}\) of the current unit and \(h_{t-1}\) of the previous unit. In the internal state \(C_{t}\), a number 0-1 is generated, where 0 represents complete discard and \(1\) represents complete retention. \[f_{t}=\sigma(W_{f}\cdot h_{t-1}+W_{f}\cdot x_{t}+b_{f})\] (7)
2. Input gate: The role of the input gate is to determine which information is retained internally and to ensure that critical information can be saved. The values to be updated are first determined by the input gate \(i_{t}\), and then a candidate state \(C_{t}\) is determined by the input gate \(i_{t}\). \[i_{t}=\sigma(W_{i}\cdot h_{t-1}+W_{i}\cdot x_{t}+b_{i})\] (8) \[C_{t}=\tanh(W_{c}\cdot h_{t-1}+W_{c}\cdot x_{t}+b_{c})\] (9)  
The unit state is then updated by the forget gate \(f_{t}\), the input gate \(i_{t}\), the candidate unit state \(C_{t}\), and the previous unit state \(C_{t-1}\) to obtain the current unit state \(C_{t}\). \[C_{t}=f_{t}\cdot C_{t-1}+i_{t}\cdot C_{t} \tag{10}\]  
Output gate: The role of the output gate is to specify the value that needs to be output, control the current unit state \(C_{t}\) passed to the activation function and output the output vector \(h_{t}\).