Hello everyone! I meet some problems when I use CVX.
My version is CVX 3.0beta
The error I met is followed:
Calling SDPT3 4.0: 300 variables, 120 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.
------------------------------------------------------------
num. of constraints = 120
dim. of linear var = 300
*******************************************************************
SDPT3: Infeasible path-following algorithms
*******************************************************************
version predcorr gam expon scale_data
NT 1 0.000 1 0
it pstep dstep pinfeas dinfeas gap prim-obj dual-obj cputime
-------------------------------------------------------------------
0|0.000|0.000|1.2e+02|2.5e+01|9.0e+04| 2.078461e+03 0.000000e+00| 0:0:00| chol 1 1
1|1.000|0.931|1.1e-05|1.8e+00|8.2e+03| 2.144398e+03 -6.212463e+00| 0:0:00| chol 1 1
2|1.000|1.000|4.2e-05|1.0e-02|1.2e+03| 1.158122e+03 -1.881587e+00| 0:0:00| chol 1 1
3|0.983|1.000|8.8e-07|1.0e-03|2.0e+01| 1.827349e+01 -1.855849e+00| 0:0:00| chol 1 1
4|1.000|1.000|2.2e-08|1.0e-04|7.5e+00| 6.454225e+00 -1.040252e+00| 0:0:00| chol 1 1
5|1.000|0.930|4.2e-10|1.6e-05|3.2e+00| 3.617504e+00 4.112804e-01| 0:0:00| chol 1 1
6|1.000|1.000|3.9e-10|1.0e-06|5.1e-01| 1.571411e+00 1.058398e+00| 0:0:00| chol 1 1
7|0.880|0.987|2.0e-10|1.1e-07|5.9e-02| 1.361693e+00 1.302532e+00| 0:0:00| chol 1 1
8|0.910|0.968|3.8e-10|1.3e-08|7.6e-03| 1.328483e+00 1.320929e+00| 0:0:00| chol 1 1
9|0.981|0.979|2.0e-10|1.3e-09|1.6e-04| 1.323875e+00 1.323715e+00| 0:0:01| chol 1 1
10|0.996|0.995|8.5e-13|4.7e-11|2.7e-06| 1.323783e+00 1.323780e+00| 0:0:01| chol 1 1
11|0.998|0.997|2.3e-15|1.1e-12|3.5e-08| 1.323782e+00 1.323782e+00| 0:0:01|
stop: max(relative gap, infeasibilities) < 1.49e-08
-------------------------------------------------------------------
number of iterations = 11
primal objective value = 1.32378188e+00
dual objective value = 1.32378184e+00
gap := trace(XZ) = 3.52e-08
relative gap = 9.65e-09
actual relative gap = 9.65e-09
rel. primal infeas (scaled problem) = 2.29e-15
rel. dual " " " = 1.12e-12
rel. primal infeas (unscaled problem) = 0.00e+00
rel. dual " " " = 0.00e+00
norm(X), norm(y), norm(Z) = 4.8e-01, 7.7e+00, 1.1e+01
norm(A), norm(b), norm(C) = 2.0e+01, 1.5e+00, 1.2e+01
Total CPU time (secs) = 0.51
CPU time per iteration = 0.05
termination code = 0
DIMACS: 3.2e-15 0.0e+00 6.7e-12 0.0e+00 9.6e-09 9.6e-09
-------------------------------------------------------------------
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +1.45193
CVX Warning:
Models involving "log" or other functions in the log, exp, and entropy
family are solved using an experimental successive approximation method.
This method is slower and less reliable than the method CVX employs for
other models. Please see the section of the user's guide entitled
The successive approximation method
for more details about the approach, and for instructions on how to
suppress this warning message in the future.
Successive approximation method to be employed.
For improved efficiency, SDPT3 is solving the dual problem.
SDPT3 will be called several times to refine the solution.
Original size: 4921 variables, 598 equality constraints
60 exponentials add 480 variables, 300 equality constraints
-----------------------------------------------------------------
Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------+---------------------------------+---------
60/ 60 | 5.551e+00 6.254e+00 0.000e+00 | Solved
60/ 60 | 3.956e+00 2.141e+00 0.000e+00 | Solved
60/ 60 | 1.795e+00 3.187e-01 0.000e+00 | Solved
60/ 60 | 3.037e-01 7.752e-03 0.000e+00 | Solved
60/ 60 | 6.780e-03 3.752e-06 0.000e+00 | Solved
0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Solved
-----------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +1.85274
Calling SDPT3 4.0: 60 variables, 0 equality constraints
------------------------------------------------------------
num. of constraints = 1
dim. of linear var = 61
*******************************************************************
SDPT3: Infeasible path-following algorithms
*******************************************************************
version predcorr gam expon scale_data
NT 1 0.000 1 0
it pstep dstep pinfeas dinfeas gap prim-obj dual-obj cputime
-------------------------------------------------------------------
0|0.000|0.000|4.5e+00|8.7e+00|8.5e+03|-9.913347e+02 0.000000e+00| 0:0:00| chol 1 1
1|1.000|0.870|1.5e-06|1.2e+00|3.5e+02|-1.229227e+03 -9.692319e+00| 0:0:00| chol 1 1
2|1.000|0.124|2.1e-08|1.0e+00|2.6e+03|-3.824752e+04 -9.202218e+00| 0:0:00| chol 1 1
3|1.000|0.012|6.3e-08|1.0e+00|5.6e+05|-4.305731e+07 -9.615588e+00| 0:0:00| chol 1 1
4|1.000|0.001|5.5e-06|1.0e+00|4.6e+09|-7.307449e+12 -2.081996e+01| 0:0:00| chol 1 1
5|1.000|0.000|6.9e-04|1.0e+00|7.2e+15|-2.157819e+20 -9.262893e+03| 0:0:00|
sqlp stop: dual problem is suspected of being infeasible
-------------------------------------------------------------------
number of iterations = 5
residual of dual infeasibility
certificate X = 4.64e-21
reldist to infeas. <= 9.07e-21
Total CPU time (secs) = 0.19
CPU time per iteration = 0.04
termination code = 2
DIMACS: 6.9e-04 0.0e+00 5.0e+00 0.0e+00 -1.0e+00 3.3e-05
-------------------------------------------------------------------
------------------------------------------------------------
Status: Unbounded
Optimal value (cvx_optval): +Inf
Here is my code:
clc;
clear all;
T=30;
N=60;
V=30;
pu=repmat(1e-2,1,N);
xigma2=10^(-14);
rou=10^(-6);
gama=rou/xigma2;
H=100;
le=1.442695;
n = 6;
alpha = linspace(0,2*pi,n+1);
r=1000;
x=r*cos(alpha-30*pi/180);
y=r*sin(alpha-30*pi/180);
axis equal
hold on
plot(0,0,'k^');
hold on
plot(x,y,'linewidth',2);
rg=500;
rectangle('Position',[0-rg,0-rg,2*rg,2*rg],'Curvature',[1,1]),axis equal;
hold on;
E=[0,300];
plot(E(1,1),E(1,2),'h');
hold on
M=[-100,-600;500,500];
plot(M(:,1),M(:,2),'b*');
hold on
xg=sum(M(:,1))/2;
yg=sum(M(:,2))/2;
ru=sqrt((M(2,1)-xg)^2+(M(2,2)-yg)^2);
rectangle('Position',[xg-ru,yg-ru,2*ru,2*ru],'Curvature',[1,1]),axis equal
hold on;
plot(xg,yg,'k.')
q0=zeros(2,N);
for n=1:N
q0(:,n)=[xg+ru*cos(2*3.14*(n-1)/(N-1)),yg+ru*sin(2*3.14*(n-1)/(N-1))]';
end
q0(:,1)=M(1,:)';q0(:,N)=M(2,:)';
for n=1:N
q0(:,n)=[q0(:,1)+(q0(:,N)-q0(:,1))/59*(n-1)]';
end
plot(q0(1,:),q0(2,:),'k^');
hold on
for k=1:1
cvx_begin
variables A(2,N);
Rsum=(1/N)*sum(A(1,:).*log2(1+gama*pu./(H^2+(q0(1,:)-M(1,1)).^2+(q0(2,:)-M(1,2)).^2)))+(1/N)*sum(A(2,:).*log2(1+gama*pu./(H^2+(q0(1,:)-M(2,1)).^2+(q0(2,:)-M(2,2)).^2)))-(1/N)*sum(log2(1+gama*pu./(H^2+(q0(1,:)-E(1,1)).^2+(q0(2,:)-E(1,2)).^2)));
maximize Rsum
subject to
A(1,:)+A(2,:)<=1;
A>=0;
A<=1;
cvx_end
C1=(xigma2*rou*pu./((xigma2*(H^2+((q0(1,:)-M(1,1)).^2+(q0(2,:)-M(1,2)).^2))).^2)).*le./(1+rou*pu./(xigma2*(H^2+((q0(1,:)-M(1,1)).^2+(q0(2,:)-M(1,2)).^2))));
D1=log2(1+gama*pu./(H^2+((q0(1,:)-M(1,1)).^2+(q0(2,:)-M(1,2)).^2)));
C2=(xigma2*rou*pu./((xigma2*(H^2+((q0(1,:)-M(2,1)).^2+(q0(2,:)-M(2,2)).^2))).^2)).*le./(1+rou*pu./(xigma2*(H^2+((q0(1,:)-M(2,1)).^2+(q0(2,:)-M(2,2)).^2))));
D2=log2(1+gama*pu./(H^2+((q0(1,:)-M(2,1)).^2+(q0(2,:)-M(2,2)).^2)));
S0=1e4;
cvx_begin
variables q1(2,N) S(1,N)
R1=(1/N)*sum(A(1,:).*(-C1.*(((q1(1,:)-M(1,1)).^2+(q1(2,:)-M(1,2)).^2)-((q0(1,:)-M(1,1)).^2+(q0(2,:)-M(1,2)).^2))+D1))+(1/N)*sum(A(2,:).*(-C2.*(((q1(1,:)-M(2,1)).^2+(q1(2,:)-M(2,2)).^2)-((q0(1,:)-M(2,1)).^2+(q0(2,:)-M(2,2)).^2))+D2));
R2=0;
for i=1:N
R2=R2+log(H^2+S0+gama*pu(1,i))/log(2)+(S(1,i)-S0)*le/(H^2+S0+gama*pu(1,i))-log(H^2+S(1,i))/log(2);
end
Rsum=R1-R2*(1/N);
maximize Rsum
subject to
for i=1:N
S<=norm(q0(:,i)-E')^2+2*(q0(:,i)-E')'*(q1(:,i)-q0(:,i));
end
(q1(1,2:end)-q1(1,1:N-1)).^2+(q1(2,2:end)-q1(2,1:N-1)).^2 <=1000;
q1(:,1)-M(1,:)'<=1e-2;
q1(:,1)-M(1,:)'>=1e-2;
q1(:,N)-M(2,:)'<=1e-2;
q1(:,N)-M(2,:)'>=1e-2;
cvx_end
q0=q1;
S0=S;
EJ1=gama*le./(H^2+(q0(1,:)-E(1,1)).^2+(q0(2,:)-E(1,2)).^2+gama*pu);
EK1=log2(1+gama*pu./(H^2+(q0(1,:)-E(1,1)).^2+(q0(2,:)-E(1,2)).^2));
cvx_begin
variable pu1(1,N)
R3=(1/N)*sum(A(1,:).*log(1+gama*pu(1,:)./((q0(1,:)-M(1,1)).^2+(q0(2,:)-M(1,2)).^2+H^2)))/log(2)+(1/N)*sum(A(2,:).*log(1+gama*pu(1,:)./((q0(1,:)-M(2,1)).^2+(q0(2,:)-M(2,2)).^2+H^2)))/log(2);
R4=(1/N)*sum(EJ1.*(pu1(1,:)-pu(1,:))+EK1);
Rsum=R3-R4;
maximize Rsum
subject to
for i=1:N
pu1(1,i)<=1;
end
cvx_end
pu=pu1;
k
end
hold on
plot(q1(1,:),q1(2,:),'c');
hold on
for i=1:60
plot(q1(1,:),q1(2,:),'r^');