fminnewton.m

From Spinach Documentation Wiki
Jump to: navigation, search

Finds a local maximum of a function of several variables, based on fminlbfgs.m code from D. Kroon, University of Twente (Nov 2010).

Syntax

    [x,data]=fminnewton(spin_system,cost_function,guess)

Arguments

   spin_system   - Spinach data object that has been
                   through optimcon.m function

   cost_function - a function handle that takes the input
                   the size of guess

   guess         - the initial point of the optimisation

Outputs

   x               - the final point of the optimisation

   data.count.iter - iteration counter

   data.count.fx   - function evaluation counter

   data.count.gfx  - gradient evaluation counter

   data.count.hfx  - Hessian evaluation counter

   data.count.rfo  - RFO iteration counter

   data.x_shape    - output of size(guess)

   data.*          - further fields may be set by the 
                     objective functon

Examples

The output of examples/optimal_control/state_transfer_hcf.m example file:

 ========================================================================================
 Iter  #f   #g   #H   #R    fidelity      penalties     total        alpha     |grad|    
 ----------------------------------------------------------------------------------------
 1     2    2    1    2    +0.163753     +0.000000     +0.163753     1e+00    1.447e+00 
 2     9    9    2    3    +0.305173     +0.000000     +0.305173     9e-03    1.898e+00 
 3     13   13   3    5    +0.513873     +0.000000     +0.513873     4e-01    1.692e+00 
 4     16   16   4    7    +0.743326     +0.000000     +0.743326     7e-01    2.111e+00 
 5     21   21   5    8    +0.812133     +0.000000     +0.812133     9e-03    1.979e+00 
 6     23   23   6    10   +0.948756     +0.000000     +0.948756     1e+00    6.317e-01 
 7     25   25   7    12   +0.986041     +0.000000     +0.986041     1e+00    6.025e-01 
 8     27   27   8    14   +0.995028     +0.000000     +0.995028     1e+00    1.037e-01 
 9     30   30   9    17   +0.997445     +0.000000     +0.997445     5e-01    2.001e-01 
 10    32   32   10   21   +0.999410     +0.000000     +0.999410     1e+00    9.158e-02 
 11    36   36   11   26   +0.999674     +0.000000     +0.999674     2e-01    5.248e-02 
 12    38   38   12   34   +0.999979     +0.000000     +0.999979     1e+00    1.869e-02 
 13    40   40   13   54   +1.000000     +0.000000     +1.000000     1e+00    2.601e-03 
 14    42   42   14   92   +1.000000     +0.000000     +1.000000     1e+00    3.036e-05 
 15    44   44   15   158  +1.000000     +0.000000     +1.000000     1e+00    9.695e-07 
 16    46   46   16   252  +1.000000     +0.000000     +1.000000     1e+00    6.516e-08 
 ----------------------------------------------------------------------------------------
     Algorithm Used     : Newton-Raphson method
     Exit message       : norm(step,1) < tol_x
     Iterations         : 16
     Function Count     : 46
     Gradient Count     : 46
     Hessian Count      : 16
 ========================================================================================

Notes

All algorithm parameters are set during a call to optimcon.m when the optimal control problem is set up.

See also

linesearch.m, hessreg.m, optimcon.m, lbfgs.m


Version 2.2, authors: David Goodwin, Ilya Kuprov