Skip to main content
. 2021 Dec 9;12(12):1532. doi: 10.3390/mi12121532
Algorithm 3. IFPASO algorithm.
1: Start
2: Randomly initialize particle swarm
3: While (number of iterations or the stopping iteration on is not met)
4: Evaluate fitness of the particle swarm
5: for n = 1 to number of particles
6: Find individual optimal solution pti
7: Find group optimal solution ptg
8: for d = 1 to number of dimensions of particle
9: update the velocity of particles via vt+1i=wtvti+c1r1(ptixti)+c2r2(ptgxti)
10: update the position of particles via xt+1i=xti+vt+1i
11: end for
12: end for
13: update the inertia weight via wt=(wmaxwmin)(tmaxt)tmax+wmin
14: end While
15: Output the best solution found
16: The best solution found by PSO is regarded as initial points for FPA algorithm gbest*
17: While t<Max_generation
18: for i=1:n (each flower in the population)
19: get dynamic switch probability p via 0.80.1Max_TtMax_T
20: if (rand < p)
21: Draw a (d-dimensional) step vector L which obeys a Lévy distribution
22: Global pollination via xit+1=xit+γL(λ)(xitgbest*)
23: else
24: Draw ε from a uniform distribution in [0, 1]
25: Do local pollination via xit+1=xit+ε(xjtxkt)
26: end if
27: Evaluate each new solution xit
28: If new solution is better, update it in the population
29: end for
30: Find the current best solution gbest*
31: end While
32: Output the final best solution found