线性模板表示访问器
(类来自 pyomo.repn.linear_template)
- class pyomo.repn.linear_template.LinearTemplateRepnVisitor(subexpression_cache, var_recorder, remove_fixed_vars=False)[源代码]
-
方法
__init__(subexpression_cache, var_recorder)beforeChild(node, child, child_idx)check_constant(ans, obj)enterNode(node)exitNode(node, data)expand_expression(obj, template_info)finalizeResult(result)initializeWalker(expr)walk_expression(expr)遍历一个表达式,调用已注册的回调函数。
非递归地遍历表达式,调用已注册的回调函数。
属性
before_child_dispatcherclient_methodsexit_node_dispatcherexpand_nonlinear_productsmax_exponential_expansion成员文档
- walk_expression(expr)
遍历一个表达式,调用已注册的回调函数。
这是运行访问者的标准接口。它默认使用访问者的高效递归实现,如果递归堆栈太深,则回退到
walk_expression_nonrecursive()。
- walk_expression_nonrecursive(expr)
非递归地遍历表达式,调用已注册的回调函数。
这个例程对于深度(或不平衡)树来说比递归遍历更安全。然而,它比递归实现稍微慢一些。