示例#1
0
文件: TN.cs 项目: davidsiaw/neuron
        public TNBC(MCHPR1 mchpr1, LMQNBC lmqnbc)
        {
            #region Set Dependencies

            this._mchpr1 = mchpr1; this._lmqnbc = lmqnbc;
            #endregion
        }
示例#2
0
文件: TN.cs 项目: davidsiaw/neuron
        public TNBC()
        {
            #region Initialization Common Blocks

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

            MCHPR1 mchpr1 = new MCHPR1();
            DDOT ddot = new DDOT();
            DNRM2 dnrm2 = new DNRM2();
            CRASH crash = new CRASH();
            ZTIME ztime = new ZTIME();
            MONIT monit = new MONIT();
            DCOPY dcopy = new DCOPY();
            SSBFGS ssbfgs = new SSBFGS();
            DAXPY daxpy = new DAXPY();
            NEGVEC negvec = new NEGVEC();
            STPMAX stpmax = new STPMAX();
            GETPTC getptc = new GETPTC();
            LSOUT lsout = new LSOUT();
            MODZ modz = new MODZ();
            CNVTST cnvtst = new CNVTST();
            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);
            LMQNBC lmqnbc = new LMQNBC(ddot, dnrm2, step1, crash, setpar, chkucp, setucr, ztime, monit, modlnp
                                       , dcopy, stpmax, linder, modz, cnvtst, dxpy, SUBSCR);
            #endregion
            #region Set Dependencies

            this._mchpr1 = mchpr1; this._lmqnbc = lmqnbc;
            #endregion
        }
示例#3
0
        public double[] ComputeMin(OptMultivariateFunction function, OptMultivariateGradient gradient, OptBoundVariable[] variables, double tolerance, double ACCRCY, ref int nMax)
        {
            if (this.MeLMQNBC == null) this.MeLMQNBC = new LMQNBC();

            this.Initialize(function, gradient, variables);

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

            int IERROR = 0;
            int[] IPIVOT = new int[this.MeNumFreeVariables];

            this.MeLMQNBC.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.MeLowerBounds, 0, this.MeUpperBounds, 0,
               ref this.MeIPIVOT, 0, 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;
        }