| Algorithm 1: The electoral process | |
| 1: | For each voter or follower |
| 2: | Update the voter or follower according to Equation (5) or Equation (6). |
| 3: | Calculate the individual fitness with the custom cost function and update the individual pbest. |
| 4: | Update the support rate according to Equation (3). |
| 5: | If the support rate of the voter is over fixed value, then change this voter to follower. |
| 6: | End |
| 7: | Calculate the competition rate according to Equation (2). |
| 8: | For each candidate |
| 9: | If random value <= competition rate |
| 10: | Update the candidate with competition according to Equation (4). |
| 11: | Else |
| 12: | Update the candidate without competition according to Equation (4). |
| 13: | End |
| 14: | Calculate the individual fitness with the custom cost function and update the individual pbest. |
| 15: | End |
| 16: | Reselect the leader and candidates. |
| 17: | If any candidate changes, then change its followers to voters. |