## 5 Application of the Optimization Algorithms
### Improved BP Neural Network Optimization Algorithm Based on Particle Swarm Optimization  
The BP network is a widely used multilayer feed-forward network that uses the error between the actual and predicted values to propagate in the opposite direction in the network. The BP neural network continuously learns the mapping relationship between input and output through many calculations and error feedback, calculates the error between the new data and the fitted data, and adjusts the coefficients such as weights \(\omega\)  
Figure 8: Flowchart of the particle swarm optimization algorithm.  
and configuration b. The BP neural network ends the computation until the error meets the set accuracy requirement or the training times reach the maximum. Thus, the BP neural network is, in fact, a prediction algorithm that is widely used in engineering by simulating input-output mapping functions closer to the actual ones. This feature can help to address the shortcomings of particle swarm optimization algorithms with high-fitness function requirements. The expressions obtained from the regression analysis were replaced with functional expressions for the three objective values fitted by the trained BP neural network. These were then applied to the particle swarm optimization algorithm to construct a BP neural network optimization algorithm based on particle swarm optimization. The number of nodes in the hidden layer of a BP neural network is not fixed, and this number can affect the performance of the constructed neural network architecture. The number of neuron nodes in the hidden layer should be between the numbers of neuron nodes in the input and output layers. In this study, the number of neuron nodes in the hidden layer was set to 50, and no additional hidden layer was added, to avoid the overfitting problem caused by increasing the number of hidden layers. The constructed neural network algorithm model is shown in Figure 9.  
The number of samples used to train the neural network was set to 200. The dataset was partitioned randomly, with the partitioning unit being each datum. The neural network's training, validation, and test sets were 80%, 10%, and 10%, respectively. The training learning rate was 0.1, the maximum number of training sessions was 200,000, and the training objective error was 0.0001. Training stopped when the maximum number of training sessions was reached or when the error between the training prediction value and the actual target value was smaller than the set error value [22]. The predicted versus actual values for 200 samples for the three objective functions are plotted in Figures 10-12.  
Figure 10: Predicted vs. actual stress values.  
Figure 9: BP neural network algorithm model diagram.  
As can be seen from the above figures, the predicted values of the trained neural network nearly coincide with the actual values, and the high prediction accuracy is in line with expectations. It provides excellent conditions for using neural networks to train models for particle swarm optimization solutions.  
We have written a program based on a modified BP neural network optimization algorithm based on the particle swarm optimization algorithm, where the main program invokes the particle swarm optimization algorithm to optimize the solution of the fitted function expression. The initial population size is 40, and the number of evolutions is 1000 in the subroutine invoked by the particle swarm optimization algorithm [23]. Due to  
Figure 11: Predicted vs. actual deformation values.  
Figure 12: Predicted vs. actual mass values.  
the use of the BP neural network to train the model, a small number of particle swarms can achieve a good solution.