Documentation


GRBModel::addConstrs()

Add new linear constraints to a model.

We recommend that you build your model one constraint at a time (using addConstr), since it introduces no significant overhead and we find that it produces simpler code. Feel free to use these methods if you disagree, though.

GRBConstr* addConstrs ( int count )

    Add count new linear constraints to a model.

    Arguments:

    count: Number of constraints to add to the model. The new constraints are all of the form 0 <= 0.

    Return value:

    Array of new constraint objects. Note that the result is heap-allocated, and must be returned to the heap by the user.

GRBConstr* addConstrs ( const GRBLinExpr* lhsExprs,
    const char* senses,
    const double* rhsVals,
    const string* names,
    int count )
    Add count new linear constraints to a model.

    Arguments:

    lhsExprs: Left-hand side expressions for the new linear constraints.

    senses: Senses for new linear constraints (GRB_LESS_EQUAL, GRB_EQUAL, or GRB_GREATER_EQUAL).

    rhsVals: Right-hand side values for the new linear constraints.

    names: Names for new constraints.

    count: Number of constraints to add.

    Return value:

    Array of new constraint objects. Note that the result is heap-allocated, and must be returned to the heap by the user.