Hi team, thanks for the great library!
While testing CMA-ES, I found an index mismatch in update_distribution that corrupts the negative weight adaptation (Active CMA-ES) and leads to convergence failures.
The Bug: When calculating w_o, the code uses d.T to calculate the norm:
w_o = self._w*np.where(self._w >= 0, 1.0, self.ndim_problem/(np.square(
np.linalg.norm(cm_minus_half @ d.T, axis=0)) + 1e-8))
However, self._w is rank-based (sorted), while d.T is chronologically ordered (unsorted). This means the norm of an unsorted individual is erroneously used to scale the ranked update, distorting the covariance matrix.
The Fix: Changing d.T to d[order].T.
Results: This single-line fix brings major improvements on functions like Ackley, Cigar, and Rosenbrock. The success rates now closely match the official pycma baseline.
Hope this helps! 😊
Hi team, thanks for the great library!
While testing CMA-ES, I found an index mismatch in
update_distributionthat corrupts the negative weight adaptation (Active CMA-ES) and leads to convergence failures.The Bug: When calculating
w_o, the code usesd.Tto calculate the norm:However,
self._wis rank-based (sorted), whiled.Tis chronologically ordered (unsorted). This means the norm of an unsorted individual is erroneously used to scale the ranked update, distorting the covariance matrix.The Fix: Changing
d.Ttod[order].T.Results: This single-line fix brings major improvements on functions like Ackley, Cigar, and Rosenbrock. The success rates now closely match the official
pycmabaseline.Hope this helps! 😊