Exemplo n.º 1
0
        public TN(MCHPR1 mchpr1, LMQN lmqn)
        {
            #region Set Dependencies

            this._mchpr1 = mchpr1; this._lmqn = lmqn;
            #endregion
        }
Exemplo n.º 2
0
        public TN()
        {
            #region Initialization Common Blocks

            CommonBlock SUBSCR = new CommonBlock(0, 15, 0, 0);
            #endregion
            #region Dependencies (Initialization)

            MCHPR1 mchpr1 = new MCHPR1();
            DNRM2 dnrm2 = new DNRM2();
            DDOT ddot = new DDOT();
            DCOPY dcopy = new DCOPY();
            ZTIME ztime = new ZTIME();
            SSBFGS ssbfgs = new SSBFGS();
            DAXPY daxpy = new DAXPY();
            NEGVEC negvec = new NEGVEC();
            GETPTC getptc = new GETPTC();
            LSOUT lsout = new LSOUT();
            DXPY dxpy = new DXPY();
            SETPAR setpar = new SETPAR(SUBSCR);
            GTIMS gtims = new GTIMS(SUBSCR);
            STEP1 step1 = new STEP1(mchpr1);
            CHKUCP chkucp = new CHKUCP(mchpr1, dnrm2);
            SETUCR setucr = new SETUCR(ddot);
            INITP3 initp3 = new INITP3(ddot, dcopy);
            INITPC initpc = new INITPC(initp3, SUBSCR);
            MSLV mslv = new MSLV(ddot, ssbfgs);
            MSOLVE msolve = new MSOLVE(mslv, SUBSCR);
            NDIA3 ndia3 = new NDIA3(ddot);
            MODLNP modlnp = new MODLNP(ddot, initpc, ztime, msolve, gtims, ndia3, daxpy, negvec, dcopy);
            LINDER linder = new LINDER(ddot, getptc, lsout, dcopy);
            LMQN lmqn = new LMQN(dnrm2, step1, ddot, setpar, chkucp, setucr, modlnp, dcopy, linder, dxpy
                                 , SUBSCR);
            #endregion
            #region Set Dependencies

            this._mchpr1 = mchpr1; this._lmqn = lmqn;
            #endregion
        }
Exemplo n.º 3
0
        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;
        }