| Initialize the dragonflies population Xi (i = 1, 2, …, n) |
| Initialize step vectors Xi (i = 1, 2, …, n) |
| Define the maximum number of hyperspheres (segments). Define the archive size |
| while the end condition is not satisfied |
| Calculate the objective values of all dragonflies |
| Find the nondominated solutions |
| Update the archive with respect to the obtained nondominated solutions |
| If the archive is full |
| Run the archive maintenance mechanism to omit |
| one of the current archive members Add the new |
| the solution to the archive |
| End if |
| If any of the new added solutions to the archive is |
| located outside the hyperspheres |
| Update and reposition all of the hyperspheres to cover the new solution(s) |
| End if |
| Select a food source from the archive: = |
| SelectFood (archive) |
| Select an enemy from archive: = SelectEnemy (archive) |
| Update step vectors using equation (8) |
| Update position vectors using equation (9) |
| Check and correct the new positions based on the |
| boundaries of variables |
| End while |