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 generates a more compact Pyomo expression.Parameters: - args – A generator for terms in the sum.
- start – A value that is initializes the sum. If this value is not a numeric constant, then the += operator is used to add terms to this object. Defaults to zero.
- linear – If
startis not a numeric constant, then this option is ignored. Otherwise, this value indicates whether the terms in the sum are linear. If the value isFalse, then the terms are treated as nonlinear, and ifTrue, then the terms are treated as linear. Default isNone, which indicates that the first term in theargsis used to determine this value.
Returns: 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