GRBModel.addQConstr()

Add a quadratic constraint to a model. Multiple signatures are available.

Important note: the algorithms that Gurobi uses to solve quadratically constrained problems can only handle certain types of quadratic constraints. Constraints of the following forms are always accepted:

If you add a constraint that isn't in one of these forms (and Gurobi presolve is unable to transform the constraint into one of these forms), you'll get an error when you try to solve the model. Constraints where the quadratic terms only involve binary variables will always be transformed into one of these forms.

GRBQConstr addQConstr ( GRBQuadExpr lhsExpr,
    char sense,
    GRBQuadExpr rhsExpr,
    String name )

GRBQConstr addQConstr ( GRBQuadExpr lhsExpr,
    char sense,
    GRBVar rhsVar,
    String name )

GRBQConstr addQConstr ( GRBQuadExpr lhsExpr,
    char sense,
    GRBLinExpr rhsExpr,
    String name )

GRBQConstr addQConstr ( GRBQuadExpr lhsExpr,
    char sense,
    double rhs,
    String name )

GRBQConstr addQConstr ( GRBLinExpr lhsExpr,
    char sense,
    GRBQuadExpr rhsExpr,
    String name )

GRBQConstr addQConstr ( GRBVar lhsVar,
    char sense,
    GRBQuadExpr rhsExpr,
    String name )

GRBQConstr addQConstr ( double lhs,
    char sense,
    GRBQuadExpr rhsExpr,
    String name )