Localsolver
5.5
|
Mathematical modeling expression.
Expressions are used to build the mathematical optimization model associated to LocalSolver. An expression is composed of an operator (which corresponds to its type) and its operands (which are other expressions of the model).
Public Member Functions | |
LSOperator | GetOperator () |
Gets the operator of this expression. | |
int | GetIndex () |
Gets the index of this expression in the model. | |
bool | IsConstant () |
Returns true if this expression is typed as constant in the model, false otherwise. | |
bool | IsDecision () |
Returns true if this expression is typed as decision in the model, false otherwise. | |
bool | IsConstraint () |
Returns true if this expression is tagged as constraint in the model, false otherwise. | |
bool | IsObjective () |
Returns true if this expression is tagged as objective in the model, false otherwise. | |
bool | IsDouble () |
Returns true if this expression is a double, false otherwise. | |
bool | IsInt () |
Returns true if this expression is an integer, false otherwise. | |
bool | IsBool () |
Returns true if this expression is a boolean (ie 0 or 1), false otherwise. | |
bool | IsArray () |
Returns true if this expression is an array, false otherwise. | |
void | AddOperand (LSExpression expr) |
Adds the given operand to this expression. | |
void | AddOperand (long constant) |
Add the given constant operand to this expression. | |
void | AddOperand (double constant) |
Add the given constant operand to this expression. | |
void | AddOperands (IEnumerable< LSExpression > operands) |
Add the given operands to the expression. | |
void | AddOperands (IEnumerable< long > operands) |
Add the given constant integer operands to the expression. | |
void | AddOperands (IEnumerable< double > operands) |
Add the given constant double operands to the expression. | |
void | AddOperands (params LSExpression[] operands) |
Add the given operands to the expression. | |
void | AddOperands (params double[] operands) |
Add the given constant double operands to the expression. | |
void | AddOperands (params long[] operands) |
Add the given constant integer operands to the expression. | |
LSExpression | GetOperand (int operandIndex) |
Gets the operand with the given index. | |
void | SetOperand (int operandIndex, LSExpression operand) |
Replaces the operand of the given index. | |
void | SetOperand (int operandIndex, long constant) |
Replaces the operand of the given index. | |
void | SetOperand (int operandIndex, double constant) |
Replaces the operand of the given index. | |
int | GetNbOperands () |
Gets the number of operands of this expression. | |
void | SetValue (long value) |
Sets the value of this expression in the current solution found by the solver. | |
void | SetValue (double value) |
Sets the value of this expression in the current solution found by the solver. | |
void | SetIntValue (long value) |
Sets the value of this expression in the current solution found by the solver. | |
void | SetDoubleValue (double value) |
Sets the value of this expression in the current solution found by the solver. | |
long | GetValue () |
Gets the value of this expression in the best solution found by the solver. | |
long | GetIntValue () |
Gets the value of this expression in the best solution found by the solver. | |
double | GetDoubleValue () |
Gets the value of this expression in the best solution found by the solver. | |
LSCollection | GetCollectionValue () |
Gets the value of this expression in the best solution found by the solver. | |
bool | IsViolated () |
Returns true if the given expression is violated in the best solution found by the solver. | |
void | SetName (string name) |
Sets the name of this expression. | |
bool | IsNamed () |
Returns true if this expression has a name, and false otherwise. | |
string | GetName () |
Gets the name of this expression or the empty string if no name has been set. | |
override string | ToString () |
Returns a string representation of this expression. | |
string | GetInfo () |
Returns useful info about this expression (according to the state of LocalSolver). |
|
inline |
Gets the operator of this expression.
|
inline |
Gets the index of this expression in the model.
|
inline |
Returns true if this expression is typed as constant in the model, false otherwise.
|
inline |
Returns true if this expression is typed as decision in the model, false otherwise.
|
inline |
Returns true if this expression is tagged as constraint in the model, false otherwise.
|
inline |
Returns true if this expression is tagged as objective in the model, false otherwise.
|
inline |
Returns true if this expression is a double, false otherwise.
Only allowed in states LSState.Paused or LSState.Stopped.
Since version 3.0
|
inline |
Returns true if this expression is an integer, false otherwise.
Only allowed in states LSState.Paused or LSState.Stopped. Note that a boolean is also an integer.
Since version 3.0
|
inline |
Returns true if this expression is a boolean (ie 0 or 1), false otherwise.
Only allowed in states LSState.Paused or LSState.Stopped.
Since version 3.0
|
inline |
Returns true if this expression is an array, false otherwise.
Only allowed in states LSState.Paused or LSState.Stopped.
Since version 3.1
|
inline |
Adds the given operand to this expression.
Only allowed in state LSState.Modeling.
expr | Operand to add. |
|
inline |
Add the given constant operand to this expression.
Only allowed in state LSState.Modeling.
constant | Constant operand to add. |
|
inline |
Add the given constant operand to this expression.
Only allowed in state LSState.Modeling.
constant | Constant operand to add. |
|
inline |
Add the given operands to the expression.
operands | The operands to be added. |
|
inline |
Add the given constant integer operands to the expression.
operands | The operands to be added. |
|
inline |
Add the given constant double operands to the expression.
operands | The operands to be added. |
|
inline |
Add the given operands to the expression.
operands | The operands to be added. |
|
inline |
Add the given constant double operands to the expression.
operands | The operands to be added. |
|
inline |
Add the given constant integer operands to the expression.
operands | The operands to be added. |
|
inline |
Gets the operand with the given index.
operandIndex | Index of the operand. |
|
inline |
Replaces the operand of the given index.
operandIndex | Index of the operand to change |
operand | New operand |
|
inline |
Replaces the operand of the given index.
operandIndex | Index of the operand to change. |
constant | New constant operand. |
|
inline |
Replaces the operand of the given index.
operandIndex | Index of the operand to change. |
constant | New constant operand. |
Since version 3.0
|
inline |
Gets the number of operands of this expression.
|
inline |
Sets the value of this expression in the current solution found by the solver.
Only allowed for decisions. Only allowed in state LSState.Stopped. Only allowed if this expression is an integer or a boolean. If the solver was not launched, this value will be used as an initial value for the decision. This method is a shortcut for LSSolution#SetValue(LSExpression, long) and has the same behavior as SetIntValue(long).
value | Value assigned to this expression. |
|
inline |
Sets the value of this expression in the current solution found by the solver.
Only allowed for decisions. Only allowed in state LSState.Stopped. Only allowed if this expression is an integer or a boolean. If the solver was not launched, this value will be used as an initial value for the decision. This method is a shortcut for LSSolution#SetValue(LSExpression, double) and has the same behavior as SetDoubleValue(double).
value | Value assigned to this expression. |
|
inline |
Sets the value of this expression in the current solution found by the solver.
Only allowed for decisions. Only allowed in state LSState.Stopped. Only allowed if this expression is an integer or a boolean. If the solver was not launched, this value will be used as an initial value for the decision. This method is a shortcut for LSSolution#SetValue(LSExpression, long).
value | Value assigned to this expression. |
LSSolution.SetIntValue LSExpression.IsInt LSExpression.IsBool Since version 3.0
|
inline |
Sets the value of this expression in the current solution found by the solver.
Only allowed for decisions. Only allowed in state LSState.Stopped. Only allowed if this expression is a double. If the solver was not launched, this value will be used as an initial value for the decision. This method is a shortcut for LSSolution#SetValue(LSExpression, double).
value | Value assigned to this expression. |
LSSolution.SetDoubleValue LSExpression.IsDouble Since version 3.0
|
inline |
Gets the value of this expression in the best solution found by the solver.
Only allowed in states LSState.Paused or LSState.Stopped. Only allowed if this expression is an integer or a boolean. This method is a shortcut for LSSolution#GetValue(LSExpression).
|
inline |
Gets the value of this expression in the best solution found by the solver.
Only allowed in states LSState.Paused or LSState.Stopped. Only allowed if this expression is an integer or a boolean. This method is a shortcut for LSSolution#GetIntValue(LSExpression).
LSSolution.GetIntValue LSExpression.IsInt LSExpression.IsBool Since version 3.0
|
inline |
Gets the value of this expression in the best solution found by the solver.
Only allowed in states LSState.Paused or LSState.Stopped. Only allowed if this expression is a double. This method is a shortcut for LSSolution#GetDoubleValue(LSExpression).
LSSolution.GetDoubleValue LSExpression.IsDouble Since version 3.0
|
inline |
Gets the value of this expression in the best solution found by the solver.
Only allowed in states LSState.Paused or LSState.Stopped. Only allowed if this expression is a collection (list). This method is a shortcut for LSSolution#GetCollectionValue(LSExpression).
LSSolution.GetCollectionValue Since version 5.5
|
inline |
Returns true if the given expression is violated in the best solution found by the solver.
An expression can be violated in 3 cases:
Since version 5.5
|
inline |
Sets the name of this expression.
Only allowed in state LSState.Modeling. The name cannot be empty. Two operators of the model cannot share the same name. Useful for debugging or logging purposes.
name | Name. |
|
inline |
Returns true if this expression has a name, and false otherwise.
|
inline |
Gets the name of this expression or the empty string if no name has been set.
|
inline |
Returns a string representation of this expression.
This representation provides the index of the expression, its type, and its name (if any). Useful for debugging or logging purposes.
|
inline |
Returns useful info about this expression (according to the state of LocalSolver).
Useful for debugging or logging purposes.