The above actually works for me without an error (after I fixed a mistyped index). The affine SOC constraint 'Av+b is in K' also worked.

Actually the affine SOC constraint 'Av+b is in K' when rewritten in the form 1/2 v^T.Q.v + q.v <= b seems to work in some cases, such as for a diagonal A, but for a general rectangular matrix it doesn't seem recognized as a SOC constraint since I get error 10020 (Q matrix in QP model is not positive semi-definite) . Is this expected? I am using gurobi902.

• Gurobi Staff

Gurobi accepts all SOC in standard form. But when it comes to rotated or affine SOCs, it may not be able to detect the structure. Then, it falls back to the regular Q constraint mechanism, which requires the Q matrix to be PSD (which is of course not true for SOCs).

Regards,

Tobias

Tobias Achterberg, could you explain more on what affine SOCs are detectable and what are not? I found that diagonal Q works (for example Q = diag([a, b, -c]) where a, b, c are all positive numbers). Also it seems that matrix in this form

[A 0]

[0, -d]

where A is a positive definite matrix and d is a positive scalar also works.

Are there other affine SOCs that are detectable? If I shuffle the order of my variables (and hence shuffle the rows and columns of the Q matrix, would gurobi still detect it? It would be great if there is cleaner explanation for this.

I ask this question since I am writing a parser for Gurobi (similar to how YALMIP and cvxpy parses the program to Gurobi format). It would be greatly helpful if I know in which cases I can rely on Gurobi to detect the SOC constraint, and in which cases I  need to add slack variables so that my affine SOC is converted to the standard form. I found these two approaches generate slightly different answers, especially when I adjust the tolerance (like BarConvTol).

• Gurobi Staff

This is a delicate issue. We only promise that we will be able to detect the following two cases as convex:

1. x^T Q x <= d with PSD matrix Q2. sum xj² - y² <= 0 with y >= 0

But Gurobi will also be able to detect some other situations to be convex. But whether we will be able to detect those additional cases also depends on the presolve transformations that we apply. Only for the two cases above we make sure that presolve reductions do not destroy the structure (i.e., turn a constraint that is in one of the two forms into a constraint that no longer is in one of the two forms).

We also detect rotated second order cones and some additional special cases, but as I said, it depends on how exactly these constraints then look like after presolve whether we are able to detect them as convex.