diff --git a/include/cppoptlib/solver/lbfgsb.h b/include/cppoptlib/solver/lbfgsb.h index c0253f7..b46cc67 100644 --- a/include/cppoptlib/solver/lbfgsb.h +++ b/include/cppoptlib/solver/lbfgsb.h @@ -242,13 +242,14 @@ class Lbfgsb : public Solver { alphastar, (upper_bound_(free_variables.at(i)) - x_cp(free_variables.at(i))) / du(i)); - } else { + } else if (du(i) < 0) { alphastar = std::min( alphastar, (lower_bound_(free_variables.at(i)) - x_cp(free_variables.at(i))) / du(i)); } } + assert(alphastar >= 0); return alphastar; }