Open MikeChenfu opened 5 years ago
您好,我测试了代码并将结果与R比较。为什么结果值的数量与R的结果不同?我是NSGA的初学者。如果有人对此有想法,我将不胜感激。非常感谢。
我在学习nsga2的时候,也发现这里可能有个错误,可否给个联系方式一起交流一下?
Hello, I test the code and compare the results with R. Why is the number of result values different from R's result? I am a beginner to the NSGA. I appreciate if anyone has idea about it. Many thanks.
It seems like there is an issue in crowding_distance
function - values for different axis is mixed together. There should be
for k in range(1,len(front)-1):
distance[k] = distance[k]+ (values1[sorted1[k+1]] - values1[sorted1[k-1]])/(max(values1)-min(values1))
for k in range(1,len(front)-1):
distance[k] = distance[k]+ (values2[sorted2[k+1]] - values2[sorted2[k-1]])/(max(values2)-min(values2))
instead of
for k in range(1,len(front)-1):
distance[k] = distance[k]+ (values1[sorted1[k+1]] - values2[sorted1[k-1]])/(max(values1)-min(values1))
for k in range(1,len(front)-1):
distance[k] = distance[k]+ (values1[sorted2[k+1]] - values2[sorted2[k-1]])/(max(values2)-min(values2))
I'm not for 100% sure that this is accurate fix, but it based on original paper (http://www.dmi.unict.it/mpavone/nc-cs/materiale/NSGA-II.pdf, p. 185, bottom of the page).
Hope it will help!
UPD: Just found out that there is already a pull request for this issue.
Hello, I test the code and compare the results with R. Why is the number of result values different from R's result? I am a beginner to the NSGA. I appreciate if anyone has idea about it. Many thanks.