示例#1
0
        public OneDWrapper(IGradientFunction func, GeneralMatrix pX, GeneralMatrix aX)
        {
            if (pX==null || aX==null)
                throw new ArgumentException("Previous x and alfaX may not be null");

            _problemDimension = pX.RowDimension;

            _function = func;

            _previousX = new GeneralMatrix(pX.ArrayCopy);

            _alfaX = new GeneralMatrix(aX.ArrayCopy);
        }
示例#2
0
        public OneDWrapper(IGradientFunction func, GeneralMatrix pX, GeneralMatrix aX)
        {
            if (pX == null || aX == null)
            {
                throw new ArgumentException("Previous x and alfaX may not be null");
            }

            _problemDimension = pX.RowDimension;

            _function = func;

            _previousX = new GeneralMatrix(pX.ArrayCopy);

            _alfaX = new GeneralMatrix(aX.ArrayCopy);
        }
示例#3
0
 public Optimizer(int dim, double[]initialPar, IGradientFunction f, double step, double epsilon, int itMax)
 {
     _f = f;
     _epsilon = epsilon;
     _itMax = itMax;
     _nDim = dim;
     _xCurrent = new double[_nDim];
     _initial = new double[_nDim];
     _step = step;
     //initiate the first value of alpha to some random value less than 100;
     Random rnd = new Random();
     _alpha = rnd.NextDouble()*100;
     _hessian = new GeneralMatrix(_nDim,_nDim);
     for (int i=0; i<_nDim; i++)
         _initial[i] = initialPar[i];
 }
示例#4
0
        public Optimizer(int dim, double[] initialPar, IGradientFunction f, double step, double epsilon, int itMax)
        {
            _f        = f;
            _epsilon  = epsilon;
            _itMax    = itMax;
            _nDim     = dim;
            _xCurrent = new double[_nDim];
            _initial  = new double[_nDim];
            _step     = step;
            //initiate the first value of alpha to some random value less than 100;
            Random rnd = new Random();

            _alpha   = rnd.NextDouble() * 100;
            _hessian = new GeneralMatrix(_nDim, _nDim);
            for (int i = 0; i < _nDim; i++)
            {
                _initial[i] = initialPar[i];
            }
        }
示例#5
0
 public BFGS(int dim, double[] initialPar, IGradientFunction f, double step, double epsilon, int itMax)
     : base(dim, initialPar, f, step, epsilon, itMax)
 {
 }
示例#6
0
文件: BFGS.cs 项目: kriskniaz/pCode
 public BFGS(int dim, double[]initialPar, IGradientFunction f,  double step, double epsilon, int itMax)
     : base(dim, initialPar, f,  step, epsilon, itMax)
 {
 }