Example #1
0
        /*************************************************************************
        *  Levenberg-Marquardt algorithm results
        *
        *  Called after MinLMIteration returned False.
        *
        *  Input parameters:
        *   State   -   algorithm state (used by MinLMIteration).
        *
        *  Output parameters:
        *   X       -   array[0..N-1], solution
        *   Rep     -   optimization report:
        * Rep.TerminationType completetion code:
        * -1    incorrect parameters were specified
        *  1    relative function improvement is no more than
        *                           EpsF.
        *  2    relative step is no more than EpsX.
        *  4    gradient is no more than EpsG.
        *  5    MaxIts steps was taken
        *  7    stopping conditions are too stringent,
        *                           further improvement is impossible
        * Rep.IterationsCount contains iterations count
        * Rep.NFunc     - number of function calculations
        * Rep.NJac      - number of Jacobi matrix calculations
        * Rep.NGrad     - number of gradient calculations
        * Rep.NHess     - number of Hessian calculations
        * Rep.NCholesky - number of Cholesky decomposition calculations
        *
        *  -- ALGLIB --
        *    Copyright 10.03.2009 by Bochkanov Sergey
        *************************************************************************/
        public static void minlmresults(ref minlmstate state,
                                        ref double[] x,
                                        ref minlmreport rep)
        {
            int i_ = 0;

            x = new double[state.n - 1 + 1];
            for (i_ = 0; i_ <= state.n - 1; i_++)
            {
                x[i_] = state.x[i_];
            }
            rep.iterationscount = state.repiterationscount;
            rep.terminationtype = state.repterminationtype;
            rep.nfunc           = state.repnfunc;
            rep.njac            = state.repnjac;
            rep.ngrad           = state.repngrad;
            rep.nhess           = state.repnhess;
            rep.ncholesky       = state.repncholesky;
        }
Example #2
0
        /*************************************************************************
        Levenberg-Marquardt algorithm results

        Buffered implementation of MinLMResults(), which uses pre-allocated buffer
        to store X[]. If buffer size is  too  small,  it  resizes  buffer.  It  is
        intended to be used in the inner cycles of performance critical algorithms
        where array reallocation penalty is too large to be ignored.

          -- ALGLIB --
             Copyright 10.03.2009 by Bochkanov Sergey
        *************************************************************************/
        public static void minlmresultsbuf(minlmstate state,
            ref double[] x,
            minlmreport rep)
        {
            int i_ = 0;

            if( alglib.ap.len(x)<state.n )
            {
                x = new double[state.n];
            }
            for(i_=0; i_<=state.n-1;i_++)
            {
                x[i_] = state.x[i_];
            }
            rep.iterationscount = state.repiterationscount;
            rep.terminationtype = state.repterminationtype;
            rep.funcidx = state.repfuncidx;
            rep.varidx = state.repvaridx;
            rep.nfunc = state.repnfunc;
            rep.njac = state.repnjac;
            rep.ngrad = state.repngrad;
            rep.nhess = state.repnhess;
            rep.ncholesky = state.repncholesky;
        }
Example #3
0
        /*************************************************************************
        Levenberg-Marquardt algorithm results

        INPUT PARAMETERS:
            State   -   algorithm state

        OUTPUT PARAMETERS:
            X       -   array[0..N-1], solution
            Rep     -   optimization  report;  includes  termination   codes   and
                        additional information. Termination codes are listed below,
                        see comments for this structure for more info.
                        Termination code is stored in rep.terminationtype field:
                        * -7    derivative correctness check failed;
                                see rep.wrongnum, rep.wrongi, rep.wrongj for
                                more information.
                        * -3    constraints are inconsistent
                        *  1    relative function improvement is no more than
                                EpsF.
                        *  2    relative step is no more than EpsX.
                        *  4    gradient is no more than EpsG.
                        *  5    MaxIts steps was taken
                        *  7    stopping conditions are too stringent,
                                further improvement is impossible
                        *  8    terminated by user who called minlmrequesttermination().
                                X contains point which was "current accepted" when
                                termination request was submitted.

          -- ALGLIB --
             Copyright 10.03.2009 by Bochkanov Sergey
        *************************************************************************/
        public static void minlmresults(minlmstate state,
            ref double[] x,
            minlmreport rep)
        {
            x = new double[0];

            minlmresultsbuf(state, ref x, rep);
        }
Example #4
0
 public override alglib.apobject make_copy()
 {
     minlmreport _result = new minlmreport();
     _result.iterationscount = iterationscount;
     _result.terminationtype = terminationtype;
     _result.funcidx = funcidx;
     _result.varidx = varidx;
     _result.nfunc = nfunc;
     _result.njac = njac;
     _result.ngrad = ngrad;
     _result.nhess = nhess;
     _result.ncholesky = ncholesky;
     return _result;
 }
Example #5
0
        /*************************************************************************
        Levenberg-Marquardt algorithm results

        Called after MinLMIteration returned False.

        Input parameters:
            State   -   algorithm state (used by MinLMIteration).

        Output parameters:
            X       -   array[0..N-1], solution
            Rep     -   optimization report:
                        * Rep.TerminationType completetion code:
                            * -1    incorrect parameters were specified
                            *  1    relative function improvement is no more than
                                    EpsF.
                            *  2    relative step is no more than EpsX.
                            *  4    gradient is no more than EpsG.
                            *  5    MaxIts steps was taken
                            *  7    stopping conditions are too stringent,
                                    further improvement is impossible
                        * Rep.IterationsCount contains iterations count
                        * Rep.NFunc     - number of function calculations
                        * Rep.NJac      - number of Jacobi matrix calculations
                        * Rep.NGrad     - number of gradient calculations
                        * Rep.NHess     - number of Hessian calculations
                        * Rep.NCholesky - number of Cholesky decomposition calculations

          -- ALGLIB --
             Copyright 10.03.2009 by Bochkanov Sergey
        *************************************************************************/
        public static void minlmresults(ref minlmstate state,
            ref double[] x,
            ref minlmreport rep)
        {
            int i_ = 0;

            x = new double[state.n-1+1];
            for(i_=0; i_<=state.n-1;i_++)
            {
                x[i_] = state.x[i_];
            }
            rep.iterationscount = state.repiterationscount;
            rep.terminationtype = state.repterminationtype;
            rep.nfunc = state.repnfunc;
            rep.njac = state.repnjac;
            rep.ngrad = state.repngrad;
            rep.nhess = state.repnhess;
            rep.ncholesky = state.repncholesky;
        }