What you show is correct for specifying a rotated SOCP constraint. However after some experimentation it appears the problem is with the case where i = j, which causes the constraint to reduce to X[i,i]*X[i,i] >= X[i,i]^2. This is trivially satisfied anyway, so you could try writing the constraint so that it doesn't get generated:
subject to XsqWS1 {(i,j) in s2: i != j}:
X[i,i]*X[j,j] >= X[i,j]^2;
I tried this with some made-up data and the "i != j" did eliminate the problem. I am reporting it to see if it's a bug that can be eliminated from future releases.
Bob Fourer
From: am...@googlegroups.com [mailto:am...@googlegroups.com]
On Behalf Of taylor...@gmail.com
Sent: Wednesday, May 15, 2013 11:53 AM
To: am...@googlegroups.com
Subject: [AMPL 7021] Recognizing SOCP constraints
Hello,
I'm am trying to solve a mixed integer (binary) SOCP. I have constraints of the form below. I've solved similar MISOCPs in the past two years using AMPL+CPLEX, but now get the error: "CPLEX 12.5.0.0: /var/folders/hb/szf93mc12fx0smlwzb0spj280000gn/T/at28416.nl contains CPLEX driver bug: no quadratic terms in "nonlinear" constraint." In Gurobi, I get: "Gurobi 5.0.1: no quadratic terms in a "quadratic" constraint." Is there another way I should be declaring SOCP constraints?
Thanks,
Josh
set states;
set s2 within (states cross states);
var X {(i,j) in s2};
subject to Xpos {i in states}:
X[i,i] >= 0;
subject to XsqWS1 {(i,j) in s2}:
X[i,i]*X[j,j] >= X[i,j]^2;
AMPL sends quadratic expressions to CPLEX and Gurobi, which do their own tests to determine whether they can handle the resulting objectives and/or constraints. For quadratic expressions in continuous variables, they do a numerical test for positive semi-definiteness, and if that fails they try symbolic tests for certain forms of quadratic cone formulations. Some special cases involving quadratic terms involving integer variables can also be detected.
Due to differences in how CPLEX and Gurobi implement the quadratic tests, they can't be guaranteed to accept all of the same quadratic problems. It's also possible that there is a bug at some stage. Can you post a simple example of a formulation that is accepted by Gurobi but rejected by CPLEX?
On Behalf Of taylor...@gmail.com
Sent: Tuesday, May 28, 2013 9:50 AM
To: am...@googlegroups.com
Cc: 4...@ampl.com
Subject: Re: [AMPL 7065] Recognizing SOCP constraints
This fixes it, but only with the solver Gurobi ('Gurobix'). I'd like to try solving with CPLEX as well ('CPLEXAMP'), but in this case I receive the error:
'CPLEX 12.5.0.0: QP Hessian is not positive semi-definite.'
I'm not sure why one and not the other would solve this sort of problem, since I've used both in the past. Thanks again.
Josh