# Channel optimal problems

sorry to cause you trouble,but i cant solve the problem.i want to optimal the question is this
`t_(i,j)=D_(i,j)/(B_(i,j) 〖log〗_2 (1+P_(i,j)/(N0*B_(i,j) )) )`,and i prove it is convex if i simply optimal the pij and bij ,but i cant deal with it,so i want to divide it to two questions,pij has done use
`minimize(sum(sum(d1.*inv_pos(b1.*(log(1+p1.*inv_pos(N0.*b1)/log(2)))))))`
but i try my best to optimal bij,because it in log and in 1/x,so i should use inv_pos and rel_entr，but it always failed,`%minimize(sum(sum(d1.*(inv_pos(b1.*p1.*(rel_entr(N0.*b1,N0.*b1+p1)+rel_entr(N0.*b1+p1,N0.*b1)))))))`cant work.by the way,i want optimal dij ,but it always <0,though i use limitations,how can i produce a variable matrix that all numbers>=0,i use cvx first time,these problems really annoyed me a looooot!pease,thank you for your any advices,if you need all code to deal the problem ,please let me know

Please clearly show the problem you want to solve, including telling us which symbols are optimization (decision) variables, and which are input data. Please show whatever code you have, including all error messages and warnings, as well as CVX and solver output, f there is any. Use Preformatted text icon for code, so that it displays properly.

i have 2 problems and i show them
but i can only put 1 page,so i put all problem into it,sorry

this is my goal,to minimize it.and bij dij pij is my variables,i can prove that bij and pij both convex,but i dont know to optimal them together ,so i divide them and i can optimal pij.but for bij

b1=[0.5,0.5;
0.5,0.5];
bmax=2;
d1=[2,2;3,3];
p1=[0.5,0.5;0.5 0.5];
N0=0.1;
cvx_begin
variable b1(2,2) %设定变量可分配带宽
%minimize(sum(sum(d1.*p1.*inv_pos((rel_entr(N0.*b1,N0.*b1+p1)+rel_entr(N0.b1+p1,N0.b1))))))
minimize(sum(sum(d1.
(inv_pos(b1.
(-rel_entr(1,inv_pos(N0.*b1).*p1)))))))
subject to
for i=1:2
sum(b1(:,i))==bmax;
end%make bij limits
cvx_end
but it shows that

and i want to optimal pij and dij one by one,but there still some accidents,the limitations cant work,but it no wrong,the code is
b1=[2,2;
2,2];
bmax=2;
d1=[0.5,0.5;0.5 0.5];
p1=[0.5,0.5;0.5 0.5];
N0=0.1;
lame=1e-3;
for q=1:500
d11=d1;
p11=p1;
cvx_begin
variable p1(2,2) %设定可分配功率
minimize(sum(sum(abs(d1).inv_pos(b1.(log(1+p1.*inv_pos(N0.*b1)/log(2)))))))
subject to
for i=1:2
sum(p1(i,:))==2;
end%设置功率限制函数
cvx_end
cvx_begin
variable d1(2,2) %设定可分配传输总量
%minimize(sum(sum(d1.*inv_pos(b1.*log(1+p1.*inv_pos(N0.*b1))))))
%minimize(sum(sum(d1.*p1.*inv_pos((rel_entr(N0.*b1,N0.*b1+p1)+rel_entr(N0.*b1+p1,N0.*b1))))))
minimize(sum(sum(d1.inv_pos(b1.(log(1+p1.*inv_pos(N0.*b1)/log(2)))))))
subject to
for i=1:2
sum(b1(:,i))==bmax;
end%设置带宽限制函数
for i=1:2
sum(p1(i,:))<=bmax;
end%设置功率限制函数
for i=1:2
sum(d1(i,:))==bmax;
end%设传输文件限制函数
for i=1:2
for t=1:2
d1(i,t)>=0;
end
end%设传输文件限制函数
cvx_end
for i=1:2
for t=1:2
if(d1(i,t)<0)
break;
end
end
end%设传输文件限制函数
c1=(p1-p11).^2;
c2=(d1-d11).^2;
d12=sqrt(sum(c1(:)));
d2=sqrt(sum(c2(:)));
zx=power(d12+d2,2);
if (zx<=lame)%设置循环跳出条件
break;
end
end
but in the end,p1is

and d1 is

before i add abs(d1) ,the d1 even perform<0
as you can see ,they all bigger than bmax(2)
so thanks a lot for you

that is what i have,if you are not busy,please give me some advices

I’ll leave out the subscripts.

`t = log(2)*D*inv_pos(-rel_entr(B,B+P/N0))`

thanks for your help,and i also want to know how it works.can you give me some guidances that this special functions in cvx link with normal functions?can you put some docx or picture or github links in the reply?
because in log(2)Dinv_pos(-rel_entr(B,B+P/N0))
i dont know why * log(2),and in division,there only p and n0,sorry to interupt.thanks alot!

`x*log(1+y/x) = -rel_entr(x,x+y)`

`x*log2(1+y/x) = -rel_entr(x,x+y)/log(2)`

`inv_pos(x*log2(1+y/x)) = inv_pos(-rel_entr(x,x+y)/log(2))`

Use MATLAB’s help for cvx commands, such as
help `rel_entr`.

Read posts on this forum and use its search box.

thanks a lot,your help are important for me

hello mark，i use real paraments to do it，but cvx status failed，and p cant in the limitions it become 1e4

p1 is

99999.9585734732 99999.9583398899 99999.9566620315
99999.9551203910 99999.9594509545 99999.9589916241
99999.9567266356 99999.9587832118 99999.9580680985
99999.9590040862 99999.9557581079 99999.9588034923
99999.9544581189 99999.9595873075 99999.9595301266
99999.9595883758 99999.9563206424 99999.9576625918
99999.9569346219 99999.9585183116 99999.9581176463
99999.9559482101 99999.9593773856 99999.9582418493
99999.9581131171 99999.9572226178 99999.9582351803
99999.9585876236 99999.9587801386 99999.9561975027
99999.9615010933 99999.9508465216 99999.9612175596
99999.9602409713 99999.9531310587 99999.9602071126
99999.9666148494 99999.9464390356 99999.9605197450
99999.9586384309 99999.9559624444 99999.9589781747
99999.9544382724 99999.9596168526 99999.9595097395
99999.9585810911 99999.9558238762 99999.9591671884
99999.9585004843 99999.9567174195 99999.9583606300
99999.9572759790 99999.9580596164 99999.9582443584
99999.9548996261 99999.9599024831 99999.9587694897
99999.9603647476 99999.9598405775 99999.9533732015
and i read the guide，i think is the precision problem，how can i do for it，if i can use cvx？if not，do some other solutions can help me？if dont i would do a code of newton method to do it…thanks for your help

If you have Mosek available as solver, use it. Otherwise, follow the instructions at 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 .