cvx_begin quiet

variables p(UE,AP)

expression ta_2(UE,AP)

ta_1 = 0;

for m = 1:UE

for j = 1:N

for k = 1:AP

if map_UE_AP(m,k)~=0

if k<=BS+UAV

ta_2(m,k) = prob_f(j)*(map_UE_AP(m,k)/AP_UE_BW(k,m)) BUE_fK(j,k)*(inv_pos(-rel_entr(1,pow_p(10,(p(m,k)-pathloss_dB(m,k)-SINR_N_dB)/1000)))/log(2))+prob_f(j)

*tp(m,k);*

%ta_2(m,k)= prob_f(j)(map_UE_AP(m,k)/AP_UE_BW(k,m))

%ta_2(m,k)= prob_f(j)

*(B*UE_fK(j,k)

*(inv_pos(log(1+pow_p(10,(p(m,k)-pathloss_dB(m,k)-SINR_N_dB)/1000)))/log(2)))+prob_f(j)*(inv_pos(-rel_entr(1,pow_p(10,(p(m,k)-10)/1000)))/log(2))+prob_f(j)

*tp(m,k); %m从k获得j的部分*

else

ta_2(m,k) = prob_f(j)(map_UE_AP(m,k)/AP_UE_BW(k,m))else

ta_2(m,k) = prob_f(j)

*B*UE_fK(j,k)*tp(m,k);*

%ta_2(m,k) = prob_f(j)(map_UE_AP(m,k)/AP_UE_BW(k,m))

%ta_2(m,k) = prob_f(j)

*(B*UE_fK(j,k)*(inv_pos(log(1+pow_p(10,(p(m,k)-10)/1000)))/log(2)))+prob_f(j)*tp(m,k); %m从k获得j的部分

end

end

end

ta_1 = ta_1+max(ta_2(m,:));

end

end

```
tt1 = ta_1 + Tbh;
P = sum(p);
minimize(tt1)
subject to
0<= p(:,1:BS) <=pms.BS_power_dBm;
0<= p(:,BS+1:BS+UAV) <=pms.UAV_power_dBm;
0<= p(:,BS+UAV+1:end) <=pms.BS_power_dBm;
0<= P(1:BS) <=pms.BS_power_dBm;
0<= P(BS+1:BS+UAV) <=pms.UAV_power_dBm;
0<= P(:,BS+UAV+1:end) <=pms.SAT_power_dBm;
cvx_end
```