anyoptimization / pymoo

NSGA2, NSGA3, R-NSGA3, MOEAD, Genetic Algorithms (GA), Differential Evolution (DE), CMAES, PSO
https://pymoo.org
Apache License 2.0
2.27k stars 389 forks source link

Bug in gaussian mutation operator #481

Closed mpds closed 1 year ago

mpds commented 1 year ago

Hi, I believe there's a bug in the gaussian mutation operator. In this line, the scale parameter of the np.random.normal function can be negative depending on the problem's upper and lower bounds (negative values are not allowed for stdev). Maybe the intended behavior was:

np.random.normal(X[mut], sigma * abs(_xu - _xl))  # instead of (_xu * _xl) here
blankjul commented 1 year ago

Good catch! I just pushed a commit with a fix.