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).
- See Also
- LSModel
-
LSOperator
Public Member Functions |
LSOperator | getOperator () const |
| Gets the operator of this expression.
|
int | getIndex () const |
| Gets the index of this expression in the model.
|
bool | isConstant () const |
| Returns true if this expression is typed as constant in the model, false otherwise.
|
bool | isDecision () const |
| Returns true if this expression is typed as decision in the model, false otherwise.
|
bool | isConstraint () const |
| Returns true if this expression is tagged as constraint in the model, false otherwise.
|
bool | isObjective () const |
| Returns true if this expression is tagged as objective in the model, false otherwise.
|
bool | isDouble () const |
| Returns true if this expression is a double, false otherwise.
|
bool | isInt () const |
| Returns true if this expression is an integer, false otherwise.
|
bool | isBool () const |
| Returns true if this expression is a boolean (ie 0 or 1), false otherwise.
|
bool | isArray () const |
| Returns true if this expression is an array, false otherwise.
|
bool | isCollection () const |
| Returns true if this expression is a collection, false otherwise.
|
void | addOperand (const LSExpression &expr) |
| Adds the given operand to this expression.
|
void | addOperand (int constant) |
| Add the given constant operand to this expression.
|
void | addOperand (lsint constant) |
| Add the given constant operand to this expression.
|
void | addOperand (lsdouble constant) |
| Add the given constant operand to this expression.
|
template<typename T0 , typename T1 > |
void | addOperands (T0 begin, T1 end) |
| Add the given operands to this expression.
|
LSExpression | getOperand (int operandIndex) const |
| Gets the operand with the given index.
|
void | setOperand (int operandIndex, LSExpression operand) |
| Replaces the operand of the given index.
|
void | setOperand (int operandIndex, lsint constant) |
| Replaces the operand of the given index.
|
void | setOperand (int operandIndex, lsdouble constant) |
| Replaces the operand of the given index.
|
int | getNbOperands () const |
| Gets the number of operands of this expression.
|
void | setValue (lsint value) |
| Sets the value of this expression in the current solution found by the solver.
|
void | setValue (lsdouble value) |
| Sets the value of this expression in the current solution found by the solver.
|
void | setIntValue (lsint value) |
| Sets the value of this expression in the current solution found by the solver.
|
void | setDoubleValue (lsdouble value) |
| Sets the value of this expression in the current solution found by the solver.
|
lsint | getValue () const |
| Gets the value of this expression in the best solution found by the solver.
|
lsint | getIntValue () const |
| Gets the value of this expression in the best solution found by the solver.
|
lsdouble | getDoubleValue () const |
| Gets the value of this expression in the best solution found by the solver.
|
bool | isViolated () const |
| Returns true if the given expression is violated in the best solution found by the solver.
|
LSCollection | getCollectionValue () const |
| Gets the value of this expression in the best solution found by the solver.
|
void | setName (const std::string &name) |
| Sets the name of this expression.
|
bool | isNamed () const |
| Returns true if this expression has a name, and false otherwise.
|
const std::string | getName () const |
| Gets the name of this expression or the empty string if no name has been set.
|
std::string | toString () const |
| Returns a string representation of this expression.
|
std::string | getInfo () const |
| Returns useful info about this expression (according to the state of LocalSolver).
|
template<typename T > |
LSExpression | operator+= (T operand) |
template<typename T > |
LSExpression | operator*= (T operand) |
template<typename T > |
LSExpression | operator&= (T operand) |
template<typename T > |
LSExpression | operator^= (T operand) |
template<typename T > |
LSExpression | operator|= (T operand) |
template<typename T > |
LSExpression | operator+ (T operand) |
template<typename T > |
LSExpression | operator- (T operand) |
template<typename T > |
LSExpression | operator* (T operand) |
template<typename T > |
LSExpression | operator% (T operand) |
template<typename T > |
LSExpression | operator/ (T operand) |
LSExpression | operator! () |
template<typename T > |
LSExpression | operator&& (T operand) |
template<typename T > |
LSExpression | operator|| (T operand) |
template<typename T > |
LSExpression | operator^ (T operand) |
template<typename T > |
LSExpression | operator== (T operand) |
template<typename T > |
LSExpression | operator!= (T operand) |
template<typename T > |
LSExpression | operator>= (T operand) |
template<typename T > |
LSExpression | operator<= (T operand) |
template<typename T > |
LSExpression | operator> (T operand) |
template<typename T > |
LSExpression | operator< (T operand) |
template<typename T > |
LSExpression | operator[] (T operand) |
| ~LSExpression () |
| LSExpression () |
| LSExpression (const LSExpression &other) |
LSExpression | operator= (const LSExpression &other) |
Friends |
LSExpression | operator+ (lsint expr0, LSExpression expr1) |
LSExpression | operator+ (lsdouble expr0, LSExpression expr1) |
LSExpression | operator+ (int expr0, LSExpression expr1) |
LSExpression | operator- (lsint expr0, LSExpression expr1) |
LSExpression | operator- (lsdouble expr0, LSExpression expr1) |
LSExpression | operator- (int expr0, LSExpression expr1) |
LSExpression | operator* (lsint expr0, LSExpression expr1) |
LSExpression | operator* (lsdouble expr0, LSExpression expr1) |
LSExpression | operator* (int expr0, LSExpression expr1) |
LSExpression | operator/ (lsint expr0, LSExpression expr1) |
LSExpression | operator/ (lsdouble expr0, LSExpression expr1) |
LSExpression | operator/ (int expr0, LSExpression expr1) |
LSExpression | operator% (lsint expr0, LSExpression expr1) |
LSExpression | operator% (int expr0, LSExpression expr1) |
LSExpression | operator== (lsint expr0, LSExpression expr1) |
LSExpression | operator== (lsdouble expr0, LSExpression expr1) |
LSExpression | operator== (int expr0, LSExpression expr1) |
LSExpression | operator!= (lsint expr0, LSExpression expr1) |
LSExpression | operator!= (lsdouble expr0, LSExpression expr1) |
LSExpression | operator!= (int expr0, LSExpression expr1) |
LSExpression | operator>= (lsint expr0, LSExpression expr1) |
LSExpression | operator>= (lsdouble expr0, LSExpression expr1) |
LSExpression | operator>= (int expr0, LSExpression expr1) |
LSExpression | operator<= (lsint expr0, LSExpression expr1) |
LSExpression | operator<= (lsdouble expr0, LSExpression expr1) |
LSExpression | operator<= (int expr0, LSExpression expr1) |
LSExpression | operator> (lsint expr0, LSExpression expr1) |
LSExpression | operator> (lsdouble expr0, LSExpression expr1) |
LSExpression | operator> (int expr0, LSExpression expr1) |
LSExpression | operator< (lsint expr0, LSExpression expr1) |
LSExpression | operator< (lsdouble expr0, LSExpression expr1) |
LSExpression | operator< (int expr0, LSExpression expr1) |