Skip to main content

adding a quadratic constraint for the sum of an inverse variable

Comments

3 comments

  • Imke Lorenz
    Gurobi-versary
    First Question
    First Comment

    I found part of the solution to this problem: I defined another variable TR[k] and m.addConstr(TR[k] == quicksum(R[i,j]*t[i,j,k] for i in node_list for j in node_list)) and rewrote the quadratic constraint as m.addQConstr(invX[k]*TR[i,j,k] >= 1), which works now. The other part missing is m.addQConstr(invX[k]*TR[i,j,k] <= 1), which is not applicable. Are there any ideas how to incorporate this constraint maybe also in combination with rewriting the current objective function: m.setObjective(quicksum(invX[k] for k in K), GRB.MAXIMIZE).

    I already tried m.addQConstr(invX[k]*TR[i,j,k]*-1 >= -1) but this is not solvable.

    Thanks in advance

    0
  • Tobias Achterberg
    Gurobi Staff Gurobi Staff

    Hi Imke,

    the issue is that your objective function needs to be convex when it is formulated as minimization problem. So, your objective function would read

    min quicksum(-1/x[k] for k in K)

    But this objective function is not convex. So, Gurobi 8.1 is not able to solve it. You have already seen it yourself: if you translate this into a constraint, then a convex constraint will point into the wrong direction.

    With Gurobi 9.0 it will be possible to solve non-convex quadratic problems. But it is not clear to me how difficult your model would be.

    Best regards,

    Tobias

     

    0
  • Surya Narayanan Hari
    Gurobi-versary
    Curious
    First Comment

    I tried doing 1 / p_inv[i] but division is not supported between an int and an MVar. I am using version 9.0.2. Can you suggest if it is not supported for MVars yet?

    0

Please sign in to leave a comment.