replace_expressions

(function from pyomo.core.expr.visitor)

pyomo.core.expr.visitor.replace_expressions(expr, substitution_map, descend_into_named_expressions=True, remove_named_expressions=True)[source]
Parameters:
  • expr (Pyomo expression) – The source expression

  • substitution_map (dict) – A dictionary mapping object ids in the source to the replacement objects.

  • descend_into_named_expressions (bool) – True if replacement should go into named expression objects, False to halt at a named expression

  • remove_named_expressions (bool) – True if the named expressions should be replaced with a standard expression, and False if the named expression should be left in place

Returns:

Pyomo expression

Return type:

returns the new expression object