2 %> Algorithm 10.2: Local Newton
for optimization
using the quadratic model. Implementation of algorithm 10.2 of \cite Bier15-book
4 %> @author <a href=
"http://people.epfl.ch/michel.bierlaire">Michel Bierlaire</a>
5 %> @date Fri Mar 20 16:14:06 2015
9 %> @note Tested with \ref run0508quadratic.m
13 %> Applies local Newton algorithm to solve \f$\nabla f(x)=0\f$ where \f$\nabla f:\mathbb{R}^n\to\mathbb{R}^n \f$ is the gradient of the objective
function.
14 %> @param obj the name of the Octave
function defining \f$\nabla f(x)\f$ and the hessian \f$\nabla^2 f(x)\f$
15 %> @param x0 the starting point
16 %> @param eps algorithm stops if \f$\|F(x)\| \leq \varepsilon \f$.
17 %> @param cg
if 0, the quadratic model is solved
using the direct method. If not zero,
using the conjugate gradient algorithm.
18 %> @param maxiter maximum number of iterations (Default: 100)
19 %> @
return [solution,f]
20 %> @
return solution: root of the
function 21 %> @
return f: value of F at the solution
23 addpath("../chap09") ;
25 [g,H] = feval(obj,xk) ;
31 % Note that the CG algorithm is started from 0.
35 [g,H] = feval(obj,xk) ;
37 until (norm(g) <= eps || k >= maxiter)
function newtonLocalQuadratic(in obj, in x0, in eps, in cg, in maxiter)
Applies local Newton algorithm to solve where is the gradient of the objective function.
function quadraticDirect(in Q, in b)
Applies the direct resolution method to solve where and .
function conjugateGradient(in Q, in b, in x0, in printlevel)
Applies the conjugate gradient method to solve where and .