Show / Hide Table of Contents

    Class ExtensionMethods

    Some ExtensionsMethods that extend the Model and its fields.

    Inheritance
    System.Object
    ExtensionMethods
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: OPTANO.Modeling.Optimization
    Assembly: Optimization.dll
    Syntax
    public static class ExtensionMethods

    Fields

    UnhandledVariableGroupName

    Name of variable group of all unhandled variables

    Declaration
    public const string UnhandledVariableGroupName = "unhandledVariable"
    Field Value
    Type Description
    System.String

    Methods

    IsAlmost(Double, Double, Double[])

    Checks if the System.Double value is equal to one of the parameters compareValue or optionalCompareValues, with respect to a tolerance of EPSILON.

    Declaration
    public static bool IsAlmost(this double value, double compareValue, params double[] optionalCompareValues)
    Parameters
    Type Name Description
    System.Double value

    The value.

    System.Double compareValue

    The compare Value.

    System.Double[] optionalCompareValues

    The optional compare values.

    Returns
    Type Description
    System.Boolean

    true, if System.Math.Abs(System.Double)(value - compareValue) <= EPSILON or for any of the optionalCompareValues.

    IsInRange(Double, Double, Double)

    Checks if the System.Double value is in the range of [minValue, maxValue], with respect to EPSILON.

    Declaration
    public static bool IsInRange(this double value, double minValue, double maxValue)
    Parameters
    Type Name Description
    System.Double value

    The value.

    System.Double minValue

    The minimum value of the range.

    System.Double maxValue

    The maximum value of the range.

    Returns
    Type Description
    System.Boolean

    true, iff

    value >= minValue - EPSILON

    and

    value <= maxValue + EPSILON.

    IsLowerBoundConstraint(Constraint)

    Checks if the constraint's LowerBound is not System.Double.NegativeInfinity.

    Declaration
    public static bool IsLowerBoundConstraint(this Constraint constraint)
    Parameters
    Type Name Description
    Constraint constraint

    The constraint.

    Returns
    Type Description
    System.Boolean

    true, iff LowerBound > System.Double.NegativeInfinity.

    IsRangeConstraint(Constraint)

    Checks if the constraint is a range constraint. I.e. LowerBound > System.Double.NegativeInfinity

    and

    UpperBound < System.Double.PositiveInfinity

    Declaration
    public static bool IsRangeConstraint(this Constraint constraint)
    Parameters
    Type Name Description
    Constraint constraint

    The constraint.

    Returns
    Type Description
    System.Boolean

    true, iff constraint is a range constraint.

    IsRelevant(Constraint)

    Checks if the given constraint is relevant for the model. Relevant means that the constraint's expression contains (at least) one variable with a non-zero factor, or that its bounds are contradictory.

    I.e. 0 <= 1 <= 0 is still relevant to the model even though it does not contain a non-zero factor variable. However, the part "1 <= 0" still affects the model, since it causes the model to be infeasible.

    This method is also used in AddConstraintIfRelevant(Constraint) and .

    Declaration
    public static bool IsRelevant(this Constraint constraint)
    Parameters
    Type Name Description
    Constraint constraint

    The constraint to check.

    Returns
    Type Description
    System.Boolean

    true, if the constraint is relevant to the model.

    IsUpperBoundConstraint(Constraint)

    Checks if the constraint's UpperBound is not System.Double.PositiveInfinity.

    Declaration
    public static bool IsUpperBoundConstraint(this Constraint constraint)
    Parameters
    Type Name Description
    Constraint constraint

    The constraint.

    Returns
    Type Description
    System.Boolean

    true, iff UpperBound < System.Double.PositiveInfinity.

    ParseToEnumMember<TEnumType>(String, Boolean)

    Tries to parse the given memberName into a member of the specified System.Enum TEnumType. If memberName is not a member of TEnumType, default(TEnumType will be returned.

    Declaration
    public static TEnumType ParseToEnumMember<TEnumType>(this string memberName, bool ignoreCase = true)
        where TEnumType : struct, IConvertible
    Parameters
    Type Name Description
    System.String memberName

    The member name.

    System.Boolean ignoreCase

    Specifies, if the case should be ignored.

    Returns
    Type Description
    TEnumType

    The member of the TEnumType. Returns default(TEnumType), if memberName cannot be parsed correctly.

    Type Parameters
    Name Description
    TEnumType

    The target System.Enum type.

    Exceptions
    Type Condition
    System.ArgumentException

    Thrown, if TEnumType is not an System.Enum.

    WriteCSV(HashSet<VariableStatisticRow>, String)

    Writes the Variable Statitics into CSV files

    Declaration
    public static void WriteCSV(this HashSet<VariableStatisticRow> result, string folder)
    Parameters
    Type Name Description
    System.Collections.Generic.HashSet<VariableStatisticRow> result

    The variable statistics to export

    System.String folder

    folder, to place the files.

    Back to top Copyright © OPTANO GmbH generated with DocFX
    Privacy Policy | Impressum – Legal Notice