Originally posted by: SystemAdmin
Hi,John Cui
Thank you very much for your reply.
In fact ,I just write the constraints as you write below.But,Unfortunately, it doesn't work.
I use the matlab toolbox ,then it is wrong.I have used the another method in matlab ,just
using statement'cplex.addQCs',it can be work.
'Col,ng,nt 'is constant
%%%%%%%%%%%%%%%%%% wrong
...
...
...
for i=1:1:ng
for j=1:1:nt
QC((i-1)*nt+j).L=zeros(1,Col*ng*nt);
QC((i-1)*nt+j).r=0;
I=zeros(3,1);
J=zeros(3,1);
S=zeros(3,1);
I(1)=(i-1)*nt+j;J(1)=2*ng*nt+(i-1)*nt+j;S(1)=-0.5;
I(2)=ng*nt+(i-1)*nt+j;J(2)=ng*nt+(i-1)*nt+j;S(2)=1;
I(3)=2*ng*nt+(i-1)*nt+j;J(3)=(i-1)*nt+j;S(3)=-0.5;
QC((i-1)*nt+j).Q=sparse(I,J,S,ng*nt*Col,ng*nt*Col);
end
end
x, opt, status] = cplexmiqcp([,F,Aineq,Bineq,Aeq,Beq,QC.L,QC.Q,QC.r,
],[,
],lb,ub,ctype,[,options);
%%%%%%%%%%%%% right
...
...
...
for i=1:1:ng
for j=1:1:nt
a=zeros(Col*ng*nt,1);
I=zeros(3,1);J=zeros(3,1);S=zeros(3,1);
I(1)=(i-1)*nt+j;J(1)=2*ng*nt+(i-1)*nt+j;S(1)=-0.5;
I(2)=ng*nt+(i-1)*nt+j;J(2)=ng*nt+(i-1)*nt+j;S(2)=1;
I(3)=2*ng*nt+(i-1)*nt+j;J(3)=(i-1)*nt+j;S(3)=-0.5;
Q=sparse(I,J,S,ng*nt*Col,ng*nt*Col);
cplex.addQCs(a, Q, 'L' , 0);
end
end
cplex.solve();
My Cplex version is 12.2.0.0 ,and yesterday I found update in 12.2.0.2:
CPLEX RS00503 The lower triangles of the q matrices of quadratic constraints are not extracted in the Matlab connector
Maybe it can explain the problem.
Thank you!
#CPLEXOptimizers#DecisionOptimization