EFReplacement

(class from pyomo.contrib.trustregion.interface)

class pyomo.contrib.trustregion.interface.EFReplacement(trfData, efSet)[source]

Bases: ExpressionReplacementVisitor

This class is a subclass of ExpressionReplacementVisitor. It replaces an external function expression in an expression tree with a “holder” variable (recorded in a ComponentMap) and sets the initial value of the new node on the tree to that of the original node, if it can.

NOTE: We use an empty substitution map. The EFs to be substituted are

identified as part of exitNode.

__init__(trfData, efSet)[source]

Methods

__init__(trfData, efSet)

acceptChildResult(node, data, child_result, ...)

beforeChild(node, child, child_idx)

dfs_postorder_stack(expr)

DEPRECATED.

enterNode(node)

exitNode(node, data)

initializeWalker(expr)

walk_expression(expr)

Walk an expression, calling registered callbacks.

walk_expression_nonrecursive(expr)

Nonrecursively walk an expression, calling registered callbacks.

Attributes

client_methods

Member Documentation

dfs_postorder_stack(expr)

DEPRECATED.

Deprecated since version 6.2: ExpressionReplacementVisitor: this walker has been ported to derive from StreamBasedExpressionVisitor. dfs_postorder_stack() has been replaced with walk_expression()

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.