This data stucture represents a linear constraint in the LP. Basically it is a linear expression with a lower or an upper bound (or both). These parts of the constraint can be obtained by the member functions expr(), lowerBound() and upperBound(), respectively. There are two ways to construct a constraint.
- You can set the linear expression and the bounds directly by the functions above.
- The operators
<=
, ==
and >=
are defined between expressions, or even between constraints whenever it makes sense. Therefore if e
and f
are linear expressions and s
and t
are numbers, then the followings are valid expressions and thus they can be used directly e.g. in addRow() whenever it makes sense. e<=s
e<=f
e==f
s<=e<=t
e>=t
- Warning
- The validity of a constraint is checked only at run time, so e.g. addRow(
x[1]<=x[2]<=5
) will compile, but will fail an assertion.
|
(Note that these are not member functions.)
|
LpBase::Constr | operator<= (const LpBase::Expr &e, const LpBase::Expr &f) |
| Create constraint.
|
|
LpBase::Constr | operator<= (const LpBase::Value &e, const LpBase::Expr &f) |
| Create constraint.
|
|
LpBase::Constr | operator<= (const LpBase::Expr &e, const LpBase::Value &f) |
| Create constraint.
|
|
LpBase::Constr | operator>= (const LpBase::Expr &e, const LpBase::Expr &f) |
| Create constraint.
|
|
LpBase::Constr | operator>= (const LpBase::Value &e, const LpBase::Expr &f) |
| Create constraint.
|
|
LpBase::Constr | operator>= (const LpBase::Expr &e, const LpBase::Value &f) |
| Create constraint.
|
|
LpBase::Constr | operator== (const LpBase::Expr &e, const LpBase::Value &f) |
| Create constraint.
|
|
LpBase::Constr | operator== (const LpBase::Expr &e, const LpBase::Expr &f) |
| Create constraint.
|
|
LpBase::Constr | operator<= (const LpBase::Value &n, const LpBase::Constr &c) |
| Create constraint.
|
|
LpBase::Constr | operator<= (const LpBase::Constr &c, const LpBase::Value &n) |
| Create constraint.
|
|
LpBase::Constr | operator>= (const LpBase::Value &n, const LpBase::Constr &c) |
| Create constraint.
|
|
LpBase::Constr | operator>= (const LpBase::Constr &c, const LpBase::Value &n) |
| Create constraint.
|
|