public static void fn_mle_pc(List <double> IM, List <int> num_gms, List <int> num_collapse, ref double theta, ref double beta) { double[] data = { theta, beta }; int _dim = 2; double _epsilon = EPSILON; double _realEpsilon = System.Math.Sqrt(_epsilon); double _step = STEP; int _itmax = MAX_ITER; MyFunction func = new MyFunction(2, IM, num_gms, num_collapse); Nelder objNelder = new Nelder(_dim, data, func, _step, _epsilon, _itmax); objNelder.FindMinimum(); theta = objNelder.Result[0]; beta = objNelder.Result[1]; }
public void CalculateParabolaMinimum() { int _dim=5; double []_data = {5,34,-12,55,6}; double []_reference = {0,0,0,0,0}; double _epsilon=1e-7; double _realEpsilon = System.Math.Sqrt(_epsilon); double _step=1000; int _itmax=1000; double diff; Parabola func = new Parabola(_dim); Nelder objNelder = new Nelder(_dim,_data,func,_step,_epsilon,_itmax); objNelder.FindMinimum(); diff = NumericNet.CalcDiff(_dim,_reference,objNelder.Result); Assert.IsTrue(diff<_realEpsilon); }
public void CalculateBananaMinimum() { int _dim=2; double []_data = {5,34}; double []_reference = {1,1}; double _epsilon=1e-7; double _realEpsilon = System.Math.Sqrt(_epsilon); //Nelder needs larger initial step double _step=2000; int _itmax=1000; double diff; Banana func = new Banana(); Nelder objNelder = new Nelder(_dim,_data,func,_step,_epsilon,_itmax);; objNelder.FindMinimum(); diff = NumericNet.CalcDiff(_dim,_reference,objNelder.Result); Assert.IsTrue(diff<_realEpsilon); }
public void CalculateParabolaMinimum() { int _dim = 5; double [] _data = { 5, 34, -12, 55, 6 }; double [] _reference = { 0, 0, 0, 0, 0 }; double _epsilon = 1e-7; double _realEpsilon = System.Math.Sqrt(_epsilon); double _step = 1000; int _itmax = 1000; double diff; Parabola func = new Parabola(_dim); Nelder objNelder = new Nelder(_dim, _data, func, _step, _epsilon, _itmax); objNelder.FindMinimum(); diff = NumericNet.CalcDiff(_dim, _reference, objNelder.Result); Assert.IsTrue(diff < _realEpsilon); }
public void CalculateBananaMinimum() { int _dim = 2; double [] _data = { 5, 34 }; double [] _reference = { 1, 1 }; double _epsilon = 1e-7; double _realEpsilon = System.Math.Sqrt(_epsilon); //Nelder needs larger initial step double _step = 2000; int _itmax = 1000; double diff; Banana func = new Banana(); Nelder objNelder = new Nelder(_dim, _data, func, _step, _epsilon, _itmax);; objNelder.FindMinimum(); diff = NumericNet.CalcDiff(_dim, _reference, objNelder.Result); Assert.IsTrue(diff < _realEpsilon); }