Numerical problem encountered while solving convex QCQP
OngoingDear Sir/Madam,
I encountered a numerical problem while solving a convex QCQP problem on Matlab with gurobi.
When dimension n=20, the number of constraints m=30 or more, it can be correctly solved by gurobi algorithm.
However, when n=20, m=10 or 20, it doesn't work. For our numerical instances, there are two cases:
case one: Numerical trouble encountered ,for some of our test examples, the status of model.result is 'NUMERIC', no solution x is output.
case two: Sub-optimal termination, the value computed by gurobi is not the optimal value of the convex instance,comparing with the value computed by cvx.
I've added my code below.
%% Solve following convex QCQP
% min x'*F*x+c'*x
% s.t.x'*Q_i*x+c_i'*x-b_i<=0 i=1,...,m
% F,Q_i are positive definite matrices
clear;
clc;
dim=20; % dimension
m=10;% the number of constraints
%Generate a test instance
F=rand(dim)*2-1;
F=(F+F')/2;
[P,D]=eig(F);
for i=1:1:dim
D(i,i)=rand()*10;
end
F=P*D*P';
c=rand(dim,1)*2-1;
%Generate m constraints, and the matrices are guaranteed to be positive definite
for j=1:m
J=rand(dim)*2-1;
J=(J+J')/2;
[P,D]=eig(J);
for i=1:1:dim
D(i,i)=rand()*99+1;
end
M=P*D*P';%matrices are guaranteed to be positive definite
z=rand(dim,1)*200-100;
Qr(j).mat=M;
cr(j).vec=z;
br(j)=rand()*49+1;
end
%% solve convex problem with gurobi
model.modelsense = 'min';
model.Q=sparse(F);
model.obj =c';
%no linear constraints and upper,lower bound
model.A = sparse(zeros(1,dim));
model.rhs = 0.0;
model.sense = '=';
model.lb=-Inf*ones(1,dim);
%quadratic constraints
%x'Qix+ci'x-bi<=0, i=1,...,m
for i=1:m
Qcm=Qr(i).mat;
model.quadcon(i).Qc = sparse(Qcm);
model.quadcon(i).q = sparse(cr(i).vec);
model.quadcon(i).rhs = br(i);
end
params.BarHomogeneous=1;
result = gurobi(model,params);
x_new=result.x;
y_new=x_new'*F*x_new+c'*x_new;
Thanks Yuanyi |
-
Hi Yuanyi,
Thanks for reporting this issue. We created a ticket for this to investigate the issue in more detail. We will keep you updated through the ticket.
Best regards,
Maliheh
0
Please sign in to leave a comment.
Comments
1 comment