Skip to main content

Objective Q not PSD



1 comment

  • Eli Towle
    Gurobi Staff Gurobi Staff

    Hi Lei,

    This error means that your quadratic objective function is not convex. In other words, the \( Q \) matrix in your objective function \( x^\top Q x + c^\top x \) is not positive semi-definite (PSD).

    Gurobi 9.0 is able to solve problems with non-convex quadratic constraints and objectives. To enable this, set the NonConvex parameter to 2.

    Also, note that you can iterate over multiple indices within a single quicksum() function. E.g.:

    m = Model()
    x = m.addVars(5, 10, vtype=GRB.BINARY, name="x")
    m.addConstr(quicksum(x[i,j] for i in range(5) for j in range(10)) >= 1)

    I hope this helps. Thanks!



Please sign in to leave a comment.