DescriptionRefactor line search functions out of optimize.py
Also, split each line search function
f(x + s*p) -> suitable minimum
to a scalar search function
phi(s) -> suitable minimum
and a wrapper
phi_p(s) = f(x + s*p)
that makes it a line search.
This refactoring is necessary when we want to use the *same* line search
functions we use in optimization in solving nonlinear equations. This is
because in large-scale non-linear equations we want to minimize
f(x) = |F(x)|_2^2, but it is impossible to compute the gradient
f'(x) = J(x)^T F(x), even though it is easy to compute the derivative
phi'(s) = d phi(s)/ds directly [eg. by numerical differentiation].
Tests for line searches are also added. These basically check that they
do what they promise, for a couple of problems. Not all corner cases are
still tested, though.
Also added a couple of tests that check eg. that fmin_bfgs and other routines
that use these line search routines
- produce the same sequence of x_k as before
- require the same number of function calls as before
This tries to ensure that these changes to subroutines doesn't change
the behavior of the top-level routines.
However, I have the feeling that the test coverage is not yet really
sufficient; the test_optimize.py tests don't offer 100% coverage of
the optimize.py code branches.
Patch Set 1 #
Total comments: 4
MessagesTotal messages: 1
|