Skip to main content
. 2025 Feb 10;25(4):1056. doi: 10.3390/s25041056
Algorithm 1 Optimization process of particle swarm algorithm
Input: Velocity and friction data pair sequence q˙¯i,τ¯f,inn=1N
Output: Optimal friction parameter set fc,i, fs,i, vs,i, ξi, fv,i, fp,i
1.   Initialize iterations t = 0, maximum iterations T
2:   Initialize position permissible range xmin, xmax, Initialize velocity permissible range vmin, vmax
3:   for particle i = 1 to N do
4:       for dimension d = 1 to 6 do
5:         Initialize position xid and velocity vid randomly within permissible range
6:       end for
7:   Initialize particle optimal position with xi
8:   Calculate particle i fitness value
9:   end for
10:   Initialize global optimal position with the particle with the greatest fitness
11:   for t = 0 to T do
12:       for particle i = 1, N do
13:         Calculate particle velocity according to vnt+1=ωvnt+c1k1pntxnt+c2k2pgtxnt
14:         Update particle position according to xnt+1=xnt+αvnt+1
15:         Update inertia factor ωt=ωe+ωsωeTt/T
16:         if position beyond permissible range then
17:           Restores position in last iteration, Inverse velocity, Update position according to new velocity
18:         end if
19:         Calculate particle i current fitness value
20:         if the fitness value is better than pnt in history then
21:           Set current fitness value as the pnt+1
22:         end if
23:       end for
24:       if the optimal fitness value is better than optimal particle in history then
25:         Set optima fitness value as the pgt+1
26:       end if
27:       if the optimal fitness value is less than the threshold twice break
28:   end for
29:   Save optimal fitness value as the optimal friction parameter set result