substitute_template_expression
(function from pyomo.core.expr.template_expr
)
- pyomo.core.expr.template_expr.substitute_template_expression(expr, substituter, *args, **kwargs)[source]
Substitute IndexTemplates in an expression tree.
This is a general utility function for walking the expression tree and substituting all occurrences of IndexTemplate and GetItemExpression nodes.
- Parameters:
expr (NumericExpression) – the source template expression
substituter (Callable) – method taking
(expression, *args)
and returning the new object*args – positional arguments passed directly to the substituter
- Returns:
a new expression tree with all substitutions done
- Return type: