Skip to main content
. 2025 Mar 14;10(3):180. doi: 10.3390/biomimetics10030180
Algorithm 3: The IPSO algorithm
1: Set various parameters of the IPSO.
2: Initialize the positions and velocities of population randomly, and calculate the fitness value.
3: Enter main loop until the end condition is triggered.
4:         Calculate the mutation rate according to Equation (7).
5:         For each voter or follower
6:                 If random value <= mutation rate
7:                         If random value <= fixed rate
8:                                 Update the voter or follower with random mutation according to Equation (8).
9:                          Else
10:                                 Update the voter or follower with Cauchy mutation according to Equation (9).
11:                          End
12:                  Else
13:                         Update the voter or follower without mutation according to Equation (5) or Equation (6).
14:                  End
15:                  Calculate the individual fitness with the custom cost function and up- date the individual pbest.
16:                  Update the support rate according to Equation (3).
17:                  If the support rate of the voter is over fixed value, then change this voter to follower.
18:          End
19:          Calculate the competition rate according to Equation (2).
20:          For each candidate
21:                 If random value <= competition rate
22:                         Update the candidate with competition according to Equation (4).
23:                  Else
24:                         Update the candidate without competition according to Equation (4).
25:                  End
26:                  Calculate the individual fitness with the custom cost function and up- date the individual pbest.
27:         End
28:         Reselect the leader and candidates.
29:         If any candidate changes, then change its followers to voters.
30:         i = i + 1.
31: Exit main loop to end the optimization process.