# Research on the Prediction of Insertion Resistance of Wheel Loader Based on PSO-LSTM
## 3 LSTM and PSO
### PSO Optimization Process  
PSO is an optimization algorithm for population intelligence in the field of computational intelligence, and the algorithm is derived from the study of bird predation behavior [36]. Each particle in the algorithm corresponds to a potential solution to the problem, and each particle is characterized by three metrics: velocity, position, and fitness value. Among them, the velocity determines the direction and displacement of the particle's next movement and is influenced by itself as well as by other particles. The position describes the current location of the particle. PSO calculates the particle fitness value and compares it with the particle historical best fitness value \(p_{best}(i)\), and the global best fitness value \(g_{best}\). The velocity \(v_{i}\) and position \(x_{i}\) of the particle are continuously updated during the iterative process to achieve the global optimum. The velocity and position of the particle are updated as shown in Equations (15) and (16). The pseudo code of PSO is shown in Algorithm 1. \[v_{i}^{k+1}=wv_{i}^{k}+c_{1}r_{1}(p_{i}^{k}-x_{i}^{k})+c_{2}r_{2}(g_{best}^{k}- x_{i}^{k}) \tag{15}\]  
\[x_{i}^{k+1}=x_{i}^{k}+v_{i}^{k+1} \tag{16}\]  
where \(w\) is the inertia coefficient, \(k\) is the number of current iterations, \(c\) is the acceleration factor and is kept non-negative, and \(r\) is a random number [0, 1]. ```
1:Inputs: Population size \(n\); Number of iterations \(m\); \(w\); \(c_{1}\); \(c_{2}\)
2:Outputs:\(g_{best}\)
3:begin
4:for\(i=1\) to \(n\)do begin
5: initialize (\(v_{i}\)); initialize (\(x_{i}\));
6:end;
7:for\(i=1\) to \(m\)do begin
8:for\(i=1\) to \(n\)do evaluate (\(x_{i}\));
9:for\(i=1\) to \(n\)do update (\(p_{best}\), \(g_{best}\));
10:for\(i=1\) to \(n\)do begin;
11: execute Equation (15);
12: execute Equation (16);
13:end;
14:end;
15:end;

Figure 15: Schematic diagram of dropout. (**a**) Without dropout layer; (**b**) With dropout layer. ### PSO-LSTM Model

Some parameters in the LSTM need to be set manually, such as the initial learning rate, the number of hidden layer units, and the dropout probability, and there are no clear selection criteria for these parameters. At present, the selection of parameters for LSTM often relies on the experience of previous researchers or the results of multiple experiments. Different parameter settings have a large impact on the model prediction performance; therefore, it is important to obtain reasonable parameters to improve the LSTM prediction performance. In this paper, we establish a PSO-LSTM model which combines the advantages of PSO and LSTM. The initial learning, the number of hidden layer units, and the dropout probability of LSTM are optimized by PSO. The process of PSO-optimized LSTM is shown in Figure 16. The input layer is the cylinder pressure data and the actual insertion depth, where the cylinder pressure data includes the lift cylinder large chamber pressure, the lift cylinder small chamber pressure, the tilt cylinder large chamber pressure, and the tilt cylinder small chamber pressure. The output layer is the insertion resistance. The initial parameters of PSO are shown in Table 3, and the range of PSO-LSTM optimization parameters is shown in Table 4.

## 4 Results and Discussion

### Results and Analysis

The experimental data were obtained from the gravel sample groups and the sand sample groups with insertion depths of 600 mm, 800 mm, and 1000 mm. A total of 50%, 60%, 70%, and 80% of the data were used as the training set, and the remaining 50%, 40%, 30%, and 20% of the data were used as the test set, respectively. To compare the prediction performance of PSO-LSTM, it was chosen to compare it with conventional LSTM, and the relevant parameters of the two model groups were set as shown in Table 5.

In this paper, the root mean square error (\(RMSE\)), the average relative error (\(ARE\)), and the goodness of fit, \(R^{2}\), are selected as the indexes to evaluate the prediction performance.