CMA-ES / libcmaes

libcmaes is a multithreaded C++11 library with Python bindings for high performance blackbox stochastic optimization using the CMA-ES algorithm for Covariance Matrix Adaptation Evolution Strategy
Other
321 stars 78 forks source link

Issue in elitism #171

Closed costashatz closed 6 years ago

costashatz commented 6 years ago

Is there a mistake in this line? I would say that count < cols()/2 makes more sense or not?

https://github.com/beniz/libcmaes/blob/fca58544296b3d34dcc8242b86f35b1f52df9f42/src/esostrategy.cc#L134

beniz commented 6 years ago

Thanks for catching this one. To be honest I couldn't remember whether it was intentional (maybe based on some old testing), but since it is wrong wrt the comment above that states that reinjection occurs when half or more candidates have value worse than the ref, I believe this is a bug.

I've tested the change very quickly and it seems fine, of course. If you would like fix it with a PR, I'll merge it immediately.

Note that we could imagine a slightly more custom reinjection scheme by having the ratio as a user parameter.

costashatz commented 6 years ago

I've tested the change very quickly and it seems fine, of course. If you would like fix it with a PR, I'll merge it immediately.

I will test it also in my cases and if nothing breaks, I will make the PR asap.

Note that we could imagine a slightly more custom reinjection scheme by having the ratio as a user parameter.

Maybe this is even better! I will make this PR then..

nikohansen commented 6 years ago

I have always used the condition that no single current candidate is better than the ever-best for re-injection. Unless I see evidence to the contrary, this remains to be the preferable elitist setting in my mind, because it is the least intrusive one.

beniz commented 6 years ago

OK, that makes sense, I'll provide the fix for the current bug though.