AT0=AT_k;
BT0=BT_k;
A=[(A_m.*A_m);2];
xi1=zeros(K,1);
lamda_k=zeros(K,1);
e_k=zeros(K,M+1);
for k=1:K
Vm_k=V(:,:,k);
[x y]=eig(Vm_k);
eigenvalue=diag(y);
lamda_k(k,:)=max(eigenvalue);
for i=1:length(Vm_k)
if lamda_k(k,:)==eigenvalue(i)
break;
end
end
e_k(k,:)=x(:,i)';
end
[~,R_sum] = SINR_generate(K,N,M,H_r,H_t,h_k,f_k,G,w_k,sigma1,sigma2,v,lamda_k);
Rt_k=R_sum;
for k=1:K
v1=V(:,:,k);
v0=real(e_k(k,:)*v1*e_k(k,:)')/real(trace(v1))+delta;
xi1(k,:)=min(1,v0);
end
fprintf("优化之前的xi1\n");
disp(xi1);
fprintf("V求解\n");
cvx_begin %quiet % sdp
% cvx_solver sedumi %mosek %sedumi %
% cvx_precision low
variables V(M+1,M+1,K) semidefinite ;
variables AT0(K,1) BT0(K,1) Rt_k(K,1) nonnegative;
maximize sum(Rt_k)
subject to
sum0=0;
inv_pos(AT0)<=inv_pos(AT_k);
BT0>=BT_k;
for k=1:K
v1=V(:,:,k);
g1=Gb_k(:,:,k);
sum0=sum0+real(trace(v1*g1));
diag(v1)<=A;
real(e_k(k,:)*v1*e_k(k,:)')>=real(xi(k,:)*trace(v1));
end
sum0<=P_out;
for k=1:K
AT_k0=AT0_k(k,:);
BT_k0=BT0_k(k,:);
RBT_k=log2(1+1/(AT_k0*BT_k0))-(AT0(k,:)-AT_k0)/(AT_k0*log(2)*(1+BT_k0*BT_k0))-(BT0(k,:)-BT_k0)/(AT_k0*log(2)*(1+AT_k0*BT_k0));
RBT_k >= Rt_k(k,:);
end
Rt_k>=R_kmin;
cvx_end
for k=1:K
v1=V(:,:,k);
v0=abs(real(e_k(k,:)*v1*e_k(k,:)'/trace(v1))+delta);
xi1(k,:)=min(1,v0);
end
% fprintf("优化之后的xi1\n");
% disp(xi1);
xi=xi1;
AT0_k=AT0;
BT0_k=BT0;
end
The result is failed.
V求解
Calling SDPT3 4.0: 858 variables, 9 equality constraints
num. of constraints = 9
dim. of socp var = 6, num. of socp blk = 2
dim. of linear var = 14
dim. of free var = 838
6 linear variables from unrestricted variable.
*** convert ublk to linear blk
*** convert ublk to linear blk
SDPT3: homogeneous self-dual path-following algorithms
version predcorr gam expon
NT 1 0.000 1
it pstep dstep pinfeas dinfeas gap mean(obj) cputime kap tau theta
0|0.000|0.000|9.0e-01|3.1e+01|3.9e+03| 1.000000e+00| 0:0:00|3.9e+03|1.0e+00|1.0e+00| chol 1 1
1|0.160|0.160|1.0e+00|3.1e+01|4.4e+03|-7.990017e+01| 0:0:00|3.7e+03|1.0e+00|9.8e-01| chol 1 1
2|0.114|0.114|7.8e-01|2.4e+01|3.2e+03|-6.945866e+02| 0:0:00|2.2e+03|1.3e+00|1.0e+00| chol 1 1
3|1.000|1.000|5.4e-01|1.9e+01|5.4e+03|-1.008853e+03| 0:0:00|8.1e+02|8.2e-01|5.0e-01| chol 1 1
4|0.778|0.778|1.9e-01|6.8e+00|2.8e+03|-2.601282e+02| 0:0:00|4.5e+02|5.5e-01|1.2e-01| chol 1 1
5|0.497|0.497|2.5e-01|8.8e+00|5.0e+03|-3.200046e+02| 0:0:00|3.4e+02|4.1e-01|1.1e-01| chol 1 1
6|0.999|0.999|6.9e-02|2.4e+00|1.8e+03|-8.578794e+01| 0:0:00|7.8e+01|3.2e-01|2.4e-02| chol 1 1
7|1.000|1.000|1.0e-01|3.5e+00|5.4e+03|-9.983627e+01| 0:0:00|4.0e+01|1.6e-01|1.8e-02| chol 1 1
8|0.866|0.866|2.2e-02|7.6e-01|1.3e+03|-1.777076e+01| 0:0:00|9.3e+00|1.4e-01|3.5e-03| chol 1 1
9|1.000|1.000|3.6e-02|1.2e+00|4.8e+03|-3.035136e+01| 0:0:00|5.3e+00|6.3e-02|2.5e-03| chol 1 1
10|0.822|0.822|8.9e-03|3.1e-01|1.2e+03|-4.648180e+00| 0:0:00|9.1e-01|6.6e-02|6.5e-04| chol 1 1
11|0.614|0.614|2.9e-02|1.0e+00|1.5e+04|-9.072363e+00| 0:0:00|1.0e+00|1.7e-02|5.6e-04| chol 1 1
12|0.970|0.970|8.6e-03|3.0e-01|3.8e+03| 8.553941e-01| 0:0:00|4.6e-02|2.0e-02|1.9e-04| chol 1 1
13|0.806|0.806|2.9e-03|1.0e-01|6.9e+02| 8.443095e-01| 0:0:00|2.8e-03|3.7e-02|1.2e-04| chol 1 1
14|1.000|1.000|1.6e-03|5.9e-02|3.9e+02| 2.681166e+00| 0:0:00|1.5e-02|3.6e-02|6.6e-05| chol 1 1
15|1.000|1.000|7.3e-04|2.7e-02|1.6e+02| 3.235835e+00| 0:0:00|7.0e-03|4.0e-02|3.2e-05| chol 1 1
16|1.000|1.000|3.8e-04|1.5e-02|7.6e+01| 2.799033e+00| 0:0:00|3.0e-03|4.3e-02|1.8e-05| chol 1 1
17|1.000|1.000|3.4e-04|1.3e-02|1.1e+02| 4.288945e+00| 0:0:00|3.1e-03|2.7e-02|1.0e-05| chol 1 1
18|1.000|1.000|1.3e-04|5.8e-03|4.3e+01| 3.864069e+00| 0:0:00|1.8e-03|2.7e-02|3.9e-06| chol 1 1
19|1.000|1.000|1.4e-04|6.2e-03|8.2e+01| 5.703108e+00| 0:0:00|1.4e-03|1.6e-02|2.3e-06| chol 1 1
20|0.982|0.982|6.7e-05|2.8e-03|3.2e+01| 5.019983e+00| 0:0:00|9.1e-04|1.4e-02|7.4e-07| chol 1 1
21|1.000|1.000|2.0e-04|2.7e-03|4.7e+01| 6.233447e+00| 0:0:00|5.8e-04|9.3e-03|4.7e-07| chol 1 1
22|0.958|0.958|9.4e-04|1.7e-03|2.7e+01| 5.698263e+00| 0:0:00|3.8e-04|7.5e-03|1.8e-07| chol 1 1
23|1.000|1.000|1.3e-03|1.4e-03|2.7e+01| 6.069299e+00| 0:0:00|2.3e-04|5.2e-03|8.5e-08| chol 1 1
24|0.995|0.995|6.0e-03|1.1e-03|2.3e+01| 6.340537e+00| 0:0:00|1.6e-04|3.6e-03|3.4e-08| chol 1 1
25|0.999|0.999|2.9e-02|8.9e-04|2.2e+01| 6.932199e+00| 0:0:00|1.0e-04|2.4e-03|1.4e-08| chol 1 1
26|0.987|0.987|2.1e-01|7.4e-04|1.9e+01| 7.643448e+00| 0:0:00|6.7e-05|1.5e-03|5.9e-09| chol 1 1
27|1.000|1.000|7.6e-01|6.3e-04|1.7e+01| 8.157054e+00| 0:0:00|4.1e-05|1.0e-03|2.2e-09| chol 1 1
28|1.000|1.000|8.8e-01|5.6e-04|2.1e+01| 1.007636e+01| 0:0:00|2.7e-05|5.9e-04|9.3e-10| chol 1 1
29|1.000|1.000|7.7e+00|4.9e-04|1.9e+01| 1.130303e+01| 0:0:00|1.7e-05|3.7e-04|3.4e-10| chol 1 1
stop: primal infeas has deteriorated too much, 8.4e+01 1, 0, 0
30|1.000|1.000|7.7e+00|4.9e-04|1.9e+01| 1.130303e+01| 0:0:00|1.7e-05|3.7e-04|3.4e-10|
number of iterations = 30
primal objective value = 7.86905553e-01
dual objective value = 3.11215418e+01
gap := trace(XZ) = 5.16e+01
relative gap = 3.04e+00
actual relative gap = -9.22e-01
rel. primal infeas = 1.54e+00
rel. dual infeas = 4.12e-01
norm(X), norm(y), norm(Z) = 3.6e+06, 1.3e+07, 1.3e+07
norm(A), norm(b), norm© = 6.3e+01, 1.2e+01, 1.4e+00
Total CPU time (secs) = 0.40
CPU time per iteration = 0.01
termination code = -7
DIMACS: 1.5e+00 0.0e+00 4.1e-01 0.0e+00 -9.2e-01 1.6e+00
Status: Failed
Optimal value (cvx_optval): NaN
And I can not find the reason why it is failed.
You have not provided all the input data to make the problem reproducible. have you tired other solvers, such as Mosek, which is commented out?
Also, I believe you need to declare semidefinite and nonnegative one at a time using variable
, not variables
. I think you are declaring semidefinite
and nonnegative
as variables, not constraining your declared variables as you intended. So fix this problem first. Then re-try.
The one limitation of the variables command is that it cannot declare complex, integer, or structured variables. These must be declared one at a time, using the singular variable command.
I have modified the code and use mosek to solve it. But the result is still infeasible. The code pasted is a part of the whole program and I have the input data below. The output is the process of mosek.
初始化A_k
1.0e+07 *
0.7704
3.6352
B_k
1.0e-07 *
0.1000
0.5101
iterV:1
AT_k
1.0e+07 *
0.3518
3.4580
BT_k
1.0e-07 *
0.1000
0.1876
V求解
Calling Mosek 9.1.9: 527 variables, 57 equality constraints
MOSEK Version 9.1.9 (Build date: 2019-11-21 11:34:40)
Copyright © MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 57
Cones : 2
Scalar variables : 65
Matrix variables : 2
Integer variables : 0
Optimizer started.
Presolve started.
Eliminator - tries : 0 time : 0.00
Lin. dep. - tries : 0 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.00
Optimizer terminated. Time: 0.11
Interior-point solution summary
Problem status : PRIMAL_INFEASIBLE
Solution status : PRIMAL_INFEASIBLE_CER
Dual. obj: 4.7175148767e-01 nrm: 1e+07 Viol. con: 0e+00 var: 7e-24 barvar: 0e+00 cones: 0e+00
Optimizer summary
Optimizer - time: 0.11
Interior-point - iterations : 0 time: 0.03
Basis identification - time: 0.00
Primal - iterations : 0 time: 0.00
Dual - iterations : 0 time: 0.00
Clean primal - iterations : 0 time: 0.00
Clean dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 0 time: 0.00
Status: Infeasible
Optimal value (cvx_optval): -Inf
Did you change ‘variables’ to individual `variable’ statements?
You should change the scaling of input data so that it is close to 1 in magnitude, not 1e-7.
If it’s still infeasible, follow the advice at https://yalmip.github.io/debugginginfeasible , all of which, except for section 1, also applies to CVX.
Yes,I have modified the code as you advised.
variable V(M+1,M+1,K) semidefinite ;
variable AT0(K,1) nonnegative;
variable BT0(K,1) nonnegative;
variable Rt_k(K,1) nonnegative;
But I want to know how to achieve the scaling of input data, just achieved by normalizing or standardizing real-valued input and output variables?
Change the units …
Thanks for your response. I will have a try.