Simplified Trust Region Newton Method (TRON) for non-linear optimization.

Trust region is a term used in mathematical optimization to denote the subset of the region of the objective function to be optimized that is approximated using a model function (often a quadratic). If an adequate model of the objective function is found within the trust region then the region is expanded; conversely, if the approximation is poor then the region is contracted. Trust region methods are also known as restricted step methods.

The fit is evaluated by comparing the ratio of expected improvement from the model approximation with the actual improvement observed in the objective function. Simple thresholding of the ratio is used as the criteria for expansion and contraction—a model function is "trusted" only in the region where it provides a reasonable approximation.

Trust region methods are in some sense dual to line search methods: trust region methods first choose a step size (the size of the trust region) and then a step direction while line search methods first choose a step direction and then a step size.

This class implements a simplified version of Chih-Jen Lin and Jorge Moré's TRON, a trust region Newton method for the solution of large bound-constrained optimization problems. This version was based upon liblinear's implementation.

References: Wikipedia, The Free Encyclopedia. Trust region. Available on: http://en.wikipedia.org/wiki/Trust_region Chih-Jen Lin and Jorge Moré, TRON. Available on: http://www.mcs.anl.gov/~more/tron/index.html Chih-Jen Lin and Jorge J. Moré. 1999. Newton's Method for Large Bound-Constrained Optimization Problems. SIAM J. on Optimization 9, 4 (April 1999), 1100-1127. Machine Learning Group. LIBLINEAR -- A Library for Large Linear Classification. National Taiwan University. Available at: http://www.csie.ntu.edu.tw/~cjlin/liblinear/

Inheritance: BaseGradientOptimizationMethod
        /// <summary>
        ///   Constructs a new Newton method algorithm for L2-regularized
        ///   Support Vector Classification problems in the primal form (-s 2).
        /// </summary>
        /// 
        /// <param name="machine">A support vector machine.</param>
        /// <param name="inputs">The input data points as row vectors.</param>
        /// <param name="outputs">The output label for each input point. Values must be either -1 or +1.</param>
        /// 
        public LinearNewtonMethod(SupportVectorMachine machine, double[][] inputs, int[] outputs)
            : base(machine, inputs, outputs)
        {
            if (!IsLinear)
                throw new ArgumentException("Only linear machines are supported.", "machine");

            int samples = inputs.Length;
            int parameters = machine.Inputs + 1;

            this.z = new double[samples];
            this.I = new int[samples];
            this.wa = new double[samples];

            this.g = new double[parameters];
            this.h = new double[parameters];
            this.biasIndex = machine.Inputs;

            tron = new TrustRegionNewtonMethod(parameters);
        }