Show / Hide Table of Contents

    Class Variable

    Represents a variable in an OPTANO.Modeling.Optimization.Interfaces.IModel.

    Inheritance
    System.Object
    Variable
    Inherited Members
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: OPTANO.Modeling.Optimization
    Assembly: Optimization.dll
    Syntax
    [DataContract]
    [Serializable]
    public class Variable : ICanAsAVariableRegisterAModel, IHaveName

    Constructors

    Variable(String, Double, Double, VariableType)

    Initializes a new instance of the Variable class. A Variable holds an optimization decision.

    Declaration
    public Variable(string name = null, double lowerbound = 0, double upperbound = Infinity, VariableType type = VariableType.Continuous)
    Parameters
    Type Name Description
    System.String name

    The name for the Variable. If the name IsNullOrWhiteSpace, a unique base64 index will be used as name.

    System.Double lowerbound

    The lowerbound. Default: 0

    System.Double upperbound

    The upperbound. Default: System.Double.PositiveInfinity. For Binary: System.Double.PositiveInfinity is converted to 1

    VariableType type

    The VariableType of the variable. Be aware that Binary variables require bounds in the range of [0, 1]

    Properties

    BranchingDirection

    Gets or sets the branching direction

    Declaration
    [DataMember]
    public BranchingDirection BranchingDirection { get; set; }
    Property Value
    Type Description
    BranchingDirection

    BranchingPriority

    Gets or sets the branching priority. Larger numbers indicate higher Priority. null indicates that the solver's default priority should be used.

    Declaration
    [DataMember]
    public int? BranchingPriority { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Int32>

    LowerBound

    Lower bound of this variable.

    Declaration
    public double LowerBound { get; set; }
    Property Value
    Type Description
    System.Double

    Name

    Gets the unique name of this variable.

    Declaration
    [DataMember]
    public string Name { get; }
    Property Value
    Type Description
    System.String

    Type

    Gets or sets the VariableType of this variable.

    Declaration
    public VariableType Type { get; set; }
    Property Value
    Type Description
    VariableType

    UpperBound

    Upper bound of this variable.

    Declaration
    public double UpperBound { get; set; }
    Property Value
    Type Description
    System.Double

    Value

    Gets or sets the value for this variable. This field can be used to assign solution values from a solver to the variables in the original model. Furthermore, it can be used to provide a start solution to the solver.

    Declaration
    [DataMember]
    public double Value { get; set; }
    Property Value
    Type Description
    System.Double

    Methods

    Equals(Variable)

    Compares this instance to the specified other.

    Declaration
    public bool Equals(Variable other)
    Parameters
    Type Name Description
    Variable other

    The other.

    Returns
    Type Description
    System.Boolean

    The System.Boolean.

    Equals(Object)

    Determines whether the specified System.Object is equal to this instance.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj

    The System.Object to compare with this instance.

    Returns
    Type Description
    System.Boolean

    true if the specified System.Object is equal to this instance; otherwise, false.

    Overrides
    System.Object.Equals(System.Object)

    GetHashCode()

    Returns a hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32

    A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

    Overrides
    System.Object.GetHashCode()

    ToString()

    Returns a System.String that represents this instance.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    A System.String that represents this instance.

    Overrides
    System.Object.ToString()

    Operators

    Addition(Variable, Variable)

    Implements the operator +.

    Declaration
    public static Expression operator +(Variable variable, Variable variable2)
    Parameters
    Type Name Description
    Variable variable

    The first variable.

    Variable variable2

    The second variable.

    Returns
    Type Description
    Expression

    The result of the operator.

    Addition(Variable, Double)

    Implements the operator +.

    Declaration
    public static Expression operator +(Variable variable, double constant)
    Parameters
    Type Name Description
    Variable variable

    The variable.

    System.Double constant

    The constant.

    Returns
    Type Description
    Expression

    The result of the operator.

    Addition(Double, Variable)

    Implements the operator +.

    Declaration
    public static Expression operator +(double constant, Variable variable)
    Parameters
    Type Name Description
    System.Double constant

    The constant.

    Variable variable

    The variable.

    Returns
    Type Description
    Expression

    The result of the operator.

    Division(Variable, Double)

    Implements the operator /.

    Declaration
    public static Term operator /(Variable variable, double constant)
    Parameters
    Type Name Description
    Variable variable

    The variable.

    System.Double constant

    The constant.

    Returns
    Type Description
    Term

    The result of the operator.

    Equality(Variable, Term)

    Implements the operator ==.

    Declaration
    public static Constraint operator ==(Variable variable, Term term)
    Parameters
    Type Name Description
    Variable variable

    The variable.

    Term term

    The term.

    Returns
    Type Description
    Constraint

    The result of the operator.

    Equality(Variable, Variable)

    Implements the operator ==.

    Declaration
    public static bool operator ==(Variable var1, Variable var2)
    Parameters
    Type Name Description
    Variable var1

    The first variable.

    Variable var2

    The second variable.

    Returns
    Type Description
    System.Boolean

    The result of the operator.

    Equality(Variable, Double)

    Implements the operator ==.

    Declaration
    public static Constraint operator ==(Variable variable, double constant)
    Parameters
    Type Name Description
    Variable variable

    The variable.

    System.Double constant

    The constant.

    Returns
    Type Description
    Constraint

    The result of the operator.

    GreaterThanOrEqual(Variable, Term)

    Implements the operator >=.

    Declaration
    public static Constraint operator >=(Variable variable, Term term)
    Parameters
    Type Name Description
    Variable variable

    The variable.

    Term term

    The term.

    Returns
    Type Description
    Constraint

    The result of the operator.

    GreaterThanOrEqual(Variable, Double)

    Implements the operator >=.

    Declaration
    public static Constraint operator >=(Variable variable, double constant)
    Parameters
    Type Name Description
    Variable variable

    The variable.

    System.Double constant

    The constant.

    Returns
    Type Description
    Constraint

    The result of the operator.

    Inequality(Variable, Term)

    Please use <= and >= to model !=

    Declaration
    public static Constraint operator !=(Variable variable, Term term)
    Parameters
    Type Name Description
    Variable variable

    The variable.

    Term term

    The term.

    Returns
    Type Description
    Constraint

    The result of the operator.

    Inequality(Variable, Variable)

    Implements the operator !=.

    Declaration
    public static bool operator !=(Variable var1, Variable var2)
    Parameters
    Type Name Description
    Variable var1

    The first variable.

    Variable var2

    The second variable.

    Returns
    Type Description
    System.Boolean

    The result of the operator.

    Inequality(Variable, Double)

    Please use <= and >= to model !=

    Declaration
    public static Constraint operator !=(Variable variable, double constant)
    Parameters
    Type Name Description
    Variable variable

    The variable.

    System.Double constant

    The constant.

    Returns
    Type Description
    Constraint

    The result of the operator.

    LessThanOrEqual(Variable, Term)

    Implements the operator <=.

    Declaration
    public static Constraint operator <=(Variable variable, Term term)
    Parameters
    Type Name Description
    Variable variable

    The variable.

    Term term

    The term.

    Returns
    Type Description
    Constraint

    The result of the operator.

    LessThanOrEqual(Variable, Double)

    Implements the operator <=.

    Declaration
    public static Constraint operator <=(Variable variable, double constant)
    Parameters
    Type Name Description
    Variable variable

    The variable.

    System.Double constant

    The constant.

    Returns
    Type Description
    Constraint

    The result of the operator.

    Multiply(ConstantExpression, Variable)

    Implements the operator *.

    Declaration
    public static Term operator *(ConstantExpression cons, Variable variable)
    Parameters
    Type Name Description
    ConstantExpression cons

    The constant.

    Variable variable

    The variable.

    Returns
    Type Description
    Term

    The result of the operator.

    Multiply(Variable, ConstantExpression)

    Implements the operator *.

    Declaration
    public static Term operator *(Variable variable, ConstantExpression cons)
    Parameters
    Type Name Description
    Variable variable

    The variable.

    ConstantExpression cons

    The constant.

    Returns
    Type Description
    Term

    The result of the operator.

    Multiply(Variable, Variable)

    Implements the operator *.

    Declaration
    public static Expression operator *(Variable variable1, Variable variable2)
    Parameters
    Type Name Description
    Variable variable1

    The first variable.

    Variable variable2

    The second variable.

    Returns
    Type Description
    Expression

    The result of the operator.

    Multiply(Variable, Double)

    Implements the operator *.

    Declaration
    public static Term operator *(Variable variable, double constant)
    Parameters
    Type Name Description
    Variable variable

    The variable.

    System.Double constant

    The constant.

    Returns
    Type Description
    Term

    The result of the operator.

    Multiply(Double, Variable)

    Implements the operator *.

    Declaration
    public static Term operator *(double constant, Variable variable)
    Parameters
    Type Name Description
    System.Double constant

    The constant.

    Variable variable

    The variable.

    Returns
    Type Description
    Term

    The result of the operator.

    Subtraction(Variable, Variable)

    Implements the operator -.

    Declaration
    public static Expression operator -(Variable variable, Variable variable2)
    Parameters
    Type Name Description
    Variable variable

    The first variable.

    Variable variable2

    The second variable.

    Returns
    Type Description
    Expression

    The result of the operator.

    Subtraction(Variable, Double)

    Implements the operator -.

    Declaration
    public static Expression operator -(Variable variable, double constant)
    Parameters
    Type Name Description
    Variable variable

    The variable.

    System.Double constant

    The constant.

    Returns
    Type Description
    Expression

    The result of the operator.

    Subtraction(Double, Variable)

    Implements the operator -.

    Declaration
    public static Expression operator -(double constant, Variable variable)
    Parameters
    Type Name Description
    System.Double constant

    The constant.

    Variable variable

    The variable.

    Returns
    Type Description
    Expression

    The result of the operator.

    UnaryNegation(Variable)

    Implements the operator -.

    Declaration
    public static Term operator -(Variable variable)
    Parameters
    Type Name Description
    Variable variable

    The variable.

    Returns
    Type Description
    Term

    A term with the factor of -1 and the variable given.

    Extension Methods

    ReflectionHelper.GetFieldValue(Object, String)
    ReflectionHelper.SetFieldValue(Object, String, Object)
    ExtensionMethods.Clone<T>(T)
    ExtensionMethods.ThrowIfArgumentIsNull<T>(T, String)
    Back to top Copyright © OPTANO GmbH generated with DocFX
    Privacy Policy | Impressum – Legal Notice