(Xxx Xxx) #1

Dear experts,
I am new with CVX and cannot understand the point:
Here is my original problem(about communication channel capacity):
I have to find the Best S(matrix) to maximize 𝑙𝑜𝑔|𝑰+𝑯𝑺𝑯^𝐻 |
subject to trace(GSG^𝐻)>=specific value (4.8933e-04W)
trace(S)<=1(transmit power W)
S>=0(semidefinite matrix)
(*G and H matrix are channels)

Hre is my code:

``````s_p3 = randn(4,4);
nRx =4;nTx = 1
H_p3 = 1/sqrt(2)*sqrt(1e-4)*(randn(nRx,nTx)+1i*randn(nRx,nTx));
G_p3= (1/sqrt(2))*sqrt(1e-8)*(randn(nRx,nTx)+1i*randn(nRx,nTx));
cvx_begin
variable s_p3(4,4) semidefinite
maximize((log_det(eye(r)+H_p3*s_p3*H_p3'*1e10))*bandwidth )
subject to
trace(G_p3*s_p3*G_p3') ==  4.8933e-04
trace(s_p3) <= 1%P
%s_p3>=0
cvx_end
cvx_optval
``````

However, the result is Status: Unbounded
Optimal value (cvx_optval): +Inf
I feel very strange because I went to check this term trace(G_p3s_p3G_p3’) and found that this condition was not met(far less than the value I gave)
Ask the experts to help me,
Thanks!

(Mark L. Stone) #2

You have not defined r, and `p3*s_p3*H_p3'` in the objective function is dimensionally inconsistent (non-conformal). Also, `G_p3*s_p3*G_p3'` in the constraint `trace(G_p3*s_p3*G_p3') == 4.8933e-04` is dimensionally inconsistent (non-conformal)…

Try setting `s_p3(` outside of CVX to any 4 by 4 matrix. Then `p3*s_p3*H_p3` and `G_p3*s_p3*G_p3'` need to be evaluable by MATLAB, i.e.,have conformal dimensions. If not, then toy CVX code will not work.

(Xxx Xxx) #4

Thank you for your help, I set up r= min(nTx,nRx) and bandwidth = 1e7;
Here is my code:

``````clear % clear all variables in the workspace
close all % close all open figures
clc % clear command window
nRx = 4;
nTx = 4
r = min(nTx,nRx);
bandwidth = 1e7;
H_p3 = 1/sqrt(2)*sqrt(1e-4)*(randn(nRx,nTx)+1i*randn(nRx,nTx));
G_p3= (1/sqrt(2))*sqrt(1e-8)*(randn(nRx,nTx)+1i*randn(nRx,nTx));
s_p3 = randn(4);
cvx_begin
variable s_p3(4,4) semidefinite
maximize((log_det(eye(4)+H_p3*s_p3*H_p3'*1e10))*bandwidth )
subject to
trace(G_p3*s_p3*G_p3') ==  4.8933e-04
trace(s_p3) <= 1%P
%s_p3>=0
cvx_end
cvx_optval
``````

Sorry, I am currently running my code that G_p3s_p3G_p3 andtrace(G_p3s_p3G_p3’) is consistent,am I right?

I am new with CVX and cannot understand the point:

Then p3s_p3H_p3 and G_p3s_p3G_p3’ need to be evaluable by MATLAB

I don’t understand the meaning of this sentence, and how to do

Thank you so much!

(I don’t know why these line of code will be messed up,about multiply symbol
H_p3 = 1/sqrt(2)sqrt(1e-4)(randn(nRx,nTx)+1i
randn(nRx,nTx));
G_p3= (1/sqrt(2))sqrt(1e-8)(randn(nRx,nTx)+1i*randn(nRx,nTx));
maximize((log_det(eye(4)+H_p3 s_p3 H_p3’ *1e10)) *bandwidth )
Please refer to my first code of G and H and maximize line)!

(Mark L. Stone) #5

Your corrected code is accepted by CVX. But for all the random values I sued for `H_p3` and G_p3, the problem was always (primal) infeasible.

Note that the statement `s_p3 = randn(4);`has no effect, because `s_p3` is declared as a variable in CVX, and that supersedes (overwrites) whatever `s_p3` consisted of before it was declared a variable in CVX.

(Xxx Xxx) #6

Dear experts,
I probably understand what you mean.
But I am not sure how I want to change s_p3
variable s_p3 semidefinite
Is there a problem with this code?
My object is to find the best S(matrix) to maximize 𝑙𝑜𝑔|𝑰+𝑯𝑺𝑯^𝐻 |
subject to some constraints
Thank you so much

(Mark L. Stone) #7

Why do you have the line
`s_p3 = randn(4);`
?

As I wrote,`s_p3` is overwritten before it is used. So that code line does nothing. If you want to do something in this line of code, then you need to do something different that what you have done.

As for the infeasibility, there is no matrix which is simultaneously symmetric positive semidefinite and satisfies the tow trace constraints, at least for the random numbers I tried.

In order to assess feasibility, you can simplify things by eliminating the `maximize` statement. That way, CVX and the solver won;t have to deal with the complexities caused by `logdet`.

(Xxx Xxx) #8

Dear experts,
I just want to set the s_p3 to a 4x4 matrix.
However, after I comment this line s_p3 = randn(4)
The status still Unbounded…
Can you give me some advise to run this code?

–edit
after I delete the maximize,here is the result

``````cvx: concave
``````

Homogeneous problem detected; solution determined analytically.
Status: Solved
Optimal value (cvx_optval): +0

cvx_optval =

`````` 0
``````

Next how can I try to find the maximum value?
Thank you so much

(Mark L. Stone) #9

I don’t know what problem you just solved. Please show the entire code which produces cvx_optval = 0.

(Xxx Xxx) #10

Dear experts,
clear % clear all variables in the workspace

``````close all % close all open figures
clc % clear command window
nRx = 4;
nTx = 4
r = min(nTx,nRx);
bandwidth = 1e7;
H_p3 = 1/sqrt(2)*sqrt(1e-4)*(randn(nRx,nTx)+1i*randn(nRx,nTx));
G_p3= (1/sqrt(2))*sqrt(1e-8)*(randn(nRx,nTx)+1i*randn(nRx,nTx));
%s_p3 = randn(4);
%s_p3 = 3*eye(4) + s_p3'*s_p3;
cvx_begin
variable s_p3(4,4) semidefinite
(log_det(eye(4)+H_p3*s_p3*H_p3'*1e10))*bandwidth
subject to
trace(G_p3*s_p3*G_p3') >=  4.8933e-04
trace(s_p3) <= 1%P
%s_p3>=0
cvx_end
cvx_optval
``````

By the way, my code’s multiplication sign always disapear, do you know how to make the multiplication sign appear normally?
Thank you so much!

(Mark L. Stone) #11

I don;t see how this code can result in Homogeneous problem detected; solution determined analytically. Perhaps the >= 4.8933e-4 could be satisfied within tolerance with s_p3 = zeros(4), if G_p3 is “small” enough, but I don;t think that would result in Homogeneous problem detected; solution determined analytically…

And there is more that you did than maximize. You changed the first trace constraint from == to >=.

(Xxx Xxx) #12

Dear experts,
Yeh, I don’t get why this is Homogeneous problem…
I have tried the first trace constraint == and >=,but still not work
God, I don’t know how to maximize it…
Thank you very much

(Mark L. Stone) #13

There is nothing to maximize unless your problem is feasible.You have now yet shown a reproducible problem which is feasible. You can not rely on randn in your code to provide a reproducible problem.

If you do formulate a feasible problem, then follow the advice in CVXQUAD: How to use CVXQUAD's Pade Approximant instead of CVX's unreliable Successive Approximation for GP mode, log, exp, entr, rel_entr, kl_div, log_det, det_rootn, exponential cone. CVXQUAD's Quantum (Matrix) Entropy & Matrix Log related functions

(Xxx Xxx) #14

Dear experts,
Do you mean that I have problems with randn when I generate H_p3 or G_p3?
Thank you so much

(Mark L. Stone) #15

“Experts” on the forum can not reproduce your results unless we know which random numbers were used for H_p3 and G_p3 in the problem instance for which you are showing results.

Here is an example of how to post reproducible code for H_p3, even though originally using randn. Doing it this way ensures reproducibility, even though only 16 digits are displayed.

Run the following in your “private” code.

``````>>  format long
>> randn(nRx,nTx)

ans =

-0.362267155363552   0.178870372986261   0.560490613996136   0.241120454779083
0.061141295020601   0.927584218205604  -0.420344605627486   0.754686393744638
0.216705550520381  -0.110177935709060  -0.153945389665797  -0.291909899784922
-1.398122413117753   1.572397878773003  -0.275198593421559   0.458445379977200
>> randn(nRx,nTx)

ans =

1.755288631744442  -0.534204178984686  -1.514423152302120  -2.221986605210298
0.931490591541562   0.242551659062315   1.026189392552193   0.448763638516243
0.825264441429846  -0.100647949072058  -0.758127475958909   0.000626115407104
-0.814807133947271  -1.625048449478226   2.078344789112847  -0.756239309114677
``````

Post the code:

``````>> random_matrix_number_one = [-0.362267155363552   0.178870372986261   0.560490613996136   0.241120454779083
0.061141295020601   0.927584218205604  -0.420344605627486   0.754686393744638
0.216705550520381  -0.110177935709060  -0.153945389665797  -0.291909899784922
-1.398122413117753   1.572397878773003  -0.275198593421559   0.458445379977200];
>> random_matrix_number_two = [1.755288631744442  -0.534204178984686  -1.514423152302120  -2.221986605210298
0.931490591541562   0.242551659062315   1.026189392552193   0.448763638516243
0.825264441429846  -0.100647949072058  -0.758127475958909   0.000626115407104
-0.814807133947271  -1.625048449478226   2.078344789112847  -0.756239309114677];
>> H_p3 = 1/sqrt(2)*sqrt(1e-4)*(random_matrix_number_one+1i*random_matrix_number_two);
``````

Alternatively, you could just display H_p3 in your “private” code, then post the code which reads it (back) in with the displayed digits, similarly to the above,

(Xxx Xxx) #16

Dear experts,
Hello, I have been thinking about this for a long time, and asked my colleague to help me execute my program. The result was unexpected, the cvx program was executable. Have you ever encountered such a problem? Is it possible that I have installed fewer components?
Thank you so much

(Mark L. Stone) #17

If you are getting different results than other installations, try removing all CVX directories (folders) from your MATLAB path, delete all CVX directories, then install a freshly downloaded copy of CVX 2.1.

Before you do that, what is the output from `cvx_version` ?

(Xxx Xxx) #18

CVX: Software for Disciplined Convex Programming ©2014 CVX Research
Version 3.0beta, Build 1183 (dda2109) Sun Dec 17 18:58:10 2017

MATLAB version: 9.5 (R2018b)
OS: Windows 10 amd64 version 10.0
Java version: 1.8.0_152
Verfying CVX directory contents:
No missing files.