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 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; }