ExpressionBoundsVisitor

(class from pyomo.contrib.fbbt.expression_bounds_walker)

class pyomo.contrib.fbbt.expression_bounds_walker.ExpressionBoundsVisitor(leaf_bounds=None, feasibility_tol=1e-08, use_fixed_var_values_as_bounds=False)[source]

Bases: StreamBasedExpressionVisitor

Walker to calculate bounds on an expression, from leaf to root, with caching of terminal node bounds (Vars and Expressions)

NOTE: If anything changes on the model (e.g., Var bounds, fixing, mutable Param values, etc), then you need to either create a new instance of this walker, or clear self.leaf_bounds!

Parameters:
  • leaf_bounds (ComponentMap in which to cache bounds at leaves of the expression) – tree

  • feasibility_tol (float, feasibility tolerance for interval arithmetic) – calculations

  • use_fixed_var_values_as_bounds (bool, whether or not to use the values of) – fixed Vars as the upper and lower bounds for those Vars or to instead ignore fixed status and use the bounds. Set to ‘True’ if you do not anticipate the fixed status of Variables to change for the duration that the computed bounds should be valid.

__init__(leaf_bounds=None, feasibility_tol=1e-08, use_fixed_var_values_as_bounds=False)[source]

Methods

__init__([leaf_bounds, feasibility_tol, ...])

beforeChild(node, child, child_idx)

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

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.