Utilities to Build Expressions
- pyomo.core.util.prod(terms)[source]
A utility function to compute the product of a list of terms.
- Parameters:
terms (list) – A list of terms that are multiplied together.
- Returns:
The value of the product, which may be a Pyomo expression object.
- 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.
- pyomo.core.util.sum_product(*args, **kwds)[source]
A utility function to compute a generalized dot product.
This function accepts one or more components that provide terms that are multiplied together. These products are added together to form a sum.
- Parameters:
*args – Variable length argument list of generators that create terms in the summation.
**kwds – Arbitrary keyword arguments.
- Keyword Arguments:
index – A set that is used to index the components used to create the terms
denom – A component or tuple of components that are used to create the denominator of the terms
start – The initial value used in the sum
- Returns:
The value of the sum.
- pyomo.core.util.summation = <function sum_product>
An alias for
sum_product
- pyomo.core.util.dot_product = <function sum_product>
An alias for
sum_product