decompose_term
(function from pyomo.core.expr.numeric_expr)
- pyomo.core.expr.numeric_expr.decompose_term(expr)[source]
A function that returns a tuple consisting of (1) a flag indicating whether the expression is linear, and (2) a list of tuples that represents the terms in the linear expression.
- Parameters:
expr (expression) – The root node of an expression tree
- Returns:
A tuple with the form
(flag, list). IfflagisFalse, then a nonlinear term has been found, andlistisNone. Otherwise,listis a list of tuples:(coef, value). IfvalueisNone, then this represents a constant term with valuecoef. Otherwise,valueis a variable object, andcoefis the numeric coefficient.