Documentation


GRBModel.AddGenConstrIndicator()

Add a new general constraint of type GRB.GENCONSTR_INDICATOR to a model.

An INDICATOR constraint $z = f \rightarrow a^Tx \leq b$ states that if the binary indicator variable $z$ is equal to $f \in \{0,1\}$, then the linear constraint $a^Tx \leq b$ should hold. On the other hand, if $z = 1-f$, the linear constraint may be violated. The sense of the linear constraint can also be specified to be $=$ or $\geq$.

Note that the indicator variable $z$ of a constraint will be forced to be binary; independently of how it was created.

Multiple signatures are available.

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 ($0$ or $1$).

    expr: Left-hand side expression for the linear constraint triggered by the indicator.

    sense: Sense for the linear constraint. Options are GRB.LESS_EQUAL, GRB.EQUAL, or GRB.GREATER_EQUAL.

    rhs: Right-hand-side value for the linear constraint.

    name: Name for the new general constraint.

    Return value:

    New general constraint.

GRBGenConstr AddGenConstrIndicator ( GRBVar binvar,
    int binval,
    GRBTempConstr constr,
    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 ($0$ or $1$).

    constr: Temporary constraint object defining the linear constraint that is triggered by the indicator. The temporary constraint object is created using an overloaded comparison operator. See GRBTempConstr for more information.

    name: Name for the new general constraint.

    Return value:

    New general constraint.