SOCP problem (Inf)

For K=4 is:

Calling Mosek 9.1.9: 64 variables, 20 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

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 20
Cones : 8
Scalar variables : 64
Matrix variables : 0
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 12
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.01
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 20
Cones : 8
Scalar variables : 64
Matrix variables : 0
Integer variables : 0

Optimizer - threads : 2
Optimizer - solved problem : the primal
Optimizer - Constraints : 8
Optimizer - Cones : 8
Optimizer - Scalar variables : 37 conic : 24
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 : 30 after factor : 36
Factor - dense dim. : 0 flops : 1.21e+03
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 2.1e+03 1.0e+00 5.0e+00 0.00e+00 3.999999999e+00 0.000000000e+00 1.0e+00 0.03
1 4.2e+02 2.1e-01 2.3e+00 -1.00e+00 3.489184090e+01 3.475514166e+01 2.1e-01 0.11
2 6.4e+00 3.1e-03 2.7e-01 -9.99e-01 2.456907881e+03 2.759602904e+03 3.1e-03 0.11
3 2.5e+00 1.2e-03 1.1e-01 -6.29e-01 2.961566040e+03 3.289942369e+03 1.2e-03 0.13
4 7.2e-01 3.5e-04 6.6e-03 8.91e-01 3.687174249e+02 3.821668227e+02 3.5e-04 0.13
5 1.5e-02 7.2e-06 1.5e-05 8.82e-01 1.349584536e+01 1.366382578e+01 7.2e-06 0.13
6 1.5e-03 7.3e-07 5.0e-07 9.97e-01 1.121759579e+00 1.139418848e+00 7.3e-07 0.13
7 3.7e-04 1.8e-07 8.4e-08 9.44e-01 2.028347410e-01 2.112164291e-01 1.8e-07 0.13
8 1.6e-04 7.6e-08 4.2e-08 6.14e-01 -5.611895934e-03 6.162667195e-03 7.6e-08 0.14
9 5.0e-05 2.5e-08 4.1e-08 -5.69e-01 3.851600474e-02 1.506923689e-01 2.5e-08 0.14
10 4.2e-07 2.0e-10 3.0e-09 -8.70e-01 -8.648531627e+00 -2.043526746e-02 2.0e-10 0.14
11 9.2e-12 6.0e-16 4.9e-12 -1.00e+00 -4.314686594e+06 -5.007240355e-03 6.0e-16 0.14
12 6.7e-12 7.7e-26 1.2e-06 -1.00e+00 -4.797211025e+17 5.887369227e-02 5.4e-27 0.14
13 4.4e-16 2.0e-34 6.3e-07 -1.00e+00 -2.277260209e-05 1.856546390e-36 3.3e-38 0.16
Optimizer terminated. Time: 0.19

Interior-point solution summary
Problem status : DUAL_INFEASIBLE
Solution status : DUAL_INFEASIBLE_CER
Primal. obj: -2.2772602094e-05 nrm: 5e+00 Viol. con: 1e-16 var: 0e+00 cones: 0e+00
Optimizer summary
Optimizer - time: 0.19
Interior-point - iterations : 13 time: 0.16
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

Calling Mosek 9.1.9: 64 variables, 20 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

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 20
Cones : 8
Scalar variables : 64
Matrix variables : 0
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 12
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.02
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 20
Cones : 8
Scalar variables : 64
Matrix variables : 0
Integer variables : 0

Optimizer - threads : 2
Optimizer - solved problem : the primal
Optimizer - Constraints : 8
Optimizer - Cones : 8
Optimizer - Scalar variables : 38 conic : 24
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 : 30 after factor : 36
Factor - dense dim. : 0 flops : 1.23e+03
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 2.0e+03 1.0e+00 5.0e+00 0.00e+00 3.999999999e+00 0.000000000e+00 1.0e+00 0.03
1 2.0e+02 1.0e-01 1.6e+00 -1.00e+00 7.647890192e+01 8.152497775e+01 1.0e-01 0.11
2 1.2e+01 6.1e-03 4.0e-01 -1.01e+00 1.389113443e+03 1.558307536e+03 6.1e-03 0.11
3 4.2e+00 2.1e-03 2.0e-01 -9.39e-01 3.013145455e+03 3.375630931e+03 2.1e-03 0.11
4 1.2e+00 6.0e-04 1.7e-02 2.65e-01 7.699566843e+02 7.997409709e+02 6.0e-04 0.13
5 4.4e-02 2.2e-05 1.2e-04 8.52e-01 4.599406013e+01 4.710424765e+01 2.2e-05 0.13
6 2.0e-03 9.5e-07 1.1e-06 1.01e+00 1.756029215e+00 1.805799525e+00 9.5e-07 0.13
7 5.4e-04 2.6e-07 1.8e-07 9.64e-01 3.941271448e-01 4.127584396e-01 2.6e-07 0.13
8 2.3e-04 1.1e-07 8.4e-08 6.93e-01 9.719110882e-02 1.181670109e-01 1.1e-07 0.13
9 7.9e-05 3.9e-08 4.8e-08 2.10e-02 -6.674364447e-02 -6.106879691e-03 3.9e-08 0.14
10 7.9e-06 3.8e-09 2.1e-08 -7.69e-01 -9.173839321e-01 2.943215900e-01 3.8e-09 0.14
11 6.6e-09 3.2e-12 6.7e-10 -9.71e-01 -1.695090715e+03 2.153842909e-01 3.2e-12 0.14
12 1.3e-12 2.4e-21 2.3e-09 -1.00e+00 -3.333588670e+12 2.815891528e-01 2.1e-21 0.14
13 6.1e-16 5.7e-29 6.3e-10 -1.00e+00 -3.354470605e-05 2.151783749e-29 1.5e-32 0.14
Optimizer terminated. Time: 0.20

Interior-point solution summary
Problem status : DUAL_INFEASIBLE
Solution status : DUAL_INFEASIBLE_CER
Primal. obj: -3.3544706051e-05 nrm: 5e+00 Viol. con: 4e-16 var: 0e+00 cones: 0e+00
Optimizer summary
Optimizer - time: 0.20
Interior-point - iterations : 13 time: 0.16
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

Calling Mosek 9.1.9: 64 variables, 20 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

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 20
Cones : 8
Scalar variables : 64
Matrix variables : 0
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 12
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.01
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 20
Cones : 8
Scalar variables : 64
Matrix variables : 0
Integer variables : 0

Optimizer - threads : 2
Optimizer - solved problem : the primal
Optimizer - Constraints : 8
Optimizer - Cones : 8
Optimizer - Scalar variables : 39 conic : 24
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 : 30 after factor : 36
Factor - dense dim. : 0 flops : 1.25e+03
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 4.1e+03 1.0e+00 5.0e+00 0.00e+00 3.999999999e+00 0.000000000e+00 1.0e+00 0.03
1 8.9e+02 2.2e-01 2.3e+00 -1.00e+00 3.289314572e+01 3.250431342e+01 2.2e-01 0.11
2 3.2e+01 7.7e-03 4.4e-01 -1.00e+00 1.038433273e+03 1.163726966e+03 7.7e-03 0.11
3 5.9e+00 1.4e-03 1.8e-01 -9.89e-01 5.159805696e+03 5.797832473e+03 1.4e-03 0.13
4 4.6e+00 1.1e-03 1.2e-01 -2.98e-01 4.212379401e+03 4.693849001e+03 1.1e-03 0.13
5 1.1e+00 2.6e-04 1.0e-02 1.61e-01 1.340794765e+03 1.405991232e+03 2.6e-04 0.13
6 2.9e-02 7.1e-06 2.8e-05 1.04e+00 2.540933978e+01 2.601387180e+01 7.1e-06 0.13
7 1.1e-03 2.6e-07 2.0e-07 9.92e-01 7.271565039e-01 7.514993923e-01 2.6e-07 0.13
8 2.9e-04 7.1e-08 4.4e-08 7.83e-01 1.073151128e-01 1.224259516e-01 7.1e-08 0.14
9 1.1e-04 2.6e-08 2.7e-08 1.39e-01 -2.316431313e-01 -1.902874990e-01 2.6e-08 0.14
10 3.1e-05 7.5e-09 2.7e-08 -1.11e+00 -1.044117911e-01 4.085748749e-01 7.5e-09 0.14
11 3.3e-07 7.9e-11 3.2e-09 -9.30e-01 -6.440088417e+01 1.404938297e-01 7.9e-11 0.14
12 7.1e-12 1.4e-16 3.5e-12 -1.00e+00 -4.848553654e+07 9.543055920e-02 1.4e-16 0.14
13 8.9e-16 3.0e-22 1.2e-13 -1.00e+00 -2.798119361e-05 -7.418926886e-22 6.4e-26 0.16
Optimizer terminated. Time: 0.19

Interior-point solution summary
Problem status : DUAL_INFEASIBLE
Solution status : DUAL_INFEASIBLE_CER
Primal. obj: -2.7981193614e-05 nrm: 4e+00 Viol. con: 9e-16 var: 0e+00 cones: 0e+00
Optimizer summary
Optimizer - time: 0.19
Interior-point - iterations : 13 time: 0.16
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

Calling Mosek 9.1.9: 64 variables, 20 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

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 20
Cones : 8
Scalar variables : 64
Matrix variables : 0
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 12
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.03
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 20
Cones : 8
Scalar variables : 64
Matrix variables : 0
Integer variables : 0

Optimizer - threads : 2
Optimizer - solved problem : the primal
Optimizer - Constraints : 8
Optimizer - Cones : 8
Optimizer - Scalar variables : 39 conic : 24
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 : 30 after factor : 36
Factor - dense dim. : 0 flops : 1.25e+03
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 2.0e+03 1.0e+00 5.0e+00 0.00e+00 3.999999999e+00 0.000000000e+00 1.0e+00 0.05
1 4.7e+02 2.3e-01 2.4e+00 -1.00e+00 3.090231028e+01 3.026664741e+01 2.3e-01 0.11
2 2.7e+01 1.3e-02 5.7e-01 -9.99e-01 6.042820253e+02 6.753280293e+02 1.3e-02 0.13
3 5.7e+00 2.8e-03 2.4e-01 -9.63e-01 2.494849957e+03 2.799521293e+03 2.8e-03 0.13
4 2.0e+00 9.6e-04 4.8e-02 -1.87e-01 1.232604933e+03 1.328474929e+03 9.6e-04 0.13
5 1.8e-01 8.7e-05 6.4e-04 9.59e-01 7.631945957e+01 7.830488723e+01 8.7e-05 0.13
6 2.3e-03 1.1e-06 9.3e-07 9.95e-01 7.712125581e-01 7.966768361e-01 1.1e-06 0.13
7 4.9e-04 2.4e-07 1.2e-07 9.24e-01 8.373087182e-02 9.271771266e-02 2.4e-07 0.14
8 1.7e-04 8.4e-08 5.1e-08 5.01e-01 -5.303744824e-02 -3.864991414e-02 8.4e-08 0.14
9 6.6e-05 3.2e-08 5.9e-08 -7.18e-01 -6.373066057e-02 6.807796958e-02 3.2e-08 0.14
10 3.3e-06 1.6e-09 1.5e-08 -9.14e-01 -3.295441664e+00 2.778770100e-02 1.6e-09 0.14
11 6.0e-10 2.9e-13 2.1e-10 -9.99e-01 -2.160862517e+04 2.240251523e-02 2.9e-13 0.14
12 6.0e-12 2.9e-17 7.2e-12 -1.00e+00 -2.160864524e+08 2.240251404e-02 2.9e-17 0.14
13 4.4e-16 8.8e-24 5.3e-12 -1.00e+00 -2.973626571e-05 -6.295271740e-24 1.5e-27 0.16
Optimizer terminated. Time: 0.19

Interior-point solution summary
Problem status : DUAL_INFEASIBLE
Solution status : DUAL_INFEASIBLE_CER
Primal. obj: -2.9736265708e-05 nrm: 5e+00 Viol. con: 4e-16 var: 0e+00 cones: 0e+00
Optimizer summary
Optimizer - time: 0.19
Interior-point - iterations : 13 time: 0.16
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

Calling Mosek 9.1.9: 64 variables, 20 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

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 20
Cones : 8
Scalar variables : 64
Matrix variables : 0
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 12
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.03
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 20
Cones : 8
Scalar variables : 64
Matrix variables : 0
Integer variables : 0

Optimizer - threads : 2
Optimizer - solved problem : the primal
Optimizer - Constraints : 8
Optimizer - Cones : 8
Optimizer - Scalar variables : 37 conic : 24
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 : 30 after factor : 36
Factor - dense dim. : 0 flops : 1.21e+03
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 4.1e+03 1.0e+00 5.0e+00 0.00e+00 3.999999999e+00 0.000000000e+00 1.0e+00 0.05
1 7.4e+02 1.8e-01 2.1e+00 -1.00e+00 4.021455501e+01 4.074104643e+01 1.8e-01 0.13
2 8.8e+00 2.1e-03 2.3e-01 -1.00e+00 3.824882888e+03 4.298446759e+03 2.1e-03 0.13
3 5.1e+00 1.2e-03 1.2e-01 -5.77e-01 3.197312157e+03 3.543528450e+03 1.2e-03 0.14
4 9.1e-01 2.2e-04 4.8e-03 3.14e-01 7.285668954e+02 7.466560613e+02 2.2e-04 0.14
5 6.1e-03 1.5e-06 3.7e-06 1.04e+00 1.614259897e+00 1.862345493e+00 1.5e-06 0.14
6 1.0e-03 2.4e-07 2.7e-07 9.68e-01 5.599521465e-02 1.030623332e-01 2.4e-07 0.14
7 3.2e-04 7.8e-08 6.1e-08 8.06e-01 -1.205951131e-01 -9.601444103e-02 7.8e-08 0.14
8 1.3e-04 3.2e-08 4.8e-08 -1.95e-02 -3.479457240e-01 -2.578208521e-01 3.2e-08 0.16
9 1.5e-05 3.8e-09 2.3e-08 -1.12e+00 -1.660984157e+00 -1.108089176e-01 3.8e-09 0.16
10 3.5e-08 8.6e-12 1.3e-09 -9.97e-01 -9.491586013e+02 -8.309536659e-02 8.6e-12 0.16
11 3.1e-12 7.3e-20 6.2e-10 -1.00e+00 -1.558862304e+11 -4.713933300e-02 7.2e-20 0.16
12 1.3e-12 2.4e-30 2.3e-04 -1.00e+00 -3.666626817e+22 -1.943671060e-01 2.6e-31 0.16
13 2.2e-16 5.7e-39 1.2e-04 -1.00e+00 -4.145173052e-05 -7.907352072e-40 1.5e-42 0.17
Optimizer terminated. Time: 0.19

Interior-point solution summary
Problem status : DUAL_INFEASIBLE
Solution status : DUAL_INFEASIBLE_CER
Primal. obj: -4.1451730523e-05 nrm: 7e+00 Viol. con: 4e-16 var: 0e+00 cones: 0e+00
Optimizer summary
Optimizer - time: 0.19
Interior-point - iterations : 13 time: 0.17
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

opt_finded =

NaN

Are you running the exact same problem over again for K = 2, in which some runs are infeasible, and some return an optimal solution? Perhaps there is something you are not showing us, such as random numbers being used to generate input data for the problem, and different random numbers are being used in different runs?

Yes, i run the exact same problem for K=2, where some of them are infeasible, and some return an optimal solution.
H_tilda is a random matrix with the dimension of K*M (It is a Rician fading channel). and ‘w’ is

w = zeros(size(H_tilda’));
for k = 1:K
C= (H_tilda(k,:)*D(:,:,k))’;
w(:,k) = C/norm( C );
end

The rest of the variables are either constant or optimization variables.

If H_tilde is a random matrix, then you are NOT running the exact same problem. Apparently, for K = 2, some random problem instances are feasible and solved to optimality, and some are not. I suggest you put more effort into understanding your problem, including into how the inputs affect feasibility.

Consider the following problem. Half the time it is feasible, the other half it is not.

u = rand(1);
cvx_begin
variable x
minimize(x)
0.5 <= x <= u
cvx_end

Well the same thing can happen in more complicated problems.

Such a great example! Thank you.
I found something when i remove this constraint ’ z(i)+gamma*(p0+sigma_1)==(1+gamma)*(p(i)*abs(H_tilda(i,: )*w(:,i))^2)’ it works for K=4. After obtaining the solutions, i replace them one by one into this constraint, which yields negative z for each of them! However, it should not be negative.
I test it on K=1. It gave me nonnegative ‘z(1),’ but for K=4, it always provides negative z(i)!
Could you please help me to get rid of this negativity.

I mean that “z(i) =(1+gamma)*(p(i)*abs(H_tilda(i,: ) w(:,i))^2)-gamma (p0+sigma_1)”; it must hold true that z(i) ≥ 0. for K=1, it holds but for K=4, it does not

If you want z to be >= 0, then include the constraint z >= 0 or declare z to be nonnegative, which you show in your first post.

If that makes the problem infeasible, then you need to determine whether your model is appropriate.

If the problem is feasible, the optimal z might be slightly negative due to solver tolerance. To prevent that, you can specify the constraint z >= 1e-6. Or you can just reset a small negative value to 0 after CVX concludes.

Thank you so much, i have to check my model.