diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_optim.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/test_optim.py b/test/test_optim.py index 87b0268..48de38a 100644 --- a/test/test_optim.py +++ b/test/test_optim.py @@ -104,3 +104,13 @@ def test_solve_1d_linesearch_quad_funct(): np.testing.assert_allclose(ot.optim.solve_1d_linesearch_quad(1, -1, 0), 0.5) np.testing.assert_allclose(ot.optim.solve_1d_linesearch_quad(-1, 5, 0), 0) np.testing.assert_allclose(ot.optim.solve_1d_linesearch_quad(-1, 0.5, 0), 1) + + +def test_line_search_armijo(): + xk = np.array([[0.25, 0.25], [0.25, 0.25]]) + pk = np.array([[-0.25, 0.25], [0.25, -0.25]]) + gfk = np.array([[23.04273441, 23.0449082], [23.04273441, 23.0449082]]) + old_fval = -123 + # Should not throw an exception and return None for alpha + alpha, _, _ = ot.optim.line_search_armijo(lambda x: 1, xk, pk, gfk, old_fval) + assert alpha is None |