38 double coefficient = 1.0)
40 ArgumentNullException.ThrowIfNull(
73 double coefficient = 1.0)
75 ArgumentNullException.ThrowIfNull(
78 if (coefficient < 0.0)
80 throw new ArgumentOutOfRangeException(
83 "The coefficient to subtract cannot be negative.");
143 ArgumentNullException.ThrowIfNull(
168 ArgumentNullException.ThrowIfNull(
230 ? _expression.Clone()
Provides a fluent builder for linear expressions.
LinearExpression Expression
Gets the expression currently being built.
LinearExpressionBuilder Subtract(MathematicalVariable variable, double coefficient=1.0)
Subtracts a variable term from the expression.
LinearExpressionBuilder Add(MathematicalVariable variable, double coefficient=1.0)
Adds a variable term to the expression.
LinearExpressionBuilder Clear()
Clears the current expression.
LinearExpressionBuilder MultiplyBy(double factor)
Multiplies the entire expression by a scalar.
LinearExpressionBuilder AddConstant(double value)
Adds a constant value to the expression.
LinearExpressionBuilder Add(LinearExpression expression)
Adds another linear expression.
LinearExpressionBuilder Subtract(LinearExpression expression)
Subtracts another linear expression.
LinearExpressionBuilder SubtractConstant(double value)
Subtracts a constant value from the expression.
LinearExpression Build(bool clone=true)
Builds and validates the linear expression.
Represents a linear expression composed of variable terms and a constant value.
void MultiplyBy(double factor)
Multiplies the entire expression by a scalar.
LinearExpression Clone()
Creates an independent copy of this expression.
void EnsureValid()
Validates the linear expression.
Represents one decision variable in a mathematical optimization model.
int Id
Gets or sets the unique variable identifier within the mathematical model.
void EnsureValid()
Validates the mathematical variable.