Why this problem still failed and the result is still NaN after using CVXQUAD?

Hi,
I am trying to use matlab to implement the following algorithm. CVXQUAD has installed and the log formats have been replaced.
However, the following problems appear after the code runs:
(1) The results still indicate that the successive approximation method to be employed…
(2) The status of the output is failed and the optimal value is NAN.

I would really appreciate if anybody has a solution for this.

The algorithm is

The matlab code is
clc
N=2;
p=[0.25;0.25];
p_hor=1e+02;
p_loc=1;
sigma_2=9.99e-10;
order_b=[2;1];% pi_b in the algorithm
order_e=[2;1];% pi_e in the algorithm
H_ub=[2.36e-09;2.51e-09];
H_ue=[2.18e-09;2.47e-09];
iteration=1;
for iteration=1:10
for n=1:N
inter_b(n,1)=sigma_2;
for i=1:N
if order_b(n,1)<order_b(i,1)
inter_b(n,1)=inter_b(n,1)+p(i)*H_ub(i,1);
end
end
s_bu(n,1)=1/inter_b(n,1);
bre_R_b(n,1)=-rel_entr(1,p(n)*H_ub(n,1)+inter_b(n,1))-prod_inv([s_bu(n,1) inter_b(n,1)])-rel_entr(1,s_bu(n,1))+1;
end
for n=1:N
inter_e(n,1)=sigma_2;
for i=1:N
if order_e(n,1)<order_e(i,1)
inter_e(n,1)=inter_e(n,1)+p(i)*H_ue(i,1);
end
end
s_eu(n,1)=1/(inter_e(n,1)+p(n)H_ue(n,1));
bre_R_e(n,1)=rel_entr(1,inter_e(n,1))+prod_inv([s_eu(n,1) (inter_e(n,1)+p(n)*H_ue(n,1))])+rel_entr(1,s_eu(n,1))-1;
end
bre_R_tot=sum(bre_R_b-bre_R_e)/(-rel_entr(1,2));
mu(iteration,1)=bre_R_tot/(sum§+N
(p_loc+p_hor));
cvx_begin
variables p(N)
expressions bre_R_b(N) bre_R_e(N) inter_b(N) inter_e(N)
for n=1:N
inter_b(n,1)=sigma_2;
for i=1:N
if order_b(n,1)<order_b(i,1)
inter_b(n,1)=inter_b(n,1)+p(i)*H_ub(i,1);
end
end
bre_R_b(n,1)=-rel_entr(1,p(n)H_ub(n,1)+inter_b(n,1))-prod_inv([s_bu(n,1) inter_b(n,1)])-rel_entr(1,s_bu(n,1))+1;
end
for n=1:N
inter_e(n,1)=sigma_2;
for i=1:N
if order_e(n,1)<order_e(i,1)
inter_e(n,1)=inter_e(n,1)+p_tran(i)H_ue(i,1);
end
end
bre_R_e(n,1)=rel_entr(1,inter_e(n,1))+prod_inv([s_eu(n,1) (inter_e(n,1)+p(n)*H_ue(n,1))])+rel_entr(1,s_eu(n,1))-1;
end
maximize(sum(bre_R_b-bre_R_e)/(-rel_entr(1,2))-mu(iteration,1)
(sum§+N
(p_loc+p_hor)));
subject to
for n=1:N
bre_R_b(n,1)>=bre_R_e(n,1);
end
for n=1:N
bre_R_b(n,1)>=0;
end
for n=1:N
0<=p(n,1)<=0.25;
end
cvx_end
iteration=iteration+1;
end

The output result is the following statement repeated ten times

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: 44 variables, 16 equality constraints
2 exponentials add 16 variables, 10 equality constraints

Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------
0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Failed
0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Failed
0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Failed

Status: Failed
Optimal value (cvx_optval): NaN

Many thanks!

Did you really install CVXQUAD, including its exponential.m replacement? It appears not.

BTW, it you have Mosek 9.x available, you are better off using that (with CVX 2.2) than CVXQUAD.

Thank you!
(1) Cvxquak should have been installed successfully. Because the test program on the installation website can run through.
The output of the test code is

(2) After I use MOSEK, the result is still wrong. And the value p of the obtained variable becomes Nan. The results are as follows:
Calling Mosek 9.1.9: 44 variables, 16 equality constraints
For improved efficiency, Mosek is solving the dual problem.

MOSEK Version 9.1.9 (Build date: 2019-11-21 11:34:40)
Copyright © MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

MOSEK warning 57: A large value of 8.9e+08 has been specified in c for variable ‘’ (17).
MOSEK warning 57: A large value of 9.2e+08 has been specified in c for variable ‘’ (26).
MOSEK warning 57: A large value of 6.5e+08 has been specified in c for variable ‘’ (35).
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 16
Cones : 11
Scalar variables : 44
Matrix variables : 0
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 1
Eliminator terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries : 2 time : 0.00
Lin. dep. - tries : 1 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.06
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 16
Cones : 11
Scalar variables : 44
Matrix variables : 0
Integer variables : 0

Optimizer - threads : 4
Optimizer - solved problem : the primal
Optimizer - Constraints : 15
Optimizer - Cones : 11
Optimizer - Scalar variables : 43 conic : 33
Optimizer - Semi-definite variables: 0 scalarized : 0
Factor - setup time : 0.00 dense det. time : 0.00
Factor - ML order time : 0.00 GP order time : 0.00
Factor - nonzeros before factor : 42 after factor : 50
Factor - dense dim. : 0 flops : 4.84e+02
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 1.3e+00 9.2e+08 1.7e+09 0.00e+00 1.739636739e+09 0.000000000e+00 1.0e+00 0.08
1 2.3e-01 1.6e+08 7.2e+08 -1.00e+00 1.739634870e+09 1.958923594e+00 1.7e-01 0.20
2 4.7e-02 3.3e+07 3.3e+08 -1.00e+00 1.739634990e+09 7.767070518e-01 3.6e-02 0.20
3 1.3e-02 9.1e+06 1.7e+08 -1.00e+00 1.739634729e+09 5.933894209e-01 9.9e-03 0.20
4 3.5e-03 2.4e+06 9.0e+07 -1.00e+00 1.739633484e+09 4.786774598e-01 2.7e-03 0.22
5 1.4e-03 9.8e+05 5.7e+07 -1.00e+00 1.739631245e+09 4.873041791e-01 1.1e-03 0.22
6 3.5e-04 2.4e+05 2.8e+07 -1.00e+00 1.739617453e+09 4.215964317e-01 2.7e-04 0.22
7 8.2e-05 5.7e+04 1.4e+07 -1.00e+00 1.739562448e+09 4.150796323e-01 6.3e-05 0.23
8 2.0e-05 1.4e+04 6.8e+06 -1.00e+00 1.739316571e+09 3.897041823e-01 1.5e-05 0.23
9 7.3e-06 5.1e+03 4.1e+06 -1.00e+00 1.738848928e+09 3.836330859e-01 5.5e-06 0.25
10 2.0e-06 1.4e+03 2.1e+06 -9.99e-01 1.736197116e+09 3.756365992e-01 1.5e-06 0.25
11 5.6e-07 3.9e+02 1.1e+06 -9.97e-01 1.727932534e+09 4.258384817e-01 4.2e-07 0.25
12 1.7e-07 1.2e+02 6.2e+05 -9.87e-01 1.694931302e+09 6.737993615e-01 1.3e-07 0.27
13 7.4e-08 5.1e+01 3.9e+05 -9.44e-01 1.604502098e+09 1.434002729e+00 5.6e-08 0.27
14 1.8e-08 1.3e+01 1.4e+05 -7.81e-01 1.065666895e+09 6.322385598e+00 1.4e-08 0.27
15 5.7e-09 4.0e+00 4.5e+04 -2.57e-01 5.933495390e+08 1.062393928e+01 4.4e-09 0.27
16 9.4e-10 6.6e-01 3.3e+03 4.68e-01 1.181233401e+08 1.466586977e+01 7.2e-10 0.28
17 1.9e-10 1.3e-01 2.4e+02 1.14e+00 2.145941726e+07 1.353266459e+01 1.4e-10 0.28
18 5.4e-11 3.8e-02 3.8e+01 1.00e+00 6.133213233e+06 1.251443186e+01 4.1e-11 0.30
19 1.1e-11 8.0e-03 3.6e+00 1.03e+00 1.261997255e+06 1.136670384e+01 8.7e-12 0.30
20 4.7e-12 3.3e-03 9.8e-01 9.88e-01 5.216569295e+05 1.048491243e+01 3.6e-12 0.30
21 1.0e-12 7.0e-04 9.6e-02 1.02e+00 1.093234250e+05 9.408715341e+00 7.6e-13 0.31
22 3.1e-13 2.2e-04 1.7e-02 9.91e-01 3.458578265e+04 8.460946048e+00 2.4e-13 0.31
23 7.8e-14 5.4e-05 2.1e-03 9.97e-01 8.548476291e+03 7.513149196e+00 5.9e-14 0.31
24 2.7e-14 1.9e-05 4.5e-04 1.00e+00 3.008375607e+03 6.722503511e+00 2.1e-14 0.33
25 5.9e-15 4.0e-06 4.5e-05 1.02e+00 6.600902253e+02 5.879156903e+00 4.5e-15 0.33
26 1.3e-15 6.5e-07 4.2e-06 1.09e+00 1.403712397e+02 5.270637730e+00 1.0e-15 0.33
27 2.8e-16 5.2e-07 5.2e-07 9.50e-01 3.982845301e+01 5.890211647e+00 2.2e-16 0.34
28 9.1e-17 6.2e-07 1.0e-07 8.79e-01 1.835473970e+01 7.468117665e+00 7.3e-17 0.34
29 8.8e-17 5.9e-07 1.1e-07 -7.18e-02 1.904972663e+01 7.278399280e+00 7.1e-17 0.34
30 4.3e-17 4.9e-07 5.4e-08 6.61e-01 1.572129101e+01 6.930087475e+00 3.3e-17 0.36
31 1.3e-17 5.2e-07 6.3e-09 8.69e-01 8.375007629e+00 6.523832517e+00 9.2e-18 0.36
32 6.9e-18 3.2e-07 3.6e-09 2.25e-01 7.189133834e+00 5.740519910e+00 5.0e-18 0.36
33 1.9e-18 2.6e-07 1.7e-09 3.57e-01 6.327623456e+00 4.902383121e+00 1.5e-18 0.38
34 9.1e-19 2.5e-07 4.0e-10 8.02e-01 5.077227005e+00 4.615224354e+00 7.0e-19 0.38
35 2.6e-19 2.2e-07 1.4e-10 7.27e-01 4.668694890e+00 4.384563659e+00 2.1e-19 0.38
36 8.8e-20 2.3e-07 2.1e-11 8.96e-01 4.399415712e+00 4.329679690e+00 7.1e-20 0.39
37 7.4e-20 2.3e-07 1.5e-11 7.32e-01 4.399514973e+00 4.290964513e+00 2.1e-20 0.39
38 4.0e-20 2.9e-07 3.5e-12 8.48e-01 4.360956434e+00 4.314278185e+00 7.9e-21 0.39
39 3.5e-20 4.5e-07 3.4e-13 3.29e-01 4.324548962e+00 4.317290199e+00 5.1e-21 0.41
40 3.0e-20 3.8e-07 2.7e-13 -1.30e-01 4.332487018e+00 4.322694027e+00 1.6e-21 0.41
41 1.9e-20 3.2e-07 2.4e-13 -9.58e-02 4.332044766e+00 4.320354320e+00 8.0e-22 0.42
42 1.8e-20 2.5e-07 7.3e-14 9.61e-01 4.323150508e+00 4.318997520e+00 4.8e-22 0.42
43 4.9e-20 4.0e-07 3.6e-14 1.61e+00 4.319967690e+00 4.316773073e+00 1.9e-22 0.42
44 4.9e-20 4.0e-07 3.6e-14 -6.19e+00 4.319967690e+00 4.316773073e+00 1.9e-22 0.44
45 4.9e-20 4.0e-07 3.6e-14 -1.81e+00 4.319967690e+00 4.316773073e+00 1.9e-22 0.44
Optimizer terminated. Time: 0.48

Interior-point solution summary
Problem status : ILL_POSED
Solution status : DUAL_ILLPOSED_CER
Primal. obj: 6.6966578906e-09 nrm: 4e+00 Viol. con: 2e-09 var: 0e+00 cones: 0e+00
Optimizer summary
Optimizer - time: 0.48
Interior-point - iterations : 46 time: 0.44
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: Failed
Optimal value (cvx_optval): NaN

错误使用 cvx/geo_mean (第 80 行)
Disciplined convex programming error:
Invalid computation: geo_mean( {mixed real affine/invalid} )

出错 cvx/prod_inv (第 38 行)
geo_mean( cat( dim, x, y ), dim, [ ones(n,1) ; p ] ) >= 1; %#ok

出错 question_v5_p_n (第 48 行)
bre_R_b(n,1)=-rel_entr(1,p(n)*H_ub(n,1)+inter_b(n,1))-prod_inv([s_bu(n,1) inter_b(n,1)])-rel_entr(1,s_bu(n,1))+1;

I would really appreciate if anybody has a solution for this.

The CVQUAD test doesn’t test that the exponential.m replacement is installed.

Mosek warns about large input data values. Fix that (numerical scaling() before trying to re-run. I don’t know whether that will resolve the ill-posedness it reports.

After one CVX problem fails, the variable values are NaN, so can’t be used as input data into a subsequent CVX problem.

I suspect your attempt at SCA, or whatever you are doing, is doomed to failure.

Thank you very much for your patience. I’m sorry I’m still confused.
(1) Why use Mosek or not, the output result is different. When not using Mosek, the output of the objective function value is NAN, but the obtained variable value is correct. However, after using Mosek, all the results are NAN, and an error is reported. I don’t even know the cause of the mistake
(2) You think my attempt at SCA is wrong. However, I have installed and replaced the files according to the requirements of the official website, so there should be no problem with the installation of cvxquad. :sob: :sob: :sob:

Use Mosek, rather than CVXQUAD.

If CVX fails, all variable values are meaningless, whether or not they happen to be “correct”.

Crude SCA on complicated problems is more lkelly to fail than to succeed.

Thank you very much! I’ll try numerical scaling