(class from pyomo.contrib.piecewise.transform.piecewise_to_mip_visitor)
pyomo.contrib.piecewise.transform.piecewise_to_mip_visitor
Bases: StreamBasedExpressionVisitor
StreamBasedExpressionVisitor
Expression walker to replace PiecewiseLinearExpressions when creating equivalent MIP formulations.
transform_pw_linear_expression (function) – a callback that accepts a PiecewiseLinearExpression, its parent PiecewiseLinearFunction, and a transformation Block. It is expected to convert the PiecewiseLinearExpression to MIP form, and return the Var (or other expression) that will replace it in the expression.
transBlock (Block) – transformation Block to pass to the above callback
Methods
__init__(transform_pw_linear_expression, ...)
__init__
beforeChild(node, child, child_idx)
beforeChild
exitNode(node, data)
exitNode
initializeWalker(expr)
initializeWalker
walk_expression(expr)
walk_expression
Walk an expression, calling registered callbacks.
walk_expression_nonrecursive(expr)
walk_expression_nonrecursive
Nonrecursively walk an expression, calling registered callbacks.
Attributes
client_methods
finalizeResult
Member Documentation
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()
This routine is safer than the recursive walkers for deep (or unbalanced) trees. It is, however, slightly slower than the recursive implementations.