Ejemplo n.º 1
0
        public MainProgram()
        {
            #region Set Dependencies

            sfun   = new SFUN();
            monit  = new MONIT();
            ztime  = new ZTIME();
            stpmax = new STPMAX();
            modz   = new MODZ();
            cnvtst = new CNVTST();
            crash  = new CRASH();
            negvec = new NEGVEC();
            lsout  = new LSOUT();
            mchpr1 = new MCHPR1();
            ssbfgs = new SSBFGS();
            getptc = new GETPTC();
            ddot   = new DDOT();
            daxpy  = new DAXPY();
            dnrm2  = new DNRM2();
            dcopy  = new DCOPY();
            dxpy   = new DXPY();
            gtims  = new GTIMS(SUBSCR);
            setpar = new SETPAR(SUBSCR);
            ndia3  = new NDIA3(ddot);
            step1  = new STEP1(mchpr1);
            chkucp = new CHKUCP(mchpr1, dnrm2);
            setucr = new SETUCR(ddot);
            mslv   = new MSLV(ddot, ssbfgs);
            msolve = new MSOLVE(mslv, SUBSCR);
            initp3 = new INITP3(ddot, dcopy);
            initpc = new INITPC(initp3, SUBSCR);
            modlnp = new MODLNP(ddot, initpc, ztime, msolve, gtims, ndia3, daxpy, negvec, dcopy);
            linder = new LINDER(ddot, getptc, lsout, dcopy);
            lmqn   = new LMQN(dnrm2, step1, ddot, setpar, chkucp, setucr, modlnp, dcopy, linder, dxpy
                              , SUBSCR);
            mainc  = new MAINC(sfun, lmqn);
            tn     = new TN(mchpr1, lmqn);
            mains  = new MAINS(sfun, tn);
            lmqnbc = new LMQNBC(ddot, dnrm2, step1, crash, setpar, chkucp, setucr, ztime, monit, modlnp
                                , dcopy, stpmax, linder, modz, cnvtst, dxpy, SUBSCR);
            maincb = new MAINCB(sfun, lmqnbc);
            tnbc   = new TNBC(mchpr1, lmqnbc);
            mainsb = new MAINSB(sfun, tnbc);

            #endregion
        }
Ejemplo n.º 2
0
        ///// <summary>
        ///// The number of function evaluations used to compute the minimum.
        ///// </summary>
        //protected int FunEvaluations
        //{
        //    get { return MeFunEvaluations; }
        //    set { MeFunEvaluations = value; }
        //}

        #endregion


        #region Public Methods


        public double[] ComputeMin(OptMultivariateFunction function, OptMultivariateGradient gradient, OptVariable[] variables, double tolerance, double ACCRCY, ref int nMax)
        {
            if (this.MeLMQN == null)
            {
                this.MeLMQN = new LMQN();
            }

            this.Initialize(function, gradient, variables);

            if (this.MeNumFreeVariables == 0)
            {
                return(this.MeExternalVariables);
            }

            int IERROR = 0;

            this.MeLMQN.Run(ref IERROR, this.MeNumFreeVariables, ref this.MeFreeVariables, 0, ref this.MeF,
                            ref this.MeGradientArray, 0, ref this.MeW, 0, this.MeLW, this.internalFunction, this.MeMSGLVL, this.MeMAXIT, nMax,
                            this.MeETA, this.MeSTEPMX, ACCRCY, tolerance);


            int index = 0;

            for (int i = 0; i < variables.Length; i++)
            {
                if (variables[i].Fixed == false)
                {
                    this.MeExternalVariables[i] = this.MeFreeVariables[index];
                    index++;
                }
            }

            nMax = this.internalFunction.FunEvaluations;

            return(this.MeExternalVariables);
        }
Ejemplo n.º 3
0
        public MainProgram()
        {
            #region Set Dependencies

            sfun = new SFUN();
            monit = new MONIT();
            ztime = new ZTIME();
            stpmax = new STPMAX();
            modz = new MODZ();
            cnvtst = new CNVTST();
            crash = new CRASH();
            negvec = new NEGVEC();
            lsout = new LSOUT();
            mchpr1 = new MCHPR1();
            ssbfgs = new SSBFGS();
            getptc = new GETPTC();
            ddot = new DDOT();
            daxpy = new DAXPY();
            dnrm2 = new DNRM2();
            dcopy = new DCOPY();
            dxpy = new DXPY();
            gtims = new GTIMS(SUBSCR);
            setpar = new SETPAR(SUBSCR);
            ndia3 = new NDIA3(ddot);
            step1 = new STEP1(mchpr1);
            chkucp = new CHKUCP(mchpr1, dnrm2);
            setucr = new SETUCR(ddot);
            mslv = new MSLV(ddot, ssbfgs);
            msolve = new MSOLVE(mslv, SUBSCR);
            initp3 = new INITP3(ddot, dcopy);
            initpc = new INITPC(initp3, SUBSCR);
            modlnp = new MODLNP(ddot, initpc, ztime, msolve, gtims, ndia3, daxpy, negvec, dcopy);
            linder = new LINDER(ddot, getptc, lsout, dcopy);
            lmqn = new LMQN(dnrm2, step1, ddot, setpar, chkucp, setucr, modlnp, dcopy, linder, dxpy
                            , SUBSCR);
            mainc = new MAINC(sfun, lmqn);
            tn = new TN(mchpr1, lmqn);
            mains = new MAINS(sfun, tn);
            lmqnbc = new LMQNBC(ddot, dnrm2, step1, crash, setpar, chkucp, setucr, ztime, monit, modlnp
                                , dcopy, stpmax, linder, modz, cnvtst, dxpy, SUBSCR);
            maincb = new MAINCB(sfun, lmqnbc);
            tnbc = new TNBC(mchpr1, lmqnbc);
            mainsb = new MAINSB(sfun, tnbc);

            #endregion
        }