| Algorithim 2 Pseudocode of calculating the crowding distance | |
| 1. | Input: |
| 2. | |
| 3. | objectiveValues |
| 4. | Output: |
| 5. | CrowdingDistance |
| 6. | Start: |
| 7. | crowdingDistance = zeros (); |
| 8. | crowdingDistance (1) = crowdingDistance () = |
| 9. | for (each objective of objectiveValues) sortedSolutions = sort (,); |
| 10. | for (solution from 2 to ) |
| 11. | crowdingDistance () = crowdingDistance() + objectiveValues() − objectiveValues( − 1); |
| 12. | end for |
| 13. | end for |
| 14. | End |