Skip to content

Commit 2b0aeae

Browse files
author
Nilesh Patra
committed
Prevent alpha from underflowing
1 parent e49870a commit 2b0aeae

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/cppoptlib/linesearch/armijo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ class Armijo {
5353
const ScalarType f_in = function(x, &gradient);
5454
ScalarType f = function(x + alpha * search_direction);
5555
const ScalarType cache = c * gradient.dot(search_direction);
56+
const Scalar alpha_min = 1e-8;
5657

57-
while (f > f_in + alpha * cache) {
58+
while (f > f_in + alpha * cache && alpha > alpha_min) {
5859
alpha *= rho;
5960
f = function(x + alpha * search_direction);
6061
}

0 commit comments

Comments
 (0)