| –Initialization |
| Initialize number of particles, dimension of |
| particle, maximum iterations, objective |
| optimization criteria, , and , and so forth. |
| For each particle i |
| Initialize and ; |
| Initialize ; |
| END |
| Initialize ; |
| –Search the Best Solution |
| Do |
| For each particle |
| Update according to Equation (3); |
| Update according to Equation (4); |
| Evaluate the fitness of current according to |
| Equations (1) and (2); |
| If current is better than , then |
| ; |
| End |
| End |
| Update using the best particle; |
| While max iterations or objective optimization |
| criteria is reached. |