C++ implementation of the More-Thuente linesearch method as described in paper 'Line Search Algorithms with Guaranteed Sufficient Decrease', doi:10.1145/192115.192132, by Jorge J. More and David J. Thuente.
Eigen C++ library for linear algebra.
step = linesearchMoreThuente(p, x0, f0, F, G, ...Args)- p: search direction given as a vector
- f0: function value
- x0: initial set of parmeters
- F: function pointer to function (needs to take x0 in as first parameter)
- G: function pointer to get derivative (must be without arguments)
This will run linesearch with a default set of parameters. Additional arguments possibly used by F can be sent in as the last arguments.
struct Params {
/* struct of default parameters */
T maxIterations = 100; // maximum number of iterations
T mu = 0.5; // step scaling factor, (0<mu<=1/2<eta)
T eta = 1.0; // termination parameter (0<eta<1)
T delta = 4.0; // delta: scaling of step updating ([1.1,4.0])
T bisectWidth = 0.66; // extrapolation tolerance for bounds
T bracketTol = 1e-14; // termination tolerance for brackets
T aMin0 = 0.0; // lower bound for step (aMin>=0 and aMin<aMax)
T aMax0 = 100.0; // upper bound for step (aMax>aMin)
} params; // end struct Paramsstep = linesearchMoreThuente(¶ms, p, x0, f0, F, G)Support for member functions is implemented, but a pointer to object is required. Syntax is as follows(with an instance of FOO set to foo)
step = linesearchMoreThuente(p, x0, f0, foo, &FOO::F, &FOO::G)
step = linesearchMoreThuente(¶ms, p, x0, f0, foo, &FOO::F, &FOO::G)