quicksum
(function from pyomo.core.util
)
- pyomo.core.util.quicksum(args, start=0, linear=None)[source]
A utility function to compute a sum of Pyomo expressions.
The behavior of
quicksum()
is similar to the builtinsum()
function, but this function can avoid the generation and disposal of intermediate objects, and thus is slightly more performant.- Parameters:
args (Iterable) – A generator for terms in the sum.
start (Any) – A value that initializes the sum. If this value is not a numeric constant, then the += operator is used to add terms to this object. Defaults to 0.
linear (bool) – DEPRECATED: the linearity of the resulting expression is determined automatically. This option is ignored.
- Return type:
The value of the sum, which may be a Pyomo expression object.