public IScenarioUtilizedTimesResultElement Calculate(
     IScenarioUtilizedTimesResultElementFactory scenarioUtilizedTimesResultElementFactory,
     IΛIndexElement ΛIndexElement,
     Isrt srt,
     Ih h,
     In n,
     Ix x)
 {
     return(scenarioUtilizedTimesResultElementFactory.Create(
                ΛIndexElement,
                srt.Value.Select(w =>
                                 x.GetElementAtAsint(
                                     w.sIndexElement,
                                     w.rIndexElement,
                                     w.tIndexElement)
                                 *
                                 n.GetElementAtAsint(
                                     w.sIndexElement,
                                     ΛIndexElement)
                                 *
                                 h.GetElementAtAsdecimal(
                                     w.sIndexElement,
                                     ΛIndexElement))
                .Sum()));
 }
        public Iυ2ResultElement Calculate(
            INormalFactory normalFactory,
            Iυ2ResultElementFactory υ2ResultElementFactory,
            IMRNBCalculation MRNBCalculation,
            IRNBCalculation RNBCalculation,
            IΛIndexElement ΛIndexElement,
            It t,
            IΩ Ω,
            IExpectedValueI expectedValueI,
            IVarianceI varianceI)
        {
            int MRNB = 0;

            decimal υ2 = 0;

            do
            {
                MRNB = MRNBCalculation.Calculate(
                    normalFactory,
                    RNBCalculation,
                    ΛIndexElement,
                    t,
                    expectedValueI,
                    varianceI,
                    υ2);

                υ2 = (decimal)υ2 + (decimal)0.01;
            } while (MRNB <= Ω.Value.Value.Value && υ2 <= 1);

            return(υ2ResultElementFactory.Create(
                       ΛIndexElement,
                       υ2 - (decimal)0.01)); // Subtract 0.01 to account for last iteration of the do-while loop
        }
Example #3
0
        public IConstraints4ConstraintElement Create(
            ItIndexElement tIndexElement,
            IΛIndexElement ΛIndexElement,
            Il l,
            It t,
            Ist st,
            IΦHat ΦVHat,
            IIHat IHat,
            Iz z)
        {
            IConstraints4ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints4ConstraintElement(
                    tIndexElement,
                    ΛIndexElement,
                    l,
                    t,
                    st,
                    ΦVHat,
                    IHat,
                    z);
            }
            catch (Exception exception)
            {
                this.Log.Error("Exception message: " + exception.Message + " and stacktrace " + exception.StackTrace);
            }

            return(constraintElement);
        }
Example #4
0
        public IpParameterElement Create(
            IsIndexElement sIndexElement,
            IlIndexElement lIndexElement,
            IΛIndexElement ΛIndexElement,
            FhirDecimal value)
        {
            IpParameterElement parameterElement = null;

            try
            {
                parameterElement = new pParameterElement(
                    sIndexElement,
                    lIndexElement,
                    ΛIndexElement,
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(parameterElement);
        }
        public IΦHatResultElement Create(
            IsIndexElement sIndexElement,
            IlIndexElement lIndexElement,
            IΛIndexElement ΛIndexElement,
            decimal value)
        {
            IΦHatResultElement resultElement = null;

            try
            {
                resultElement = new ΦHatResultElement(
                    sIndexElement,
                    lIndexElement,
                    ΛIndexElement,
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(resultElement);
        }
Example #6
0
 public ItIndexElement Calculate(
     INormalFactory normalFactory,
     IRNBCalculation RNBCalculation,
     IΛIndexElement ΛIndexElement,
     It t,
     IExpectedValueI expectedValueI,
     IVarianceI varianceI,
     Iυ2 υ2)
 {
     return(t.Value
            .Select(i =>
                    KeyValuePair.Create(
                        i,
                        RNBCalculation.Calculate(
                            normalFactory,
                            i,
                            ΛIndexElement,
                            expectedValueI,
                            varianceI,
                            υ2.GetElementAtAsdecimal(
                                ΛIndexElement))))
            .OrderBy(i => i.Value)
            .LastOrDefault()
            .Key);
 }
        public IConstraints3ConstraintElement Create(
            IsIndexElement sIndexElement,
            IΛIndexElement ΛIndexElement,
            IN N,
            In n,
            IB B,
            Ie1Minus e1Minus,
            Ie1Plus e1Plus)
        {
            IConstraints3ConstraintElement constraintElement = null;

            try
            {
                constraintElement = new Constraints3ConstraintElement(
                    sIndexElement,
                    ΛIndexElement,
                    N,
                    n,
                    B,
                    e1Minus,
                    e1Plus);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(constraintElement);
        }
Example #8
0
 public IVarianceIResultElement Calculate(
     IVarianceIResultElementFactory varianceIResultElementFactory,
     ItIndexElement tIndexElement,
     IΛIndexElement ΛIndexElement,
     Il l,
     It t,
     Ist st,
     IVarianceΦ varianceΦ,
     Iz z)
 {
     return(varianceIResultElementFactory.Create(
                tIndexElement,
                ΛIndexElement,
                st.Value
                .Select(w =>
                        varianceΦ.GetElementAtAsdecimal(
                            w.sIndexElement,
                            l.GetElementAt(
                                tIndexElement.Key
                                -
                                w.tIndexElement.Key
                                +
                                (int)Math.Floor(
                                    (decimal)w.tIndexElement.Key
                                    /
                                    (tIndexElement.Key + 1))
                                *
                                t.GetT()),
                            ΛIndexElement)
                        *
                        z.GetElementAtAsint(
                            w.sIndexElement,
                            w.tIndexElement))
                .Sum()));
 }
Example #9
0
        public Constraints6ConstraintElement(
            ItIndexElement tIndexElement,
            IΛIndexElement ΛIndexElement,
            Il l,
            It t,
            Ist st,
            IΦHat ΦVHat,
            IIHat IHat,
            Iz z)
        {
            Expression LHS = IHat.Value[tIndexElement, ΛIndexElement];

            Expression RHS = Expression.Sum(
                st.Value
                .Select(
                    y =>
                    (double)ΦVHat.GetElementAtAsdecimal(
                        y.sIndexElement,
                        l.GetElementAt(
                            tIndexElement.Key
                            -
                            y.tIndexElement.Key
                            +
                            (int)Math.Floor(
                                (decimal)(y.tIndexElement.Key)
                                /
                                (tIndexElement.Key + 1))
                            *
                            t.GetT()),
                        ΛIndexElement)
                    *
                    z.Value[y.sIndexElement, y.tIndexElement]));

            this.Value = LHS == RHS;
        }
        public ScenarioUnderutilizationsResultElement(
            IΛIndexElement ΛIndexElement,
            decimal value)
        {
            this.ΛIndexElement = ΛIndexElement;

            this.Value = value;
        }
Example #11
0
        public ScenarioNumberPatientsResultElement(
            IΛIndexElement ΛIndexElement,
            int value)
        {
            this.ΛIndexElement = ΛIndexElement;

            this.Value = value;
        }
Example #12
0
        public ScenarioUtilizedTimesResultElement(
            IΛIndexElement ΛIndexElement,
            decimal value)
        {
            this.ΛIndexElement = ΛIndexElement;

            this.Value = value;
        }
        public tΛCrossJoinElement(
            ItIndexElement tIndexElement,
            IΛIndexElement ΛIndexElement)
        {
            this.tIndexElement = tIndexElement;

            this.ΛIndexElement = ΛIndexElement;
        }
        public ΡParameterElement(
            IΛIndexElement ΛIndexElement,
            FhirDecimal value)
        {
            this.ΛIndexElement = ΛIndexElement;

            this.Value = value;
        }
Example #15
0
        public sΛCrossJoinElement(
            IsIndexElement sIndexElement,
            IΛIndexElement ΛIndexElement)
        {
            this.sIndexElement = sIndexElement;

            this.ΛIndexElement = ΛIndexElement;
        }
        public TEBSResultElement(
            IΛIndexElement ΛIndexElement,
            decimal value)
        {
            this.ΛIndexElement = ΛIndexElement;

            this.Value = value;
        }
Example #17
0
 public decimal GetElementAtAsdecimal(
     IΛIndexElement ΛIndexElement)
 {
     return(this.Value
            .Where(x => x.ΛIndexElement == ΛIndexElement)
            .Select(x => x.Value)
            .SingleOrDefault());
 }
Example #18
0
 public int GetElementAtAsint(
     IsIndexElement sIndexElement,
     IΛIndexElement ΛIndexElement)
 {
     return(this.Value
            .Where(x => x.sIndexElement == sIndexElement && x.ΛIndexElement == ΛIndexElement)
            .Select(x => x.Value.Value.Value)
            .SingleOrDefault());
 }
        public IEBSResultElement Calculate(
            IEBSResultElementFactory EBSResultElementFactory,
            ItIndexElement tIndexElement,
            IΛIndexElement ΛIndexElement,
            IΩ Ω,
            IExpectedValueI ExpectedValueI,
            IVarianceI VarianceI)
        {
            int Ω_tΛ = Ω.Value.Value.Value;

            double ExpectedValueI_tΛ = (double)ExpectedValueI.GetElementAtAsdecimal(
                tIndexElement,
                ΛIndexElement);

            double VarianceI_tΛ = (double)VarianceI.GetElementAtAsdecimal(
                tIndexElement,
                ΛIndexElement);

            double lowerBound = Ω_tΛ + 0.5;

            double upperBound = double.PositiveInfinity;

            double value =
                0.5
                *
                (Ω_tΛ - ExpectedValueI_tΛ)
                *
                (MathNet.Numerics.SpecialFunctions.Erf(
                     (lowerBound - ExpectedValueI_tΛ)
                     *
                     Math.Pow(Math.Sqrt(2 * VarianceI_tΛ), -1))
                 -
                 MathNet.Numerics.SpecialFunctions.Erf(
                     (upperBound - ExpectedValueI_tΛ)
                     *
                     Math.Pow(Math.Sqrt(2 * VarianceI_tΛ), -1)))
                +
                Math.Sqrt(VarianceI_tΛ)
                *
                Math.Pow(Math.Sqrt(2 * Math.PI), -1)
                *
                (Math.Exp(
                     -Math.Pow(lowerBound - ExpectedValueI_tΛ, 2)
                     *
                     Math.Pow(2 * VarianceI_tΛ, -1))
                 -
                 Math.Exp(
                     -Math.Pow(upperBound - ExpectedValueI_tΛ, 2)
                     *
                     Math.Pow(2 * VarianceI_tΛ, -1)));

            return(EBSResultElementFactory.Create(
                       tIndexElement,
                       ΛIndexElement,
                       (decimal)value));
        }
Example #20
0
 public decimal GetElementAtAsdecimal(
     IsIndexElement sIndexElement,
     IlIndexElement lIndexElement,
     IΛIndexElement ΛIndexElement)
 {
     return(this.Value
            .Where(x => x.sIndexElement == sIndexElement && x.lIndexElement == lIndexElement && x.ΛIndexElement == ΛIndexElement)
            .Select(x => x.Value.Value.Value)
            .SingleOrDefault());
 }
Example #21
0
        public μParameterElement(
            IsIndexElement sIndexElement,
            IΛIndexElement ΛIndexElement,
            FhirDecimal value)
        {
            this.sIndexElement = sIndexElement;

            this.ΛIndexElement = ΛIndexElement;

            this.Value = value;
        }
Example #22
0
        public nParameterElement(
            IsIndexElement sIndexElement,
            IΛIndexElement ΛIndexElement,
            PositiveInt value)
        {
            this.sIndexElement = sIndexElement;

            this.ΛIndexElement = ΛIndexElement;

            this.Value = value;
        }
        public hParameterElement(
            IsIndexElement sIndexElement,
            IΛIndexElement ΛIndexElement,
            Duration value)
        {
            this.sIndexElement = sIndexElement;

            this.ΛIndexElement = ΛIndexElement;

            this.Value = value;
        }
Example #24
0
        public VarianceIResultElement(
            ItIndexElement tIndexElement,
            IΛIndexElement ΛIndexElement,
            decimal value)
        {
            this.tIndexElement = tIndexElement;

            this.ΛIndexElement = ΛIndexElement;

            this.Value = value;
        }
        public ExpectedValueIResultElement(
            ItIndexElement tIndexElement,
            IΛIndexElement ΛIndexElement,
            decimal value)
        {
            this.tIndexElement = tIndexElement;

            this.ΛIndexElement = ΛIndexElement;

            this.Value = value;
        }
 public IScenarioNumberPatientsResultElement Calculate(
     IScenarioNumberPatientsResultElementFactory scenarioNumberPatientsResultElementFactory,
     IΛIndexElement ΛIndexElement,
     ISurgeonScenarioNumberPatients surgeonScenarioNumberPatients)
 {
     return(scenarioNumberPatientsResultElementFactory.Create(
                ΛIndexElement,
                surgeonScenarioNumberPatients.Value
                .Where(w => w.ΛIndexElement == ΛIndexElement)
                .Select(w => w.Value)
                .Sum()));
 }
 public IScenarioUnderutilizationsResultElement Calculate(
     IScenarioUnderutilizationsResultElementFactory scenarioUnderutilizationsResultElementFactory,
     IΛIndexElement ΛIndexElement,
     IScenarioTotalTimes scenarioTotalTimes,
     IScenarioUnutilizedTimes scenarioUnutilizedTimes)
 {
     return(scenarioUnderutilizationsResultElementFactory.Create(
                ΛIndexElement,
                scenarioUnutilizedTimes.Value.Where(w => w.ΛIndexElement == ΛIndexElement).Select(w => w.Value).SingleOrDefault()
                /
                scenarioTotalTimes.Value.Where(w => w.ΛIndexElement == ΛIndexElement).Select(w => w.Value).SingleOrDefault()));
 }
        public IExpectedValueΦResultElement Calculate(
            IExpectedValueΦResultElementFactory expectedValueΦResultElementFactory,
            IlIndexElement lIndexElement,
            IsIndexElement sIndexElement,
            IΛIndexElement ΛIndexElement,
            Il l,
            It t,
            IL L,
            Ip p,
            Iμ μ)
        {
            int Ls = L.GetElementAtAsint(
                sIndexElement);

            int τLowerBound = 0;

            int τUpperBound = (int)Math.Floor(
                (decimal)
                (Ls - lIndexElement.Value.Value.Value)
                /
                t.GetT());

            decimal sum = 0;

            for (int τ = τLowerBound; τ <= τUpperBound; τ = τ + 1)
            {
                int lPrimeLowerBound = lIndexElement.Value.Value.Value + τ * t.GetT() + 1;

                int lPrimeUpperBound = Ls;

                for (int lPrime = lPrimeLowerBound; lPrime <= lPrimeUpperBound; lPrime = lPrime + 1)
                {
                    sum +=
                        p.GetElementAtAsdecimal(
                            sIndexElement,
                            l.GetElementAt(
                                lPrime),
                            ΛIndexElement);
                }
            }

            return(expectedValueΦResultElementFactory.Create(
                       sIndexElement,
                       lIndexElement,
                       ΛIndexElement,
                       μ.GetElementAtAsdecimal(
                           sIndexElement,
                           ΛIndexElement)
                       *
                       sum));
        }
Example #29
0
        public VarianceΦResultElement(
            IsIndexElement sIndexElement,
            IlIndexElement lIndexElement,
            IΛIndexElement ΛIndexElement,
            decimal value)
        {
            this.sIndexElement = sIndexElement;

            this.lIndexElement = lIndexElement;

            this.ΛIndexElement = ΛIndexElement;

            this.Value = value;
        }
Example #30
0
 public IScenarioUnutilizedTimesResultElement Calculate(
     IScenarioUnutilizedTimesResultElementFactory scenarioUnutilizedTimesResultElementFactory,
     IΛIndexElement ΛIndexElement,
     IScenarioTotalTimes scenarioTotalTimes,
     IScenarioUtilizedTimes scenarioUtilizedTimes)
 {
     return(scenarioUnutilizedTimesResultElementFactory.Create(
                ΛIndexElement,
                scenarioTotalTimes.GetElementAtAsdecimal(
                    ΛIndexElement)
                -
                scenarioUtilizedTimes.GetElementAtAsdecimal(
                    ΛIndexElement)));
 }