You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When doing (or using cmasols.print()): std::stringstream s; s << cmasols << std::endl;
Example output is: best solution => f-value=-7.15984 / fevals=1404 / sigma=39.6261 / iter=234 / elaps=516809ms / x=4.77428 9.80868
That is not correct though.
Actual best for this example: Correct f-vlaue: -8.03673
The output is pretty random, because it outputs Current best solution, not the best seen candidate.
The bug is in cmasolutions.cc, line 265: out << "best solution => f-value=" << best_candidate().get_fvalue() << " / fevals=" << _nevals << " / sigma=" << _sigma << " / iter=" << _niter << " / elaps=" << _elapsed_time << "ms" << " / x=" << gp.pheno(best_candidate().get_x_dvec()).transpose();
The used best_candidate() member function is wrong. Must be get_best_seen_candidate(). The correct results in the example were obtained using it.
The current output is very random, can be heavily different from real best value i.e. you m ay think that it doesn't converge at all with this lambda, while it converged nicely.
The text was updated successfully, but these errors were encountered:
beniz
changed the title
Critical bug: Wrong solution (f-value and params) printed as best when printing CMASolutions
Final solution (f-value and params) printed as best by CMASolutions object differs from best seen solution
Feb 9, 2019
beniz
changed the title
Final solution (f-value and params) printed as best by CMASolutions object differs from best seen solution
Best solution (f-value and params) printed as best by CMASolutions object differs from best seen solution
Feb 9, 2019
Hi, this is not a bug, the best (or final) value is that of the current (or final) iteration, to get best value over the full run, the call to get_best_seen_candidate() is the right way to do it, as you are mentioning.
Ok but the description is heavily misleading then.
It says "best solution" but it's not the best solution that has been found..
These solutions can often heavily differentiate e.g. -3 - which was good enough and +6, as well as an entirely different parameters values region.
I'm not the only one confused by it , as you saw in the #195.
Btw would be nice to catch some dumb errors like this: GenoPheno<pwqBoundStrategy, linScalingStrategy> gp( mins.data(), maxes.data(), dim ); CMAParameters<decltype(gp)> cmaparams( x0, sigma, lambda, 0, gp ); CMASolutions cmasols = cmaes<>( optimFn, cmaparams );// <-- no decltype(gp) given, but compiles without a hitch
When doing (or using cmasols.print()):
std::stringstream s; s << cmasols << std::endl;
Example output is:
best solution => f-value=-7.15984 / fevals=1404 / sigma=39.6261 / iter=234 / elaps=516809ms / x=4.77428 9.80868
That is not correct though.
Actual best for this example:
Correct f-vlaue: -8.03673
The output is pretty random, because it outputs Current best solution, not the best seen candidate.
The bug is in cmasolutions.cc, line 265:
out << "best solution => f-value=" << best_candidate().get_fvalue() << " / fevals=" << _nevals << " / sigma=" << _sigma << " / iter=" << _niter << " / elaps=" << _elapsed_time << "ms" << " / x=" << gp.pheno(best_candidate().get_x_dvec()).transpose();
The used best_candidate() member function is wrong. Must be get_best_seen_candidate(). The correct results in the example were obtained using it.
The current output is very random, can be heavily different from real best value i.e. you m ay think that it doesn't converge at all with this lambda, while it converged nicely.
The text was updated successfully, but these errors were encountered: