Class Variable
Represents a variable in an OPTANO.Modeling.Optimization.Interfaces.IModel.
Inheritance
Inherited Members
Namespace: OPTANO.Modeling.Optimization
Assembly: Optimization.dll
Syntax
[DataContract]
[Serializable]
public class Variable : ICanAsAVariableRegisterAModel, IHaveName
Constructors
Variable(String, Double, Double, VariableType)
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 |
System.Double | lowerbound | The lowerbound. Default: |
System.Double | upperbound | The upperbound. Default: |
VariableType | type | The VariableType of the variable. Be aware that Binary variables require bounds in the range of |
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 |
|
Overrides
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
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
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. |