[Insight-users] Potential Bug: LBFGSBOptimizer and epsmch/dpmeps_() in Release

Hauke Heibel heibel at cs.tum.edu
Thu Mar 13 08:09:16 EDT 2008


Hi there,

I've been struggling now all day with the proper parameter for 
SetCostFunctionConvergenceFactor(). Finally I decided to dig into the 
source to check what was going on and I observed a discrepancy between 
release and debug mode.

I've found that the function dpmeps_() returns in debug mode a value 
that is equivalent to std::numeric_limits<double>::epsilon() 
respectively DBL_EPSILON (either via <limits> or "float.h"). In release 
mode on the other hand side I suddenly ran into a different epsilon and 
even worse, dpmeps_() returned different values while the program was 
running - since it does not take any parameters this is rather strange 
assuming we are working in a deterministic environment.

Unfortunately I can not supply you with very detailed information nor 
can I offer a sample program at the moment. I found the error by adding 
a simple
    printf("tol: %g", epsmch);
after line 748 in lbfgs.c (most recent CVS snapshot).

The output of my program using the LBFGSBOptimizer was:

tol: 2.22045e-016
tol: 1.0842e-019
tol: 1.0842e-019
tol: 1.0842e-019
...

I am wondering about the advantage of dpmeps_() over DBL_EPSILON though 
I have to admit that I did not read the paper referenced in the sub-routine.

The fix I am currently working with is that I am including "float.h" and 
I replaced line 748 with

    epsmch = DBL_EPSILON; /*dpmeps_();*/

Finally knowing about the parameter, I was also finally able to set the 
convergence factor such that it is resembling a percentage value of the 
change which I personally regard as much more intuitive. This can be 
achieved e.g. by
    0.001*1.0/std::numeric_limits<double>::epsilon()
corresponding to a change of 0.1% in the cost function between two 
successive iterations.

I hope this is of help for others and if you think this is worth a bug 
report, I will do so.

Cheers,
Hauke

Compiler Version: Microsoft (R) C/C++ Optimizing Compiler Version 
14.00.50727.762 for x64

-- 
Tim Hauke Heibel
Computer Aided Medical Procedures (CAMP)
fon: +49 89 289 19427
fax: +49 89 289 17059



More information about the Insight-users mailing list