CMA-ES / pycma

Python implementation of CMA-ES
Other
1.08k stars 177 forks source link

What is the point of calculating 1^2 in recombination_weights.py? #250

Closed Jark5455 closed 6 months ago

Jark5455 commented 6 months ago

Hello,

I noticed that in the recombination_weights.py file, at line 237 the code calculates the value of 1 squared. Is there a reason for this? Will it not just get optimized out by the interpreter?

nikohansen commented 6 months ago

The reason is to remind (me) why we see the one in the nominator of this expression: it comes from $(\sum_i |w_i|)^2$ which needs to be one for this code line to be correct.

Jark5455 commented 6 months ago

:thumbsup: