PatWie / CppNumericalSolvers

a lightweight header-only C++17 library of numerical optimization methods for nonlinear functions based on Eigen
MIT License
878 stars 201 forks source link

LbfgsbSolver<TProblem>::SubspaceMinimization for first iteration #122

Closed jake-camero closed 4 years ago

jake-camero commented 4 years ago

This issue refers to version 1.0.0 (last stable version), though it might occur also in later versions (I haven't checked that). This is the issue:

The example nonnegls.cpp crashes in the very first call to LbfgsbSolver::SubspaceMinimization.

I think the reason is that for the first iteration matrix W still has zero columns (as there are no previous steps yet). I think that the problem will be fixed if, for the first iteration,

du(i) = -g(i) , if bounds are not active at i, or they are active but g(i) points outward du(i) = 0, otherwise

Obviously, if at every position bounds are active with the gradient pointing inward, an optimum has been reached

PatWie commented 4 years ago

I saw this issue with newer versions of EIGEN. I will take a look.

PatWie commented 4 years ago

Should be fixed in 2649780e8f136381dd7f0dc406482a4f16b54b18