public IConstraints4ConstraintElement Create( IrIndexElement rIndexElement, ItIndexElement tIndexElement, Iψ ψ, Iγ γ) { IConstraints4ConstraintElement constraintElement = null; try { constraintElement = new Constraints4ConstraintElement( rIndexElement, tIndexElement, ψ, γ); } catch (Exception exception) { this.Log.Error( exception.Message, exception); } return(constraintElement); }
public IConstraints2ConstraintElement Create( IrIndexElement rIndexElement, ItIndexElement tIndexElement, Is s, Iγ γ, IxHat xHat) { IConstraints2ConstraintElement constraintElement = null; try { constraintElement = new Constraints2ConstraintElement( rIndexElement, tIndexElement, s, γ, xHat); } catch (Exception exception) { this.Log.Error("Exception message: " + exception.Message + " and stacktrace " + exception.StackTrace); } return(constraintElement); }
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 Iδ4ParameterElement Calculate( Iδ4ParameterElementFactory δ4ParameterElementFactory, IdIndexElement dIndexElement, IrIndexElement rIndexElement, IsIndexElement sIndexElement, ItIndexElement tIndexElement, It t, IW W, Iγ γ, Iδ3 δ3) { Iδ4ParameterElement δ4ParameterElement = null; int γSum = 0; int δ3Asint = δ3.GetElementAtAsint( sIndexElement, rIndexElement, dIndexElement); if (δ3Asint == 0) { δ4ParameterElement = δ4ParameterElementFactory.Create( sIndexElement, rIndexElement, dIndexElement, tIndexElement, 1); } else { int δ4 = 1; do { γSum = t.GetNthElementsAt( dIndexElement.Value.Value.Value, dIndexElement.Value.Value.Value + (δ4 - 1) * W.Value.Value.Value, W.Value.Value.Value) .Select(x => γ.GetElementAtAsint( rIndexElement, t.GetElementAt(x.Key))) .Sum(); δ4 = δ4 + 1; } while (γSum < δ3Asint); if (γSum == δ3Asint) { δ4ParameterElement = δ4ParameterElementFactory.Create( sIndexElement, rIndexElement, dIndexElement, tIndexElement, δ4 - 1); // Subtract 1 to account for last iteration of the do-while loop } } return(δ4ParameterElement); }
public IConstraints3ConstraintElement Create( IrIndexElement rIndexElement, Is s, It t, Ib b, Iγ γ) { IConstraints3ConstraintElement constraintElement = null; try { constraintElement = new Constraints3ConstraintElement( rIndexElement, s, t, b, γ); } catch (Exception exception) { this.Log.Error( exception.Message, exception); } return(constraintElement); }
public Iδ4 Calculate( Iδ4ParameterElementFactory δ4ParameterElementFactory, Iδ4Factory δ4Factory, Iδ4ParameterElementCalculation δ4ParameterElementCalculation, Isrd srd, It t, IW W, Iδ3 δ3, Iγ γ) { return(δ4Factory.Create( srd.Value .SelectMany(b => t.GetNthElementsAt( b.dIndexElement.Value.Value.Value, t.GetT() - W.Value.Value.Value + b.dIndexElement.Value.Value.Value, W.Value.Value.Value), (a, b) => Tuple.Create(a.sIndexElement, a.rIndexElement, a.dIndexElement, b)) .Select(x => δ4ParameterElementCalculation.Calculate( δ4ParameterElementFactory, x.Item3, x.Item2, x.Item1, x.Item4, t, W, γ, δ3)) .ToImmutableList())); }
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 Constraints4ConstraintElement( IrIndexElement rIndexElement, ItIndexElement tIndexElement, Iψ ψ, Iγ γ) { Expression LHS = γ.Value[rIndexElement, tIndexElement]; int RHS = 1 - ψ.GetElementAtAsint( tIndexElement); this.Value = LHS <= RHS; }
public Constraints9ConstraintElement( IrIndexElement rIndexElement, ItIndexElement tIndexElement, Is s, Ix x, Iγ γ) { Expression LHS = Expression.Sum( s.Value .Select( y => x.Value[y, rIndexElement, tIndexElement])); Expression RHS = γ.Value[rIndexElement, tIndexElement]; this.Value = LHS == RHS; }
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 Constraints2ConstraintElement( IrIndexElement rIndexElement, ItIndexElement tIndexElement, Is s, Iγ γ, IxHat xHat) { Expression LHS = Expression.Sum( s.Value .Select( y => xHat.Value[y, rIndexElement, tIndexElement])); int RHS = γ.GetElementAtAsint( rIndexElement, tIndexElement); this.Value = LHS <= RHS; }
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( 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( VariableCollection <IrIndexElement, ItIndexElement> value) { Iγ variable = null; try { variable = new γ( value); } catch (Exception exception) { this.Log.Error( exception.Message, exception); } return(variable); }
public Constraints3ConstraintElement( IrIndexElement rIndexElement, Is s, It t, Ib b, Iγ γ) { Expression LHS = Expression.Sum( s.Value .Select( x => b.Value[x, rIndexElement])); Expression RHS = Expression.Sum( t.Value .Select( x => γ.Value[rIndexElement, x])); 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 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())); }