| Algorithm 3: Gravity function | |
| Function: (Tpopulation) = Gravity (Hpopulation, capacity) | |
| Input: Hpopulation, capacity | |
| Output: Tpopulation | |
| 1: Tpopulation ← Hpopulation | |
| 2: For each solution vector of Hpopulation do | |
| 3: Update the position of the current solution vector by using (22) | |
| 4: Return the out-of-bounds solution vector to the boundary | |
| 5: End for | |
| 6: (Tpopulation, |