CnfToLinearVisitor

(class from pyomo.core.plugins.transform.logical_to_linear)

class pyomo.core.plugins.transform.logical_to_linear.CnfToLinearVisitor(indicator_var, binary_varlist)[source]

Bases: StreamBasedExpressionVisitor

Convert CNF logical constraint to linear constraints.

Expected expression node types: AndExpression, OrExpression, NotExpression, AtLeastExpression, AtMostExpression, ExactlyExpression, BooleanVarData

__init__(indicator_var, binary_varlist)[source]

Methods

__init__(indicator_var, binary_varlist)

beforeChild(node, child, child_idx)

exitNode(node, values)

finalizeResult(result)

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.