GRBModel.addGenConstrIndicator()
GRBModel.addGenConstrIndicator()
Add a new general constraint of typeGRB.GENCONSTR_INDICATORto a model.
An INDICATOR constraintstates that if the binary indicator variableis equal to, then the linear constraintshould hold. On the other hand, if, the linear constraint may be violated. The sense of the linear constraint can also be specified to beor.
Note that the indicator variableof a constraint will be forced to be binary; independently of how it was created.
GRBGenConstr | addGenConstrIndicator( | GRBVar | binvar, |
int | binval, | ||
GRBLinExpr | expr, | ||
char | sense, | ||
double | rhs, | ||
String | name ) |
-
Arguments:
binvar: The binary indicator variable.
binval: The value for the binary indicator variable that would force the linear constraint to be satisfied (or).
expr: Left-hand side expression for the linear constraint triggered by the indicator.
sense: Sense for the linear constraint. Options areGRB.LESS_EQUAL,GRB.EQUAL, orGRB.GREATER_EQUAL.
rhs: Right-hand-side value for the linear constraint.
name: Name for the new general constraint.
Return value:
New general constraint.