Incorrect solution of nonconvex QCP
AnsweredWe tried to solve a nonconvex quadratic program with quadratic constraints in the following form.
min x'*Q*x + 2*q'*x
s.t. x'*x == 1, x'*B*x == 1
Gurobi provides an incorrect solution to the following data.
Q =
0.6504 -0.8572 0.5054 -0.6183
-0.8572 -0.4829 0.2892 1.4221
0.5054 0.2892 -0.3298 -0.2359
-0.6183 1.4221 -0.2359 0.1547
B =
2.0297 1.9554 -1.6496 2.6647
1.9554 2.7037 -3.3201 1.7159
-1.6496 -3.3201 5.1678 -1.0744
2.6647 1.7159 -1.0744 7.5902
q =
0.1626
0.1190
0.4984
0.9597
The instance was run on a Macbook Pro. Gurobi 10.0.2 (Matlab 2022b) with default setting returns an optimal value of 0.2315, while the true optimal value is around -1.36. Has anyone observed similar issues?
The Matlab code is posted below.
function result = TTRS_GRB(Q,q,B)
% Variable
n = length(q);
x = optimvar('x', n, 1);% Objective
model.Q = sparse(Q);
model.obj = 2*q';
model.modelsense = 'min';% Constraints
model.A = sparse(1,n);
model.b = 0;
model.quadcon(1).Qc = speye(n);
model.quadcon(1).q = sparse(n,1);
model.quadcon(1).rhs = 1;
model.quadcon(1).sense = '=';
model.quadcon(2).Qc = sparse(B);
model.quadcon(2).q = sparse(n,1);
model.quadcon(2).rhs = 1;
model.quadcon(2).sense = '=';% Parameter
params.NonConvex = 2;
params.OutputFlag = 0;% Solve
result = gurobi(model,params);end
-
Please note that the default lower bound of the variables is 0. If you want to allow negative variable values, you need to set an appropriate lower bound.
0
Please sign in to leave a comment.
Comments
1 comment