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)
. Ifflag
isFalse
, then a nonlinear term has been found, andlist
isNone
. Otherwise,list
is a list of tuples:(coef, value)
. Ifvalue
isNone
, then this represents a constant term with valuecoef
. Otherwise,value
is a variable object, andcoef
is the numeric coefficient.