Context Managers

class pyomo.core.expr.nonlinear_expression[source]

Context manager for mutable nonlinear sums.

This context manager is used to compute a general nonlinear sum while treating the summation as a mutable object.

Note

The preferred context manager is mutable_expression, as the return type will be the most specific of SumExpression, LinearExpression, or NPV_SumExpression. This context manager will always return a SumExpression.

class pyomo.core.expr.linear_expression[source]

Context manager for mutable linear sums.

This context manager is used to compute a linear sum while treating the summation as a mutable object.

Note

The preferred context manager is mutable_expression. linear_expression is an alias to mutable_expression provided for backwards compatibility.