clone_expression
(function from pyomo.core.expr.visitor
)
- pyomo.core.expr.visitor.clone_expression(expr, substitute=None)[source]
A function that is used to clone an expression.
Cloning is equivalent to calling
copy.deepcopy
with no Block scope. That is, the expression tree is duplicated, but no Pyomo components (leaf nodes or named Expressions) are duplicated.- Parameters:
expr – The expression that will be cloned.
substitute (dict) – A dictionary mapping object ids to objects. This dictionary has the same semantics as the memo object used with
copy.deepcopy
. Defaults to None, which indicates that no user-defined dictionary is used.
- Returns:
The cloned expression.