Ejemplo n.º 1
0
        /*************************************************************************
        MinNS results

        INPUT PARAMETERS:
            State   -   algorithm state

        OUTPUT PARAMETERS:
            X       -   array[0..N-1], solution
            Rep     -   optimization report. You should check Rep.TerminationType
                        in  order  to  distinguish  successful  termination  from
                        unsuccessful one:
                        * -8   internal integrity control  detected  infinite  or
                               NAN   values   in   function/gradient.    Abnormal
                               termination signalled.
                        * -3   box constraints are inconsistent
                        * -1   inconsistent parameters were passed:
                               * penalty parameter for minnssetalgoags() is zero,
                                 but we have nonlinear constraints set by minnssetnlc()
                        *  2   sampling radius decreased below epsx
                        *  7    stopping conditions are too stringent,
                                further improvement is impossible,
                                X contains best point found so far.
                        *  8    User requested termination via minnsrequesttermination()

          -- ALGLIB --
             Copyright 18.05.2015 by Bochkanov Sergey
        *************************************************************************/
        public static void minnsresults(minnsstate state,
            ref double[] x,
            minnsreport rep)
        {
            x = new double[0];

            minnsresultsbuf(state, ref x, rep);
        }
Ejemplo n.º 2
0
        /*************************************************************************

        Buffered implementation of minnsresults() 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 18.05.2015 by Bochkanov Sergey
        *************************************************************************/
        public static void minnsresultsbuf(minnsstate state,
            ref double[] x,
            minnsreport rep)
        {
            int i = 0;
            int i_ = 0;

            if( alglib.ap.len(x)<state.n )
            {
                x = new double[state.n];
            }
            rep.iterationscount = state.repinneriterationscount;
            rep.nfev = state.repnfev;
            rep.varidx = state.repvaridx;
            rep.funcidx = state.repfuncidx;
            rep.terminationtype = state.repterminationtype;
            rep.cerr = Math.Max(state.replcerr, state.repnlcerr);
            rep.lcerr = state.replcerr;
            rep.nlcerr = state.repnlcerr;
            if( state.repterminationtype>0 )
            {
                for(i_=0; i_<=state.n-1;i_++)
                {
                    x[i_] = state.xc[i_];
                }
            }
            else
            {
                for(i=0; i<=state.n-1; i++)
                {
                    x[i] = Double.NaN;
                }
            }
        }
Ejemplo n.º 3
0
 public override alglib.apobject make_copy()
 {
     minnsreport _result = new minnsreport();
     _result.iterationscount = iterationscount;
     _result.nfev = nfev;
     _result.cerr = cerr;
     _result.lcerr = lcerr;
     _result.nlcerr = nlcerr;
     _result.terminationtype = terminationtype;
     _result.varidx = varidx;
     _result.funcidx = funcidx;
     return _result;
 }