AMPLRepnVisitor
(class from pyomo.repn.ampl)
- class pyomo.repn.ampl.AMPLRepnVisitor(subexpression_cache, external_functions, var_map, used_named_expressions, symbolic_solver_labels, use_named_exprs, sorter)[source]
Bases:
StreamBasedExpressionVisitor- __init__(subexpression_cache, external_functions, var_map, used_named_expressions, symbolic_solver_labels, use_named_exprs, sorter)[source]
Methods
__init__(subexpression_cache, ...)beforeChild(node, child, child_idx)cache_fixed_var(_id, child)check_constant(ans, obj)enterNode(node)exitNode(node, data)finalizeResult(result)initializeWalker(expr)node_result_to_amplrepn(data)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.