Skip to main content
. 2021 Jan 14;21(2):558. doi: 10.3390/s21020558
Algorithim 2 Pseudocode of calculating the crowding distance
1. Input:
2.    NSol
3.   objectiveValues
4. Output:
5.    CrowdingDistance
6. Start:
7.    crowdingDistance = zeros (NSol);
8.    crowdingDistance (1) = crowdingDistance (NSol) = 
9.    for (each i objective of objectiveValues) sortedSolutions = sort (NSol,i);
10.     for (solution j from 2 to NSol)
11.       crowdingDistance (j) = crowdingDistance(j) + objectiveValues(i) − objectiveValues(i − 1);
12.     end for
13.     end for
14. End