## 5 Prediction Modeling and System Optimization
### Load Predicting Model  
A BP neural network is an artificial neural network based on a back-propagation learning algorithm, which is the main component of an artificial neural network [24]. Most of the existing BP neural network models are variations or improvements of the standard BP neural network model. In this study, the improved PSO-BP neural network is used to build the load prediction model. The structure of the prediction model is illustrated in Figure 16. The initial thresholds and weights of the BP neural network are obtained through PSO optimization. Then the improved BP neural network is trained. The flow chart is plotted in Figure 17.  
Figure 14: The cylinder pressure with different leakage diameter holes under the regulating condition. Figure 15: Area ratio of p-v diagram under different leakage diameters. The particle swarm optimization (PSO) algorithm presents an efficient technique for solving optimization problems, especially the problem of a non-differentiable function where it is hard to find the optimum. PSO is a swarm intelligence algorithm inspired by the foraging behavior of birds. The position and the velocity of the population members are calculated by using a mathematical operator so they can be expected to head toward the best solution. The updating operation is defined as follows:  
\[V_{i}(k+1)=\omega(k)V_{i}(k)+c_{1}r_{1}(G_{best,i}-x_{i}(k))+c_{2}(k)r_{2}(P_{ best,i}-x_{i}(k)), \tag{16}\]  
\[x_{i}(k+1)=x_{i}(k)+V_{i}(k+1), \tag{17}\]  
\[\omega(k)=\omega_{start}-(\omega_{start}-\omega_{md})\big{(}\frac{k}{T_{\max}} \big{)}^{2},\] \[c_{2}(k)=\beta(k)c_{2}\]  
where \(\omega(k)\) presents the inertia weight, \(\omega_{start}\) is the initial weight, \(\omega_{end}\) is the inertia weight when the iteration reaches the maximum number, \(T_{max}\) is the maximum number of iterations, \(c_{1}\) and \(c_{2}\) are  
Figure 16: Prediction model structure diagram. (**a**) three-layer artificial neural network model; (**b**) the training process. Figure 17: The calculation procedure of particle swarm optimization back propagation (PSO-BP) method. positive constant parameters usually in the range of [0 2] called acceleration coefficients and known also as the cognitive and collective parameters, \(\beta(k)\) is the adaptive descending factor of the optimal solution of individual history, and its value is in the range of [0 1], \(r_{1}\) and \(r_{2}\) are random variables generated for each velocity update between [0 1], \(V_{i}(k)\) is the velocity of the \(i\)th particle at each iteration \(k\), and \(x_{i}(k)\) is the position of the \(i\)th the particle at each iteration \(k\). In order to prevent the particle from searching blindly, the position and speed of the particle are limited as follows:  
Figure 17.0  
Figure 17.1  
where \(V_{max}\) is maximum rate of velocity of particle, \(V_{min}\) is minimum rate of velocity of particle, and \(X_{\min}\) and \(X_{\max}\) are minimum and maximum position values, respectively. Last, \(P_{best,i}\) denotes the local best position of the \(i\)th particle at each iteration \(k\), and \(G_{best,i}\) defines the global best position at each iteration \(k\). In the traditional BP neural network method, the selection of the learning rate depends on experience. If the selection is too small, the convergence rate will be slow. If the selection is too large, it will lead to oscillation or even divergence. For this problem, this paper applies the adaptive learning rate, which is expressed as follows. \[\left\{ \begin{array}{l}\mu(k)=2^{\alpha}\mu(k-1)\\ \alpha=sgn(D(k)D(k-1))\end{array} \right., \tag{18}\]  
where \(sgn(\bullet)\) is a symbolic function, \(D(k)=-\partial J/\partial W_{j}(k)\) is the negative gradient of weight \(W_{j}(k)\) of the index function at the time k, and \(D(k-1)\) is the negative gradient at time \(k-1\). As can be seen from Equation (18), when the gradient direction of two consecutive iterations is the same, the descent speed is too slow, and the learning rate can be doubled.