"produces a value that might be unsused" error on matlab

Hi I wrote this code on matlab:

                   cvx_begin sdp 
                        variable W_1(M(mm),M(mm)) complex hermitian semidefinite; 
                        variable W_2(M(mm),M(mm)) complex hermitian semidefinite;
                        maximize eta*real((trace(H_01*W_1)+trace(H_01*W_2)));
                        subject to
                            real((trace(W_1) + trace(W_2))) < P_w_max;
                            real((trace(H_cu_1*W_2) + sigma2_w)) < real(trace(H_cu_1*W_1))/saai_w(1);
                            real((trace(H_cu_2*W_1) + sigma2_w)) < real(trace(H_cu_2*W_2))/saai_w(2);
                    cvx_end

there is an error on Matlab on my constraints.the error says: ‘<’ produces a value that might be unused. and also when i check my constraints after the end of cvx, the last two are false.

Please provide a reproducible problem if possible (with as small matrices as possible to illustrate any errors or issues you encountered).

Is what you call the error says: ‘<’ produces a value that might be unused, displayed when the program is executed, or is that just a warning message in the MATLAB editor? If the latter, you can ignore it because the MATLAB editor doesn’t understand CVX syntax.

Please show all solver and CVX output, as well as evidence that constraints are not satisfied (presumably by more than the solver tolerance).

1 Like

sorry if the reply is so long.
No it is just a warning. it is not a matter of warning now but after cvx ending i checked the constraints and they are not true.
for example if you enter these channels and variables in Matlab:
H_01 , H_cu_1 and H_cu_2 is the product of channel vector to it’s hermitian. and W_1 and W_2 should be psd matrix.
H_01 =

   1.0e-06 *

   0.3326 + 0.0000i   0.1604 + 0.2913i  -0.1778 + 0.2811i
   0.1604 - 0.2913i   0.3326 - 0.0000i   0.1604 + 0.2913i
  -0.1778 - 0.2811i   0.1604 - 0.2913i   0.3326 + 0.0000i

and

H_cu_1 =

   1.0e-11 *

   0.2748 + 0.0000i   0.0961 + 0.2575i  -0.2077 + 0.1800i
   0.0961 - 0.2575i   0.2748 - 0.0000i   0.0961 + 0.2575i
  -0.2077 - 0.1800i   0.0961 - 0.2575i   0.2748 - 0.0000i
H_cu_2 =

   1.0e-11 *

   0.1632 + 0.0000i  -0.1605 + 0.0295i   0.1525 - 0.0580i
  -0.1605 - 0.0295i   0.1632 + 0.0000i  -0.1605 + 0.0295i
   0.1525 + 0.0580i  -0.1605 - 0.0295i   0.1632 - 0.0000i
P_w_max =

     1
sigma2_w =

   1.0000e-13
eta =

    0.5000

saai_w(ii)

ans =

    3.1623

then if you check the second constraint and third one:

real((trace(H_cu_1*W_2) + sigma2_w))

ans =

   2.3679e-12

real(trace(H_cu_1*W_1))/saai_w(ii)

ans =

   6.1805e-13

you will see that second constraint is not true because :
real((trace(H_cu_1*W_2) + sigma2_w)) < real(trace(H_cu_1*W_1))/saai_w(ii);
is not true. the third one is just like the second one.
Matlab says that cvx is solved but when i check my constraint is not true.

That constraint is satisfied to within solver tolerance because 2.3679e-12 <= 6.1805e-13 to within solver tolerance, even though it it is not true in exact arithmetic. Also note that all inequalities in CVX and the solvers which it calls are treated as being non-strict; so < is really treated as being <=, and even that only to within solver tolerance.

1 Like

i can’t understand how it is true. is there any way that it becomes true in exact arithmetic?? or there is nothing to do?
for the second part you are true. i forgot to add ‘=’ here but in my code is true.

You can include a buffer yourself. If you want to make sure LHS < RHS, then choose a (small, but not too small) value such as small_number = 1e-5, and specify the constraint
LHS + small_number <= RHS

1 Like

thank you so much. you really helped me on this problem. thank you

sorry again. if you look at my first question in cvx problem. i paste it here:

cvx_begin sdp 
                        variable W_1(M(mm),M(mm)) complex hermitian semidefinite; 
                        variable W_2(M(mm),M(mm)) complex hermitian semidefinite;
                        maximize eta*real((trace(H_01*W_1)+trace(H_01*W_2)));
                        subject to
                            real((trace(W_1) + trace(W_2))) < P_w_max;
                            real((trace(H_cu_1*W_2) + sigma2_w)) < real(trace(H_cu_1*W_1))/saai_w(1);
                            real((trace(H_cu_2*W_1) + sigma2_w)) < real(trace(H_cu_2*W_2))/saai_w(2);
cvx_end

i use a for loop in Matlab for saai_w in the cvx. but for each loop when saai_w change, my optimal value doesn’t change in the program so my plot is like a horizontal line. this could be for the small value in the cvx solver?? or there is something else??

The H_01, H_cu1, and H_cu2 matrices are essentially just matrices of zeros resulting in optimal objective value of approximately zero regardless of whatever values are used for W_1 and W_2 within their constraints. So with that input data, your program may just be an exercise in dancing with noise, with no real substance; and the values of saai_w may be irrelevant within a very wide range of values.

1 Like

i try to product a big number in two sides of my constraints like 10^6 or higher but in some loops it gives me a NAN or -INF answer. and also i am sure that i simulate channel like what article says.

Having big numbers, such as 10^6 or higher in your problem is usually a bad thing, and may cause difficulties for thew solver, or unreliable solutions. Numbers of magnitude < 10^(-6) are also usually bad.

If you put in junky inputs, you should expect junky, if any, outputs. I haven’t seen the article, so I will draw no conclusions about it, but many articles are full of poor models and solutions, or omit details critical to successful employment.

1 Like

I did this in Matlab for my constraints:
10^10*real((trace(H_cu_1*W_2) + sigma2_w)) <= 10^10*real(trace(H_cu_1*W_1))/saai_w(ii);

and

10^10*real((trace(H_cu_2*W_1) + sigma2_w)) <= 10^10*real(trace(H_cu_2*W_2))/saai_w(ii);

as you say to solve the small numbers problem in Matlab. then in some case that our problem is infeasible i put my rate equals to zero and i think it becomes true.
about the article as i see the model is good but as you mentioned maybe they omit or change some variables for better response. if you want i can send article for you.
thank you so much

I don’t know if everything cancels out if you multiply as you have done, because certain intermediate calculations might get “screwed up”. I suggest you change units on everything to make all numbers “nice” before using them in CVX.

1 Like

this suggestion is also great. i will do it. thanks and sorry for late reply