Expressions
-
class Expression
Container for expressions in equations.
This class is the core container for expressions that appear in objectives and constraints.
Public Functions
-
Expression()
Constructs an Expression without defining its value
-
explicit Expression(double value)
Explict construction of an Expression from a double
-
explicit Expression(int value)
Explict construction of an Expression from an integer
-
Expression(const Parameter &arg)
Implicit construction of an Expression from a Parameter
-
Expression(const IndexParameter &arg)
Implicit construction of an Expression from an IndexParameter
-
Expression(const Variable &arg)
Implicit construction of an Expression from a Variable
-
Expression(const SubExpression &arg)
Implicit construction of an Expression from a SubExpression
-
bool is_constant() const
- Returns:
true
if this is a constant expression
-
double value() const
Note
The expression value is computed from the expression tree using values for the associated Parameter and Variable objects.
- Returns:
the value of the expression
-
std::list<std::string> to_list() const
- Returns:
a list representation of the expression
-
Expression diff(const Variable &var) const
Create an expression that computes the partial derivative relative to a specified variable.
- Parameters:
var – - The variable that will be used to compute the partial derivative
- Returns:
an expression that computes the partial derivative
-
Expression &operator+=(int arg)
Add an integer to the expression
-
Expression &operator+=(double arg)
Add a double to the expression
-
Expression &operator+=(const Parameter &arg)
Add a Parameter to the expression
-
Expression &operator+=(const IndexParameter &arg)
Add an IndexParameter to the expression
-
Expression &operator+=(const Variable &arg)
Add a Variable to the expression
-
Expression &operator+=(const Expression &arg)
Add an Expression to the expression
-
Expression &operator-=(int arg)
Subtract an integer from the expression
-
Expression &operator-=(double arg)
Subtract a double from the expression
-
Expression &operator-=(const Parameter &arg)
Subtract a Parameter from the expression
-
Expression &operator-=(const IndexParameter &arg)
Subtract an IndexParameter from the expression
-
Expression &operator-=(const Variable &arg)
Subtract a Variable from the expression
-
Expression &operator-=(const Expression &arg)
Subtract an Expression from the expression
-
Expression &operator*=(int arg)
Multiply the expression by an integer
-
Expression &operator*=(double arg)
Multiply the expression by a double
-
Expression &operator*=(const Parameter &arg)
Multiply the expression by a Parameter
-
Expression &operator*=(const IndexParameter &arg)
Multiply the expression by an IndexParameter
-
Expression &operator*=(const Variable &arg)
Multiply the expression by a Variable
-
Expression &operator*=(const Expression &arg)
Multiply the expression by an Expression
-
Expression &operator/=(int arg)
Divide the expression by an integer
-
Expression &operator/=(double arg)
Divide the expression by a double
-
Expression &operator/=(const Parameter &arg)
Divide the expression by a Parameter
-
Expression &operator/=(const IndexParameter &arg)
Divide the expression by an IndexParameter
-
Expression &operator/=(const Variable &arg)
Divide the expression by a Variable
-
Expression &operator/=(const Expression &arg)
Divide the expression by an Expression
-
Expression expand()
- Returns:
an expanded Expression
-
Expression()