public decimal GetdEdt( FhirDateTime t_IndexElement, Ip p, Iβ β, C19M.M.C.A.Gumel2004.Interfaces.Parameters.QuarantineRateAsymptomaticIndividuals.Iγ γ_1, C19M.M.C.A.Gumel2004.Interfaces.Parameters.IsolationRateSymptomaticIndividuals.Iγ γ_2, C19M.M.C.A.Gumel2004.Interfaces.Parameters.TransmissionCoefficientModificationFactorAsymptomaticIndividuals.Iε ε_E, C19M.M.C.A.Gumel2004.Interfaces.Parameters.TransmissionCoefficientModificationFactorIsolatedIndividuals.Iε ε_J, C19M.M.C.A.Gumel2004.Interfaces.Parameters.TransmissionCoefficientModificationFactorQuarantinedIndividuals.Iε ε_Q, C19M.M.C.A.Gumel2004.Interfaces.Parameters.DevelopmentClinicalSymptomsRateAsymptomaticIndividuals.Iκ κ_1, Iμ μ, double E, double I, double J, double N, double Q, double S) { return (p.Value.Value.Value + (decimal)(S / N) * (β.Value.Value.Value) * ((decimal)I + ε_E.Value.Value.Value * (decimal)E + ε_Q.Value.Invoke(t_IndexElement).Value.Value *(decimal)Q + ε_J.Value.Invoke(t_IndexElement).Value.Value *(decimal)J) - (γ_1.Value.Invoke(t_IndexElement).Value.Value + κ_1.Value.Value.Value + μ.Value.Value.Value) * (decimal)E); }
public IConstraints13LConstraintElement Create( IdIndexElement dIndexElement, IwIndexElement wIndexElement, ITPy y, IδMinus δMinus, Iμ μ) { IConstraints13LConstraintElement constraintElement = null; try { constraintElement = new Constraints13LConstraintElement( dIndexElement, wIndexElement, y, δMinus, μ); } catch (Exception exception) { this.Log.Error( exception.Message, exception); } return(constraintElement); }
public IConstraints11ConstraintElement Create( IdIndexElement dIndexElement, IwIndexElement wIndexElement, Id d, Il l, Ipa pa, IP P, Iprob prob, ITPx x, Iμ μ) { IConstraints11ConstraintElement constraintElement = null; try { constraintElement = new Constraints11ConstraintElement( dIndexElement, wIndexElement, d, l, pa, P, prob, x, μ); } catch (Exception exception) { this.Log.Error( exception.Message, exception); } return(constraintElement); }
public decimal GetdEdt( Iβ β, Iη η, Iκ κ, Iλ λ, Iμ μ, Iσ σ, double E, double H, double I, double N, double S) { return (λ.GetValue( β, η, H, I, N).Value.Value * (decimal)S - (κ.Value.Value.Value + σ.Value.Value.Value + μ.Value.Value.Value) * (decimal)E); }
public IExpectedValueΦ Calculate( IExpectedValueΦResultElementFactory expectedValueΦResultElementFactory, IExpectedValueΦFactory expectedValueΦFactory, IExpectedValueΦResultElementCalculation expectedValueΦResultElementCalculation, Il l, It t, IslΛ slΛ, IL L, Ip p, Iμ μ) { return(expectedValueΦFactory.Create( slΛ.Value .Select(i => expectedValueΦResultElementCalculation.Calculate( expectedValueΦResultElementFactory, i.lIndexElement, i.sIndexElement, i.ΛIndexElement, l, t, L, p, μ)) .ToImmutableList())); }
public IVarianceΦ Calculate( IVarianceΦResultElementFactory varianceΦResultElementFactory, IVarianceΦFactory varianceΦFactory, IVarianceΦResultElementCalculation varianceΦResultElementCalculation, Il l, It t, IslΛ slΛ, IL L, Ip p, Iμ μ, Iσ σ) { return(varianceΦFactory.Create( slΛ.Value .Select(i => varianceΦResultElementCalculation.Calculate( varianceΦResultElementFactory, i.lIndexElement, i.sIndexElement, i.ΛIndexElement, l, t, L, p, μ, σ)) .ToImmutableList())); }
public IEBSResultElement Calculate( IEBSResultElementFactory EBSResultElementFactory, IdIndexElement dIndexElement, Iw w, IBEDS BEDS, Iμ μ, IVariance Variance) { int BEDS_d = BEDS.Value.Value.Value; double ExpectedValue_d = w.Value .Select(y => (double)μ.GetElementAtAsdecimal( y, dIndexElement)) .Sum(); double Variance_d = w.Value .Select(y => (double)Variance.GetElementAtAsdecimal( y, dIndexElement)) .Sum(); double lowerBound = BEDS_d + 0.5; double upperBound = double.PositiveInfinity; double value = 0.5 * (BEDS_d - ExpectedValue_d) * (MathNet.Numerics.SpecialFunctions.Erf( (lowerBound - ExpectedValue_d) * Math.Pow(Math.Sqrt(2 * Variance_d), -1)) - MathNet.Numerics.SpecialFunctions.Erf( (upperBound - ExpectedValue_d) * Math.Pow(Math.Sqrt(2 * Variance_d), -1))) + Math.Sqrt(Variance_d) * Math.Pow(Math.Sqrt(2 * Math.PI), -1) * (Math.Exp( -Math.Pow(lowerBound - ExpectedValue_d, 2) * Math.Pow(2 * Variance_d, -1)) - Math.Exp( -Math.Pow(upperBound - ExpectedValue_d, 2) * Math.Pow(2 * Variance_d, -1))); return(EBSResultElementFactory.Create( dIndexElement, (decimal)value)); }
public Constraints11ConstraintElement( IdIndexElement dIndexElement, IwIndexElement wIndexElement, Id d, Il l, Ipa pa, IP P, Iprob prob, ITPx x, Iμ μ) { Expression LHS = μ.Value[wIndexElement, dIndexElement]; ImmutableList <Tuple <IpIndexElement, IaIndexElement, double> > .Builder builder = ImmutableList.CreateBuilder <Tuple <IpIndexElement, IaIndexElement, double> >(); foreach (IpIndexElement pIndexElement in pa.Value.Where(i => P.IsThereElementAt(wIndexElement, i.pIndexElement)).Select(w => w.pIndexElement).Distinct()) { foreach (IaIndexElement aIndexElement in pa.Value.Select(w => w.aIndexElement).Distinct()) { int dLowerBound = aIndexElement.Key <= dIndexElement.Key ? dIndexElement.Key - aIndexElement.Key : d.GetMaximumKey() + dIndexElement.Key - aIndexElement.Key; double RHSSum = 0; for (int w = dLowerBound; w <= l.GetMaximumLengthOfStay(); w = w + 1) { RHSSum += (double)prob.GetElementAtAsdecimal( pIndexElement, l.GetElementAt( w)); } builder.Add( Tuple.Create( pIndexElement, aIndexElement, RHSSum)); } } ImmutableList <Tuple <IpIndexElement, IaIndexElement, double> > RHSSums = builder.ToImmutableList(); Expression RHS = Expression.Sum( pa.Value .Where(i => P.IsThereElementAt(wIndexElement, i.pIndexElement)) .Select( y => RHSSums.Where(w => w.Item1 == y.pIndexElement && w.Item2 == y.aIndexElement).Select(w => w.Item3).SingleOrDefault() * x.Value[ y.pIndexElement, y.aIndexElement])); this.Value = LHS == RHS; }
// Equation (5) public decimal GetdRdt( Iδ δ, Iμ μ, double I, double R) { return (δ.Value.Value.Value * (decimal)I - μ.Value.Value.Value * (decimal)R); }
public IDayBedRequirementMeansResultElement Calculate( IDayBedRequirementMeansResultElementFactory dayBedRequirementMeansResultElementFactory, IdIndexElement dIndexElement, Iμ μ) { return(dayBedRequirementMeansResultElementFactory.Create( dIndexElement, μ.Value .Where(a => a.dIndexElement == dIndexElement) .Select(a => a.Value) .Sum())); }
public decimal GetdQdt( FhirDateTime t_IndexElement, C19M.M.C.A.Gumel2004.Interfaces.Parameters.QuarantineRateAsymptomaticIndividuals.Iγ γ_1, C19M.M.C.A.Gumel2004.Interfaces.Parameters.DevelopmentClinicalSymptomsRateQuarantinedIndividuals.Iκ κ_2, Iμ μ, double E, double Q) { return (γ_1.Value.Invoke(t_IndexElement).Value.Value *(decimal)E - (κ_2.Value.Value.Value + μ.Value.Value.Value) * (decimal)Q); }
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)); }
public decimal GetdNdt( C19M.M.C.A.Gumel2006.Interfaces.Parameters.DiseaseInducedMortalityRate.Id d, Iμ μ, IΠ Π, double I, double N) { return (Π.Value.Value.Value - μ.Value.Value.Value * (decimal)N - d.Value.Value.Value * (decimal)I); }
public decimal GetdIdt( C19M.M.C.A.Safi2010.Interfaces.Parameters.NaturalRecoveryRateInfectiousIndividuals.Iγ γ_1, C19M.M.C.A.Safi2010.Interfaces.Parameters.DiseaseInducedDeathRateInfectiousIndividuals.Iδ δ_1, Iκ κ, Iμ μ, Iϕ ϕ, double E, double I) { return (κ.Value.Value.Value * (decimal)E - (γ_1.Value.Value.Value + ϕ.Value.Value.Value + μ.Value.Value.Value + δ_1.Value.Value.Value) * (decimal)I); }
public decimal GetdIdt( FhirDateTime t_IndexElement, Interfaces.Parameters.DiseaseInducedDeathRateSymptomaticIndividuals.Id d_1, C19M.M.C.A.Gumel2004.Interfaces.Parameters.IsolationRateSymptomaticIndividuals.Iγ γ_2, C19M.M.C.A.Gumel2004.Interfaces.Parameters.DevelopmentClinicalSymptomsRateAsymptomaticIndividuals.Iκ κ_1, Iμ μ, C19M.M.C.A.Gumel2004.Interfaces.Parameters.RecoveryRateSymptomaticIndividuals.Iσ σ_1, double E, double I) { return (κ_1.Value.Value.Value * (decimal)E - (γ_2.Value.Invoke(t_IndexElement).Value.Value + d_1.Value.Value.Value + σ_1.Value.Value.Value + μ.Value.Value.Value) * (decimal)I); }
public IDayBedRequirementMeans Calculate( IDayBedRequirementMeansResultElementFactory dayBedRequirementMeansResultElementFactory, IDayBedRequirementMeansFactory dayBedRequirementMeansFactory, IDayBedRequirementMeansResultElementCalculation dayBedRequirementMeansResultElementCalculation, Id d, Iμ μ) { return(dayBedRequirementMeansFactory.Create( d.Value .Select(y => dayBedRequirementMeansResultElementCalculation.Calculate( dayBedRequirementMeansResultElementFactory, y, μ)) .ToImmutableList())); }
public decimal GetdRdt( Iμ μ, C19M.M.C.A.Gumel2004.Interfaces.Parameters.RecoveryRateSymptomaticIndividuals.Iσ σ_1, C19M.M.C.A.Gumel2004.Interfaces.Parameters.RecoveryRateIsolatedIndividuals.Iσ σ_2, double I, double J, double R) { return (σ_1.Value.Value.Value * (decimal)I + σ_2.Value.Value.Value * (decimal)J - μ.Value.Value.Value * (decimal)R); }
public Constraints13MConstraintElement( IdIndexElement dIndexElement, IwIndexElement wIndexElement, ITPy y, IδPlus δPlus, Iμ μ) { Expression LHS = y.Value[wIndexElement] - μ.Value[wIndexElement, dIndexElement]; Expression RHS = δPlus.Value[wIndexElement, dIndexElement]; this.Value = LHS <= RHS; }
public decimal GetdHdt( Iα α, C19M.M.C.A.Safi2010.Interfaces.Parameters.RecoveryRateHospitalizedIndividuals.Iγ γ_2, C19M.M.C.A.Safi2010.Interfaces.Parameters.DiseaseInducedDeathRateHospitalizedIndividuals.Iδ δ_2, Iμ μ, Iϕ ϕ, double H, double I, double Q) { return (α.Value.Value.Value * (decimal)Q - ϕ.Value.Value.Value * (decimal)I - (γ_2.Value.Value.Value + μ.Value.Value.Value + δ_2.Value.Value.Value) * (decimal)H); }
public Iμ Create( ImmutableList <IμParameterElement> value) { Iμ parameter = null; try { parameter = new μ( value); } catch (Exception exception) { this.Log.Error("Exception message: " + exception.Message + " and stacktrace " + exception.StackTrace); } return(parameter); }
public decimal GetdQdt( Iα α, Iμ μ, Iσ σ, double E, double Q) { return (σ.Value.Value.Value * (decimal)E - (α.Value.Value.Value + μ.Value.Value.Value) * (decimal)Q); }
public decimal GetdNdt( C19M.M.C.A.Safi2010.Interfaces.Parameters.DiseaseInducedDeathRateInfectiousIndividuals.Iδ δ_1, C19M.M.C.A.Safi2010.Interfaces.Parameters.DiseaseInducedDeathRateHospitalizedIndividuals.Iδ δ_2, Iμ μ, IΠ Π, double H, double I, double N) { return (Π.Value.Value.Value - μ.Value.Value.Value * (decimal)N - (δ_1.Value.Value.Value * (decimal)I + δ_2.Value.Value.Value * (decimal)H)); }
public decimal GetdJdt( FhirDateTime t_IndexElement, Interfaces.Parameters.DiseaseInducedDeathRateIsolatedIndividuals.Id d_2, C19M.M.C.A.Gumel2004.Interfaces.Parameters.IsolationRateSymptomaticIndividuals.Iγ γ_2, C19M.M.C.A.Gumel2004.Interfaces.Parameters.DevelopmentClinicalSymptomsRateQuarantinedIndividuals.Iκ κ_2, Iμ μ, C19M.M.C.A.Gumel2004.Interfaces.Parameters.RecoveryRateIsolatedIndividuals.Iσ σ_2, double I, double J, double Q) { return (γ_2.Value.Invoke(t_IndexElement).Value.Value *(decimal)I + κ_2.Value.Value.Value * (decimal)Q - (σ_2.Value.Value.Value + d_2.Value.Value.Value + μ.Value.Value.Value) * (decimal)J); }
public Iμ Create( ImmutableList <IμParameterElement> value) { Iμ parameter = null; try { parameter = new μ( value); } catch (Exception exception) { this.Log.Error( exception.Message, exception); } return(parameter); }
public Iμ Create( VariableCollection <IwIndexElement, IdIndexElement> value) { Iμ variable = null; try { variable = new μ( value); } catch (Exception exception) { this.Log.Error( exception.Message, exception); } return(variable); }
public Iμ Create( ImmutableList <IμResultElement> value) { Iμ result = null; try { result = new μ( value); } catch (Exception exception) { this.Log.Error( exception.Message, exception); } return(result); }
public IEBS Calculate( IEBSResultElementFactory EBSResultElementFactory, IEBSFactory EBSFactory, IEBSResultElementCalculation EBSResultElementCalculation, Id d, Iw w, IBEDS BEDS, Iμ μ, IVariance Variance) { return(EBSFactory.Create( d.Value .Select(y => EBSResultElementCalculation.Calculate( EBSResultElementFactory, y, w, BEDS, μ, Variance)) .ToImmutableList())); }
public decimal GetdSdt( FhirDateTime t_IndexElement, Iβ β, C19M.M.C.A.Gumel2004.Interfaces.Parameters.TransmissionCoefficientModificationFactorAsymptomaticIndividuals.Iε ε_E, C19M.M.C.A.Gumel2004.Interfaces.Parameters.TransmissionCoefficientModificationFactorIsolatedIndividuals.Iε ε_J, C19M.M.C.A.Gumel2004.Interfaces.Parameters.TransmissionCoefficientModificationFactorQuarantinedIndividuals.Iε ε_Q, Iμ μ, IΠ Π, double E, double I, double J, double N, double Q, double S) { return (Π.Value.Value.Value - (decimal)(S / N) * (β.Value.Value.Value) * ((decimal)I + ε_E.Value.Value.Value * (decimal)E + ε_Q.Value.Invoke(t_IndexElement).Value.Value *(decimal)Q + ε_J.Value.Invoke(t_IndexElement).Value.Value *(decimal)J) - μ.Value.Value.Value * (decimal)S); }
public decimal GetdRdt( C19M.M.C.A.Safi2010.Interfaces.Parameters.NaturalRecoveryRateInfectiousIndividuals.Iγ γ_1, C19M.M.C.A.Safi2010.Interfaces.Parameters.RecoveryRateHospitalizedIndividuals.Iγ γ_2, Iμ μ, Iψ ψ, double H, double I, double R) { return (γ_1.Value.Value.Value * (decimal)I + γ_2.Value.Value.Value * (decimal)H - (ψ.Value.Value.Value + μ.Value.Value.Value) * (decimal)R); }
// https://stackoverflow.com/a/55004295 private Func <double, MathNet.Numerics.LinearAlgebra.Vector <double>, MathNet.Numerics.LinearAlgebra.Vector <double> > f( It t, Interfaces.Parameters.DiseaseInducedDeathRateSymptomaticIndividuals.Id d_1, Interfaces.Parameters.DiseaseInducedDeathRateIsolatedIndividuals.Id d_2, Ip p, Iβ β, C19M.M.C.A.Gumel2004.Interfaces.Parameters.QuarantineRateAsymptomaticIndividuals.Iγ γ_1, C19M.M.C.A.Gumel2004.Interfaces.Parameters.IsolationRateSymptomaticIndividuals.Iγ γ_2, C19M.M.C.A.Gumel2004.Interfaces.Parameters.TransmissionCoefficientModificationFactorAsymptomaticIndividuals.Iε ε_E, C19M.M.C.A.Gumel2004.Interfaces.Parameters.TransmissionCoefficientModificationFactorIsolatedIndividuals.Iε ε_J, C19M.M.C.A.Gumel2004.Interfaces.Parameters.TransmissionCoefficientModificationFactorQuarantinedIndividuals.Iε ε_Q, C19M.M.C.A.Gumel2004.Interfaces.Parameters.DevelopmentClinicalSymptomsRateAsymptomaticIndividuals.Iκ κ_1, C19M.M.C.A.Gumel2004.Interfaces.Parameters.DevelopmentClinicalSymptomsRateQuarantinedIndividuals.Iκ κ_2, Iμ μ, IΠ Π, C19M.M.C.A.Gumel2004.Interfaces.Parameters.RecoveryRateSymptomaticIndividuals.Iσ σ_1, C19M.M.C.A.Gumel2004.Interfaces.Parameters.RecoveryRateIsolatedIndividuals.Iσ σ_2, C19M.M.C.A.Gumel2004.Interfaces.Variables.AsymptomaticIndividuals.IE E, C19M.M.C.A.Gumel2004.Interfaces.Variables.SymptomaticIndividuals.II I, C19M.M.C.A.Gumel2004.Interfaces.Variables.IsolatedIndividuals.IJ J, C19M.M.C.A.Gumel2004.Interfaces.Variables.QuarantinedIndividuals.IQ Q, C19M.M.C.A.Gumel2004.Interfaces.Variables.RecoveredIndividuals.IR R, C19M.M.C.A.Gumel2004.Interfaces.Variables.SusceptibleIndividuals.IS S) { return((T, x) => { return MathNet.Numerics.LinearAlgebra.Vector <double> .Build.Dense(new[] { (double)E.GetdEdt( new FhirDateTime( new DateTimeOffset( t.StartDate.ToDateTimeOffset(TimeSpan.Zero).UtcDateTime.Date.AddDays(T))), p, β, γ_1, γ_2, ε_E, ε_J, ε_Q, κ_1, μ, E: x[0], I: x[1], J: x[2], N: x.Sum(), Q: x[3], S: x[5]), (double)I.GetdIdt( new FhirDateTime( new DateTimeOffset( t.StartDate.ToDateTimeOffset(TimeSpan.Zero).UtcDateTime.Date.AddDays(T))), d_1, γ_2, κ_1, μ, σ_1, E: x[0], I: x[1]), (double)J.GetdJdt( new FhirDateTime( new DateTimeOffset( t.StartDate.ToDateTimeOffset(TimeSpan.Zero).UtcDateTime.Date.AddDays(T))), d_2, γ_2, κ_2, μ, σ_2, I: x[1], J: x[2], Q: x[3]), (double)Q.GetdQdt( new FhirDateTime( new DateTimeOffset( t.StartDate.ToDateTimeOffset(TimeSpan.Zero).UtcDateTime.Date.AddDays(T))), γ_1, κ_2, μ, E: x[0], Q: x[3]), (double)R.GetdRdt( μ, σ_1, σ_2, I: x[1], J: x[2], R: x[4]), (double)S.GetdSdt( new FhirDateTime( new DateTimeOffset( t.StartDate.ToDateTimeOffset(TimeSpan.Zero).UtcDateTime.Date.AddDays(T))), β, ε_E, ε_J, ε_Q, μ, Π, E: x[0], I: x[1], J: x[2], N: x.Sum(), Q: x[3], S: x[5]) }); }); }