Exemplo n.º 1
0
 static ActionPointGUIComponentContainer()
 {
     GameLoop.AddGameLoopCallback(GameLoopHook.Tick, new GameLoopCallback()
     {
         GameLoopPriority = Dichotomy.EvaluatePriority(null, null),
         Callback         = ActionPointGUIComponentContainer.Tick
     });
 }
Exemplo n.º 2
0
        public void Calculate_ShouldReturnXPosWhereFunctionResultIsMinimum()
        {
            var functionHandler = new SingleVarFunc("2 * x ^ 2 - 12 * x");
            var dichotomy       = new Dichotomy(new Interval(0, 10), 0.2, 1, functionHandler);

            var result = Math.Round(dichotomy.Calculate() * 1000) / 1000;

            Assert.AreEqual(2.856, result);
        }
Exemplo n.º 3
0
        public void GetValueTest()
        {
            Dichotomy dichotmy = new Dichotomy();

            Assert.IsTrue(dichotmy.GetValue(arr, 20));
            Assert.IsTrue(dichotmy.GetValue(arr, 1));
            Assert.IsFalse(dichotmy.GetValue(arr, 1000));

            Assert.IsFalse(dichotmy.GetValue(arr, 0));
        }
Exemplo n.º 4
0
    private double Rp(double I)
    {
        I = Math.Abs(I);

        double T(double r)
        {
            Interpolation itp = new LinearInterpolation(t0Table.I, t0Table.T0);
            double        t0  = itp.FindValue(I);

            itp = new LinearInterpolation(mTable.I, mTable.M);
            double m = itp.FindValue(I);

            return((Tw - t0) * Math.Pow((r / R), m) + t0);
        }

        double f(double p)
        {
            Integral itgN = new SimpsonIntegral(r =>
            {
                Interpolation2 ditp = new LinearLogInterpolation2(nTable.T, nTable.P, nTable.N);
                double n            = ditp.FindValue(T(r), p);
                return(n * r);
            });

            return((2 / Math.Pow(R, 2)) * itgN.FindValue(0, R, INTEGRAL_NODES) - (P0 * 7242 / Ts));
        }

        Dichotomy dch    = new Dichotomy(f);
        double    pValue = 1;
        double    h      = 1;

        while (f(pValue) * f(pValue + h) > 0)
        {
            pValue += h;
        }
        pValue = dch.FindSolution(pValue, pValue + h);

        Integral itgSigma = new SimpsonIntegral(r =>
        {
            Interpolation2 ditp = new LinearLogInterpolation2(sigmaTable.T, sigmaTable.P, sigmaTable.Sigma);
            double n            = ditp.FindValue(T(r), pValue);
            return(n * r);
        });

        return(Le / (2 * Math.PI * itgSigma.FindValue(0, R, INTEGRAL_NODES)));
    }
Exemplo n.º 5
0
 static NavigationEngineTestTriggerComponent_Order2nd()
 {
     TriggerResolutionOrder.TriggerComponentResolutionOrder.Add(typeof(NavigationEngineTestTriggerComponent_Order2nd),
                                                                Dichotomy.EvaluatePriority(null, new float[] { NavigationEngineTestTriggerComponent_Order1st.TRIGGER_RESOLUTION_PRIORITY }));
 }
Exemplo n.º 6
0
 static NavigationEngineTestTriggerComponent_Order1st()
 {
     TRIGGER_RESOLUTION_PRIORITY = Dichotomy.EvaluatePriority(null, null);
     TriggerResolutionOrder.TriggerComponentResolutionOrder.Add(typeof(NavigationEngineTestTriggerComponent_Order1st), Dichotomy.EvaluatePriority(null, null));
 }