cvx_begin
variables q_f(N,AP)
expression ta_4(UE,AP)
expression tbh1(UE,N)
ta_3 = 0;
for m = 1:UE
for j = 1:N
for k = 1:AP
if map_UE_AP(m,k)~=0
ta_4(m,k) = prob_f(j)*q_f(j,k)*B/r_AP_UE(k,m)+prob_f(j)*tp(m,k)*q_f(j,k)*inv_pos(q_f(j,k)+eps);
else
ta_4(m,k) = 0;
end
end
ta_3 = ta_3+max(ta_4(m,:));
end
end
tbh = map_UE_AP*q_f';
tbh = max(1-tbh,0);
Tbh = sum(tbh*prob_f)*pms.time;
tt = ta_3 + Tbh;
q = sum(q_f,1);
minimize(tt)
subject to
0<= q_f(:,:) <=1;
0<= q(:) <=C(:);
cvx_end
In order for this to make sense, I will presume that ta_3
is also declared an N by AP CVX variable, and the statement ta_3 = 0
needs to be removed from the program.
You will need to choose a tolerance, small_positive_number
for what constitutes equaling zero.
Let M_upper
be upper bound for ta_3
, and M_lower
be lower bound for ta_3
. I presume that M_lower <= 0
, else your condition could never be satisfied.
My formulation utilizes that 0 <= q_f <= 1
. If that were not the case, modifications would be required.
q_f < small_positive_number
→ b = 0
, which forces ta_3 = 0
.
q_f >= small_positive_number
allows b = 1
, which doesn’t additionally constrain ta_3
.
variable b(N,AP) binary
q_f - small_positive_number >= b-1
ta_3 <= M_upper*b
ta_3 >= M_lower*b
Thanks for your reply! I’ll have a try.