Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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];
 }
Exemplo n.º 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];
            }
        }
Exemplo n.º 5
0
 public BFGS(int dim, double[] initialPar, IGradientFunction f, double step, double epsilon, int itMax)
     : base(dim, initialPar, f, step, epsilon, itMax)
 {
 }
Exemplo n.º 6
0
 public BFGS(int dim, double[]initialPar, IGradientFunction f,  double step, double epsilon, int itMax)
     : base(dim, initialPar, f,  step, epsilon, itMax)
 {
 }