GRBModel::addConstr()

Add a single linear constraint to a model. Multiple signatures are available.

GRBConstr addConstr ( const GRBLinExpr& lhsExpr,
    char sense,
    const GRBLinExpr& rhsExpr,
    string name="" )

Add a single linear constraint to a model.

Arguments:

lhsExpr: Left-hand side expression for new linear constraint.

sense: Sense for new linear constraint (GRB_LESS_EQUAL, GRB_EQUAL, or GRB_GREATER_EQUAL).

rhsExpr: Right-hand side expression for new linear constraint.

name (optional): Name for new constraint.

Return value:

New constraint object.

GRBConstr addConstr ( const GRBLinExpr& lhsExpr,
    char sense,
    GRBVar rhsVar,
    string name="" )

Add a single linear constraint to a model.

Arguments:

lhsExpr: Left-hand side expression for new linear constraint.

sense: Sense for new linear constraint (GRB_LESS_EQUAL, GRB_EQUAL, or GRB_GREATER_EQUAL).

rhsVar: Right-hand side variable for new linear constraint.

name (optional): Name for new constraint.

Return value:

New constraint object.

GRBConstr addConstr ( const GRBLinExpr& lhsExpr,
    char sense,
    double rhsVal,
    string name="" )

Add a single linear constraint to a model.

Arguments:

lhsExpr: Left-hand side expression for new linear constraint.

sense: Sense for new linear constraint (GRB_LESS_EQUAL, GRB_EQUAL, or GRB_GREATER_EQUAL).

rhsVal: Right-hand side value for new linear constraint.

name (optional): Name for new constraint.

Return value:

New constraint object.

GRBConstr addConstr ( GRBVar lhsVar,
    char sense,
    GRBVar rhsVar,
    string name="" )

Add a single linear constraint to a model.

Arguments:

lhsVar: Left-hand side variable for new linear constraint.

sense: Sense for new linear constraint (GRB_LESS_EQUAL, GRB_EQUAL, or GRB_GREATER_EQUAL).

rhsVar: Right-hand side variable for new linear constraint.

name (optional): Name for new constraint.

Return value:

New constraint object.

GRBConstr addConstr ( GRBVar lhsVar,
    char sense,
    double rhsVal,
    string name="" )

Add a single linear constraint to a model.

Arguments:

lhsVar: Left-hand side variable for new linear constraint.

sense: Sense for new linear constraint (GRB_LESS_EQUAL, GRB_EQUAL, or GRB_GREATER_EQUAL).

rhsVal: Right-hand side value for new linear constraint.

name (optional): Name for new constraint.

Return value:

New constraint object.

GRBConstr addConstr ( GRBTempConstr& tc,
    string name="" )

Add a single linear constraint to a model.

Arguments:

tc: Temporary constraint object, created using an overloaded comparison operator. See GRBTempConstr for more information.

name (optional): Name for new constraint.

Return value:

New constraint object.