evaluate_expression
(function from pyomo.core.expr.visitor)
- pyomo.core.expr.visitor.evaluate_expression(exp, exception=True, constant=False)[source]
Evaluate the value of the expression.
- Parameters:
expr – The root node of an expression tree.
exception (bool) – A flag that indicates whether exceptions are raised. If this flag is
False, then an exception that occurs while evaluating the expression is caught and the return value isNone. Default isTrue.constant (bool) – If True, constant expressions are evaluated and returned but nonconstant expressions raise either FixedExpressionError or NonconstantExpressionError (default=False).
- Returns:
A floating point value if the expression evaluates normally, or
Noneif an exception occurs and is caught.