Class Variable
Identifies a variable for the constraint solver. Each new variable is unique in the view of the solver, but copying or cloning the variable produces a copy of the same variable.
public class Variable
- Inheritance
-
Variable
- Inherited Members
Constructors
Variable()
Initializes a new instance of the Variable class.
public Variable()
Properties
CurrentValue
Gets or sets the current value of the variable.
public double CurrentValue { get; set; }
Property Value
Remarks
Don't use this value unless you know what you're doing.
Name
Gets the name for this variable.
public string? Name { get; }
Property Value
Methods
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
SetName(string)
Sets the variable name for debugging purposes.
public void SetName(string name)
Parameters
namestring
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
operator +(Variable, Expression)
Add expression to variable and return new Expression.
public static Expression operator +(Variable variable, Expression expression)
Parameters
variableVariableThe Variable.
expressionExpressionThe Expression.
Returns
- Expression
New Expression instance with
variable.
operator +(Variable, Term)
Add term to variable and return new Expression.
public static Expression operator +(Variable variable, Term term)
Parameters
Returns
- Expression
New Expression instance with
variableandtermand Constant as 0.
operator +(Variable, Variable)
Add other to variable and return new Expression.
public static Expression operator +(Variable variable, Variable other)
Parameters
Returns
- Expression
New Expression instance with both variables and constant as 0.
operator +(Variable, double)
Add value to variable and return new Expression.
public static Expression operator +(Variable variable, double value)
Parameters
Returns
- Expression
New Expression instance with
variablevaluevalueas Constant.
operator +(Variable, float)
Add value to variable and return new Expression.
public static Expression operator +(Variable variable, float value)
Parameters
Returns
- Expression
New Expression instance with
variablevaluevalueas Constant.
operator +(double, Variable)
Add value to variable and return new Expression.
public static Expression operator +(double value, Variable variable)
Parameters
Returns
- Expression
New Expression instance with
variablevaluevalueas Constant.
operator +(float, Variable)
Add value to variable and return new Expression.
public static Expression operator +(float value, Variable variable)
Parameters
Returns
- Expression
New Expression instance with
variablevaluevalueas Constant.
operator |(Variable, WeightedRelation)
Or variable with relation.
public static PartialConstraint operator |(Variable variable, WeightedRelation relation)
Parameters
variableVariableThe Variable.
relationWeightedRelationThe WeightedRelation.
Returns
- PartialConstraint
New PartialConstraint instance.
operator /(Variable, double)
Divide variable by value and return new Term.
public static Term operator /(Variable variable, double value)
Parameters
Returns
operator /(Variable, float)
Divide variable by value and return new Term.
public static Term operator /(Variable variable, float value)
Parameters
Returns
operator *(Variable, double)
Multiply variable with value and return new Term.
public static Term operator *(Variable variable, double value)
Parameters
Returns
operator *(Variable, float)
Multiply variable with value and return new Term.
public static Term operator *(Variable variable, float value)
Parameters
Returns
operator *(double, Variable)
Multiply variable with value and return new Term.
public static Term operator *(double value, Variable variable)
Parameters
Returns
operator *(float, Variable)
Multiply variable with value and return new Term.
public static Term operator *(float value, Variable variable)
Parameters
Returns
operator -(Variable, Expression)
Subtract expression from variable and return new Expression.
public static Expression operator -(Variable variable, Expression expression)
Parameters
variableVariableThe Variable.
expressionExpressionThe Expression.
Returns
- Expression
New Expression instance.
operator -(Variable, Term)
Subtract term from variable and return new Expression.
public static Expression operator -(Variable variable, Term term)
Parameters
Returns
- Expression
New Expression instance.
operator -(Variable, Variable)
Subtract other from variable and return new Expression.
public static Expression operator -(Variable variable, Variable other)
Parameters
Returns
- Expression
New Expression instance with both variables and constant as 0.
operator -(Variable, double)
Subtract value from variable and return new Expression.
public static Expression operator -(Variable variable, double value)
Parameters
Returns
- Expression
New Expression instance with
variableand negatevalueas Constant .
operator -(Variable, float)
Subtract value from variable and return new Expression.
public static Expression operator -(Variable variable, float value)
Parameters
Returns
- Expression
New Expression instance with
variableand negatevalueas Constant .
operator -(double, Variable)
Subtract value from variable and return new Expression.
public static Expression operator -(double value, Variable variable)
Parameters
Returns
- Expression
New Expression instance with
variableand negatevalueas Constant .
operator -(float, Variable)
Subtract value from variable and return new Expression.
public static Expression operator -(float value, Variable variable)
Parameters
Returns
- Expression
New Expression instance with
variableand negatevalueas Constant .
operator -(Variable)
Negate variable and return new Term.
public static Term operator -(Variable variable)
Parameters
Returns
- Term
New Term instance with the
variableand Coefficient as -1.