public ITPObjectiveFunction Create( IObjectiveFactory objectiveFactory, Id d, Iw w, Iα α, Iβ β, Iγ γ, IδMinus δMinus, Interfaces.Variables.TP.WardSpareBeds.IδPlus δPlus_w, Interfaces.Variables.TP.WardBedOccupancyVariances.IVariance Variance_w) { ITPObjectiveFunction objectiveFunction = null; try { objectiveFunction = new TPObjectiveFunction( objectiveFactory, d, w, α, β, γ, δMinus, δPlus_w, Variance_w); } catch (Exception exception) { this.Log.Error( exception.Message, exception); } return(objectiveFunction); }
public IConstraints6ConstraintElement Create( IrIndexElement rIndexElement, IsIndexElement sIndexElement, Id d, Ib b, Iβ β) { IConstraints6ConstraintElement constraintElement = null; try { constraintElement = new Constraints6ConstraintElement( rIndexElement, sIndexElement, d, b, β); } catch (Exception exception) { this.Log.Error( exception.Message, exception); } return(constraintElement); }
public decimal GetdSdt( Iβ β, Iη η, Iλ λ, C19M.M.C.A.Safi2010.Interfaces.Parameters.NaturalDeathRate.Iμ μ, C19M.M.C.A.Safi2010.Interfaces.Parameters.RecruitmentRateSusceptibleIndividuals.IΠ Π, Iψ ψ, double H, double I, double N, double R, double S) { return (Π.Value.Value.Value + ψ.Value.Value.Value * (decimal)R - λ.GetValue( β, η, H, I, N) .Value .Value * (decimal)S - μ.Value.Value.Value * (decimal)S); }
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 IConstraints1ConstraintElement Create( IdIndexElement dIndexElement, IrIndexElement rIndexElement, IsIndexElement sIndexElement, It t, IW W, Iβ β, Ix x) { IConstraints1ConstraintElement constraintElement = null; try { constraintElement = new Constraints1ConstraintElement( dIndexElement, rIndexElement, sIndexElement, t, W, β, 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 Iδ3ParameterElement Calculate( Iδ3ParameterElementFactory δ3ParameterElementFactory, IdIndexElement dIndexElement, IrIndexElement rIndexElement, IsIndexElement sIndexElement, It t, IW W, Iβ β, Iγ γ) { int value = 0; int γSum = t.GetNthElementsAt( dIndexElement.Value.Value.Value, t.GetT() - W.Value.Value.Value + dIndexElement.Value.Value.Value, W.Value.Value.Value) .Select( y => γ.GetElementAtAsint( rIndexElement, y)) .Sum(); int βAsint = β.GetElementAtAsint( sIndexElement, rIndexElement, dIndexElement); if (βAsint > 0) { // Case (i) if ((γSum % βAsint) == 0) { value = γSum / βAsint; } else if ((γSum % βAsint) != 0) { // Case (ii) if (βAsint < (γSum / 2)) { value = (int)Math.Floor( (decimal)(γSum / βAsint)); } // Case (iii) else if ((βAsint > (γSum / 2)) && (βAsint < γSum)) { value = (int)Math.Floor( (decimal)(γSum / (γSum - βAsint))); } } } return(δ3ParameterElementFactory.Create( sIndexElement, rIndexElement, dIndexElement, value)); }
public Constraints6ConstraintElement( IrIndexElement rIndexElement, IsIndexElement sIndexElement, Id d, Ib b, Iβ β) { Expression LHS = Expression.Sum( d.Value .Select( x => β.Value[sIndexElement, rIndexElement, x])); Expression RHS = b.Value[sIndexElement, rIndexElement]; this.Value = LHS == RHS; }
public Iβ Create( VariableCollection <IsIndexElement, IrIndexElement, 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 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 Constraints7ConstraintElement( IdIndexElement dIndexElement, IrIndexElement rIndexElement, IsIndexElement sIndexElement, It t, IW W, Ix x, Iβ β) { OPTANO.Modeling.Optimization.Expression LHS = OPTANO.Modeling.Optimization.Expression.Sum( t.GetNthElementsAt( dIndexElement.Value.Value.Value, t.GetT() - W.Value.Value.Value + dIndexElement.Value.Value.Value, W.Value.Value.Value) .Select( y => x.Value[sIndexElement, rIndexElement, y])); OPTANO.Modeling.Optimization.Expression RHS = β.Value[sIndexElement, rIndexElement, dIndexElement]; this.Value = LHS == RHS; }
public TPObjectiveFunction( IObjectiveFactory objectiveFactory, Id d, Iw w, Iα α, Iβ β, Iγ γ, IδMinus δMinus, Interfaces.Variables.TP.WardSpareBeds.IδPlus δPlus_w, Interfaces.Variables.TP.WardBedOccupancyVariances.IVariance Variance_w) { Expression expression = Expression.Sum( w.Value .Select( i => (double)α.GetElementAtAsdecimal( i) * Expression.Sum( d.Value .Select( j => δMinus.Value[i, j])) + (double)β.GetElementAtAsdecimal( i) * δPlus_w.Value[i] + (double)γ.GetElementAtAsdecimal( i) * Variance_w.Value[i])); Objective objective = objectiveFactory.Create( expression, ObjectiveSense.Minimize); this.Value = objective; }
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 Iδ2 Calculate( Iδ2ParameterElementFactory δ2ParameterElementFactory, Iδ2Factory δ2Factory, Iδ2ParameterElementCalculation δ2ParameterElementCalculation, Isrd srd, It t, IW W, Iβ β, Iγ γ) { return(δ2Factory.Create( srd.Value .Select(x => δ2ParameterElementCalculation.Calculate( δ2ParameterElementFactory, x.dIndexElement, x.rIndexElement, x.sIndexElement, t, W, β, γ)) .ToImmutableList())); }
public Constraints1ConstraintElement( IdIndexElement dIndexElement, IrIndexElement rIndexElement, IsIndexElement sIndexElement, It t, IW W, Iβ β, Ix x) { Expression LHS = Expression.Sum( t.GetNthElementsAt( dIndexElement.Value.Value.Value, t.GetT() - W.Value.Value.Value + dIndexElement.Value.Value.Value, W.Value.Value.Value) .Select( y => x.Value[sIndexElement, rIndexElement, y])); int RHS = β.GetElementAtAsint( sIndexElement, rIndexElement, dIndexElement); this.Value = LHS == RHS; }
// 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]) }); }); }