wreszelewski / nsga2

Implementation NSGA-II algorithm in form of python library
103 stars 50 forks source link

Question about crowding distance calculation #5

Open Mawad24 opened 6 years ago

Mawad24 commented 6 years ago

Hello, I am very interested in your code and I may use it during my work on the PHD thesis if you have no problem. Actually I am new in this domain (NSGA 2 algorithm and related concepts) and I am trying to understand the code. During my research about NSGA 2 algorithm I found that the crowding distance for individuals (other than the first and last one) is the difference of the objective value of two closet neighbors. But in your code, you calculated the crowding distance of an individual by the difference of the crowding distance of two closet neighbors. Can you explain please?

Thank you in advance for your time.

guvcolie commented 5 years ago

@Mawad24 , I think below is RIGHT:

front[index].crowding_distance += \ (front[index + 1].objectives[m] - front[index - 1].objectives[m]) / \ (self.problem.max_objectives[m] - self.problem.min_objectives[m])