Hi.I writting my optimization problem in cvx and running that but i had a error .I attached the program and thats error.please if it is possible help me. I want to transform the objective function to satisfy the constraints of CVX. But I don’t know how to do it.
expressions t_ave
t_ave=0;
for i=1:NUM_DUG
for j=1:NUM_RB
t_ave=t_ave+BW*T_h(i,j)*log2(1+sm_h(i,j)./T_h(i,j).H_D_yong(i,j))…
+BWT_BS(i,j)*log2(1+sm_BS(i,j)./T_BS(i,j).H_B_yong(i,j))…
-lanmuda(sm_h(i,j)+sm_BS(i,j));
end
end
I believe you can re-write this in terms of rel_entr as follows:
Use -rel_entr(x,x+y)/log(2), which is concave and accepted by CVX in place of x*log2(1+y/x) .
I leave the details to you, but this is the basic construct which you should be able to use.
I recommend you don’t use the quiet option until everything is working well and you are confident in the solutions.
I further recommend that you install CVXQUAD, including its exponential.m. replacement, as described in my answer at Failed status and optimal value NAN in convex problem . No further modifications to your program should be required for CVXQUAD to be invoked given that rel_entr is being used
I have a new error. Is this because there are too many variables?
cvx_begin
variables sm_h(NUM_DUG,NUM_RB) sm_BS(NUM_DUG,NUM_RB) T_h(NUM_DUG,NUM_RB) T_BS(NUM_DUG,NUM_RB)
objfunc=cvx(zeros(NUM_DUG,NUM_RB));
expressions term1 term2
for i=1:NUM_DUG
for j=1:NUM_RB
objfunc(i,j)=BW*rel_entr(T_h(i,j),sm_h(i,j)*H_D_yong(i,j))/log(2)...
+BW*rel_entr(T_BS(i,j),sm_BS(i,j)*H_B_yong(i,j))/log(2)...
-lanmuda*(sm_h(i,j)+sm_BS(i,j));
end
end
maximize sum(sum(objfunc))
subject to
term1=0;
for i=1:NUM_DUG
for j=1:NUM_RB
term1=term1+BW*rel_entr(T_h(i,j),sm_h(i,j)*H_D_yong(i,j))/log(2);
end
end
bai*Size_VI/100000-term1<=0;
term2=0;
for i=1:NUM_DUG
for j=1:NUM_RB
term2=term2+BW*rel_entr(T_BS(i,j),sm_BS(i,j)*H_B_yong(i,j))/log(2);
end
end
(1-bai)*Size_VI/100000-term2<=0;
T_h>=0;
T_h<=1;
T_BS>=0;
T_BS>=0;
sm_h>=0;
sm_h<=Pt_Dm;
sm_BS>=0;
sm_BS<=Pt_Bm;
cvx_end