You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it's not just this error
sorted1 = sort_by_values(front, values1[:])
sorted2 = sort_by_values(front, values2[:])
the obtained two ordinal lists must be opposite, because front is a non-dominated solution, then their distance calculations have been misplaced, and should be changed to:
def crowding_distance(values1, values2, front):
distance = [0 for i in range(0,len(front))]
sorted1 = sort_by_values(front, values1[:])
# sorted2 = sort_by_values(front, values2[:])
distance[0] = 4444444444444444
distance[len(front) - 1] = 4444444444444444
for k in range(1,len(front)-1):
distance[k] = abs(values1[sorted1[k+1]] - values1[sorted1[k-1]])/(max(values1)-min(values1))
distance[k] = distance[k]+ abs(values2[sorted1[k+1]] - values2[sorted1[k-1]])/(max(values2)-min(values2))
return distance
There is an error in Crowding Distance function.
It should be values1[i-1] - values1[i+i]
and values2[i-1] - values2[i+1]
The text was updated successfully, but these errors were encountered: