# Inverse Kinematics of Large Hydraulic Manipulator Arm Based on ASWO Optimized BP Neural Network
## 3 SWO Algorithm and Its Improvement
### ASWO Algorithm  
This study enhances the original SWO algorithm by incorporating a feedback adaptive adjustment that dynamically optimizes the population size \(N\), trade-off rate \(TR\), and crossover rate \(CR\) during the algorithm's execution. The average fitness variation rate \(\Delta F_{-}avg(t)\) of the population is calculated for each generation as depicted in Equation (5). Where \(F_{-}avg(t)\) represents the average fitness of generation '\(t\)' and \(F_{-}avg(t-1)\) is the average fitness in generation \(t-1\). If \(\Delta F_{-}avg\) does not improve significantly over a considerable number of generations, the parameters are adjusted to increase exploratory  
Figure 5: SWO algorithm judgement process. capabilities. Conversely, when the algorithm demonstrates rapid improvement, parameters are adjusted to reduce exploration and increase the likelihood of exploiting potentially promising regions. \[\Delta F_{-}avg(t)=-(F_{-}avg(t)-F_{-}avg(t-1))/F_{-}avg(t-1) \tag{5}\]  
For optimization problems with vast solution spaces, it is necessary to adjust the strategy for optimizing population size. This strategy can be transitioned from a fixed iterative reduction to a dynamic adjustment based on the rate of change in fitness. Specifically, when there is a significant increase in population fitness, meaning that \(\Delta F_{-}avg\) remains above threshold \(th_{u}\) for consecutive'm' generations, the population size is rapidly decreased to allow the algorithm to focus on high-potential areas. Conversely, when \(\Delta F_{-}avg\) remains below threshold \(th_{l}\) for consecutive'm' generations, the reduction in population size is slowed to promote a broad exploration of the solution space and prevent the premature discarding of potential optimal solutions. This strategy is illustrated in Equation (6), where \(\alpha_{fast}\), \(\alpha_{slow}\), \(\alpha_{normal}\) represent the three rate parameters that modulate the reduction in population size at different rates. This strategy maintains population diversity, assisting the algorithm in escaping local optima and potentially accelerating the global optimization process. \[N(t+1)=\left\{ \begin{array}{l}\max(N(t)-\alpha_{fast}*\frac{T_{\max}-t}{T_{ \max}},N_{\min}),count_{high}=m\\ \max(N(t)-\alpha_{slow}*\frac{T_{\max}-t}{T_{\max}},N_{\min}),count_{low}=m\\ \max(N(t)-\alpha_{normal}*\frac{T_{\max}-t}{T_{\max}},N_{\min}),otherwise \end{array} \right. \tag{6}\]  
The trade-off rate \(TR\) and crossover rate \(CR\) are important parameters for controlling the positional variation of individual spider bees, and dynamic adjustment of \(TR\) and \(CR\) can balance global exploration and local exploitation to enhance the efficiency of the algorithm. When the average fitness change rate \(\Delta F_{-}avg\) is lower than the threshold \(th_{l}\) for m consecutive generations, \(TR\) and \(CR\) are boosted to promote exploration and increase population diversity, and local optimization is avoided global search. Conversely, if a significant improvement in algorithm performance is observed, i.e., when \(\Delta F_{-}avg\) is higher than the threshold \(th_{u}\) for m consecutive generations, decreasing \(TR\) and \(CR\) can focus on high-potential regions and retain high-quality solutions to enhance local search. This process is illustrated in Equations (7) and (8), where \(\alpha_{TR}\) and \(\alpha_{CR}\) represent the balanced increasing weights, and \(\beta_{TR}\) and \(\beta_{CR}\) represent the balanced decreasing weights. \[TR(t+1)=\left\{ \begin{array}{l}TR(t)+\alpha_{TR}*(th_{l}-\Delta F_{-}avg(t) ),count_{low}=m\\ TR(t)-\beta_{TR}*(\Delta F_{-}avg(t)-th_{u}),count_{high}=m\end{array} \right. \tag{7}\]  
\[CR(t+1)=\left\{ \begin{array}{l}CR(t)+\alpha_{CR}*(th_{l}-\Delta F_{-}avg(t) ),count_{low}=m\\ CR(t)-\beta_{CR}*(\Delta F_{-}avg(t)-th_{u}),count_{high}=m\end{array} \right. \tag{8}\]  
In order to prevent the variables \(TR\) and \(CR\) from exceeding the reasonable range, the maximum value is set to 1 and the minimum value to 0.