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

Default progress function does not show iteration 0 #100

Closed beniz closed 9 years ago

beniz commented 9 years ago

The first iteration and f-value is not shown.

beniz commented 9 years ago

The reason for not showing the f-value at iteration 0 is that it is not computed. However, this is preventing showing other values, such as fevals and initial sigma, which is useful in plots.

Solution here is to show a NaN (not a number) value instead of nothing. This saves a call to the objective function while allowing other values to be printed out. It also fixes a potential crash in CMASolution::best_candidate() function on iteration 0.

There could be an option to compute the initial value of f and report it instead of NaN.

beniz commented 9 years ago

Example output with iteration 0:

INFO - CMA-ES / dim=10 / lambda=10 / sigma0=0.1 / mu=5 / mueff=3.41477 / c1=0.015255 / cmu=0.0231675 / lazy_update=0 / threads=4
INFO - iter=0 / evals=0 / f-value=nan / sigma=0.1 / last_iter=0
INFO - iter=1 / evals=10 / f-value=43.3449669847514 / sigma=0.0908957792161511 / last_iter=0
INFO - iter=2 / evals=20 / f-value=42.0364952150545 / sigma=0.0977540860690153 / last_iter=0
INFO - iter=3 / evals=30 / f-value=39.5268914113173 / sigma=0.110879911207047 / last_iter=0
INFO - iter=4 / evals=40 / f-value=38.5401714745405 / sigma=0.126315174703626 / last_iter=0