Open fps7806 opened 6 years ago
@fps7806 happy to accept a pull request. I just rescued this code from Google Code when it was shutting down so have little to no idea about it. However I'm sure there are other, actually maintained python implementations out there that might be better option.
For example: https://pypi.python.org/pypi/ecspy (package including NSGA-ii) https://github.com/haris989/NSGA-II (implementation with MIT licence) https://github.com/wreszelewski/nsga2 (no explicit licence so probably best avoided)
Funny enough, https://github.com/wreszelewski/nsga2 was the first one I found on GitHub. And also has this bug: https://github.com/wreszelewski/nsga2/issues/5
The very last line of the nsga2.py file has: front[i].distance += (front[i + 1].distance - front[i - 1].distance)
which should probably be: front[i].distance += (front[i + 1].objectives[obj_index] - front[i - 1].objectives[obj_index])
The error disables the density estimation portion of the algorithm (by setting all distances to inf/-inf/nan).
I know it's an old repo but would be good to let people know in case they stumble upon this like I did :)