IdentifyVariableVisitor
(class from pyomo.core.expr.visitor)
- class pyomo.core.expr.visitor.IdentifyVariableVisitor(include_fixed=False, named_expression_cache=None)[source]
Bases:
StreamBasedExpressionVisitor- __init__(include_fixed=False, named_expression_cache=None)[source]
Visitor that collects all unique variables participating in an expression
Methods
__init__([include_fixed, named_expression_cache])Visitor that collects all unique variables participating in an expression
beforeChild(parent, child, index)exitNode(node, data)finalizeResult(result)initializeWalker(expr)walk_expression(expr)Walk an expression, calling registered callbacks.
Nonrecursively walk an expression, calling registered callbacks.
Attributes
client_methodsMember Documentation
- walk_expression(expr)
Walk an expression, calling registered callbacks.
This is the standard interface for running the visitor. It defaults to using an efficient recursive implementation of the visitor, falling back on
walk_expression_nonrecursive()if the recursion stack gets too deep.
- walk_expression_nonrecursive(expr)
Nonrecursively walk an expression, calling registered callbacks.
This routine is safer than the recursive walkers for deep (or unbalanced) trees. It is, however, slightly slower than the recursive implementations.