2 %> Algorithm 13.1: BFGS method with line search. Implementation of algorithm 13.1 of \cite Bier15-book
4 %> @author Michel Bierlaire
5 %> @date Sat Mar 21 16:29:03 2015
9 %> Applies BFGS algorithm with line search to solve \f$\min_x f(x)\f$ where \f$f:\mathbb{R}^n\to\mathbb{R}\f$.
11 %> @note Tested with \ref run0508bfgs.m
12 %> @note Tested with \ref runRosenbrockBfgs.m
15 %> @param obj the name of the Octave
function defining f(x) and its derivatives
16 %> @param x0 the starting point
17 %> @param eps algorithm stops if \f$\|\nabla f(x)\| \leq \varepsilon \f$.
18 %> @param maxiter maximum number of iterations (Default: 100)
19 %> @
return [solution,iteres,niter]
20 %> @
return solution: local minimum of the
function 21 %> @
return iteres: sequence of iterates generated by the algorithm. It contains n+2 columns. Columns 1:n contains the value of the current iterate. Column n+1 contains the value of the objective
function. Column n+2 contains the value of the norm of the gradient. It contains maxiter rows, but only the first niter rows are meaningful.
22 %> @
return niter: total number of iterations
23 function [solution,iteres,niter] =
bfgs(obj,x0,eps,maxiter=100)
24 addpath("../chap11") ;
25 iteres = zeros(1+ maxiter,4) ;
30 [f,g] = feval(obj,xk) ;
31 iteres(1,:) = [xk' f norm(g) ] ;
39 [f,g,H] = feval(obj,xk);
41 iteres(k+1,:) = [xk' f norm(g) ] ;
45 Hinv = (I - (d * y') / denom) * Hinv * (I - (y * d') / denom) + d * d' / \
47 until (norm(g) <= eps || k >= maxiter)
function bfgs(in obj, in x0, in eps, in maxiter)
Applies BFGS algorithm with line search to solve where .
function lineSearch(in obj, in x, in d, in alpha0, in beta1, in beta2, in lambda, in printlevel)
Applies the line search algorithm to find a step along a direction that verifies the Wolfe conditions...