# Time-Optimal Trajectory Planning for Woodworking Manipulators Using an Improved PSO Algorithm
## 2 Materials and Methods
### The Improvement Strategy of PSO
#### 2.4.3 Position Updating Integrating the Gold-SA  
Gold-SA is an optimization algorithm developed by [PERSON] et al. in 2017 based on the sine function, which has the advantages of good convergence, strong robustness, and less parameter tuning [32]. Gold-SA, which searches the entire solution space, is simulating the process of scanning a unit circle with a radius to obtain a sine function. Therefore, it has good ergodicity, can carry out extensive searches, and has a strong local optimization ability. In addition, Gold-SA continuously reduces the search space near the optimal solution through a golden section operator, improving the algorithm's convergence rate and accuracy. The position information of Gold-SA is updated using the following formula.  
\[X\overset{iter+1}{ij}=X\overset{iter}{ij}|\sin(R_{1})|-R_{2}\sin(R_{1})|\left(x _{1}P_{gbesij}-x_{2}X\overset{iter}{ij}\right)|, \tag{25}\]  
where \(R_{1}\) is the random numbers in the range (0, 2\(\pi\)), and \(R_{2}\) is the random numbers in the range (0, \(\pi\)). \(x_{1}\) and \(x_{2}\) are golden section coefficients, which are updated in the following equation:  
\[x_{1}=a\ (1-\tau)+b\tau, \tag{26}\]  
\[x_{2}=a\tau+b\ (1-\tau), \tag{27}\]  
Figure 7: Inertia weight S-curve decreasing and Linear decreasing.  
\[\tau=\left(\sqrt{5}-1\right)/2, \tag{28}\]  
The initial values of \(a\) and \(b\) are \(-\pi\) and \(\pi\), respectively [32]. The golden ratio \(\tau\) is approximately 0.618033. By integrating the Gold-SA position update strategy with the SPSO algorithm, a new position update formula is obtained as the following equation:  
\[X\overset{iter+1}{ij}=\omega X\overset{iter}{ij}+c_{1}|\sin(R_{1})|\left(P_{ij }-X\overset{iter}{ij}\right)-c_{2}R_{2}\sin(R_{1})\ \left|\left(x_{1}P_{gbestj}-x_{2}X\overset{iter}{ij}\right)\right|, \tag{29}\]  
Meanwhile, to further improve search efficiency, an acceleration factor \(\lambda\) was introduced to improve the convergence rate [40]. Finally, the GoldS-PSO position update formula is as follows:  
\[X\overset{iter+1}{ij}=\lambda(\omega X\overset{iter}{ij}+c_{1}|.\sin(R_{1})|(P_ {ij}-X\overset{iter}{ij})-c_{2}R_{2}\sin(R_{1})|(x_{1}P_{gbestj}-x_{2}X\overset{ iter}{ij})|), \tag{30}\]  
In conclusion, the implementation steps of the GoldS-PSO are as follows:  
Step 1: Set the maximum iterations \(iter_{\text{max}}\), the particle number N, upper bounds \(U_{b}\) and lower bounds \(L_{b}\) of particle position and fitness function's dimension D;  
Step 2: Population initialization based on Circle chaotic mapping;  
Step 3: Calculate the fitness of each particle and record the current historical best position \(P_{i}\) for each particle, the current global best position \(P_{gbest}\) and optimal value of fitness \(G_{\text{best}}\);  
Step 4: Update the inertia weight \(\omega\), golden section coefficients \(x_{1}\) and \(x_{2}\), and position \(X_{i}^{iter}\);  
Step 5: Determine whether the updated particle position is out of bounds and use the boundary value as the particle position if it is;  
Step 6: Calculate particle fitness again, update the current best historical position \(P_{i}\) for each particle, the current global best position \(P_{gbest}\), and the current optimal value of fitness \(G_{\text{best}}\);  
Step 7: Repeat Step 4-6 before reaching the maximum iterations and return the optimal solution \(X_{\text{best}}\) and optimal value \(G_{\text{best}}\) after reaching it.