inequality
(function from pyomo.core.expr.relational_expr
)
- pyomo.core.expr.relational_expr.inequality(lower=None, body=None, upper=None, strict=False)[source]
A utility function that can be used to declare inequality and ranged inequality expressions. The expression:
inequality(2, model.x)
is equivalent to the expression:
2 <= model.x
The expression:
inequality(2, model.x, 3)
is equivalent to the expression:
2 <= model.x <= 3
Note
This ranged inequality syntax is deprecated in Pyomo. This function provides a mechanism for expressing ranged inequalities without chained inequalities.
- Parameters:
lower – an expression defines a lower bound
body – an expression defines the body of a ranged constraint
upper – an expression defines an upper bound
strict (bool) – A boolean value that indicates whether the inequality is strict. Default is
False
.
- Returns:
A relational expression. The expression is an inequality if any of the values
lower
,body
orupper
isNone
. Otherwise, the expression is a ranged inequality.