Here is my code. I can run the program using the SDPT3 solver, but it does not converge. When I try to use the MOSEK solver, MATLAB tells me that there is no solution.
while 1
cvx_begin
variable comm_rxBeam(FA_num) complex
variable gamma0
variable zeta(UAV_num,1)
variable eta(UAV_num,1)
expressions T_off(UAV_num,1)
for i = 1:UAV_num
T_off(i) = computing_offloadingRatio(i)*Data*inv_pos(zeta(i));
end
minimize(gamma0)
subject to
gamma0 >= 0;
zeta >= 1e-10;
eta >= 1e-10;
square_pos(norm(comm_rxBeam)) <= 1;
for i = 1:UAV_num
T_off(i) <= gamma0;
zeta(i) <= B*log(1+comm_txPower*eta(i)*comm_referenceGain/(noisepower*d(i)^(alpha)))/log(2);
eta(i)-2*real(comm_rxBeami'*phase(:,i)*phase(:,i)'*comm_rxBeam)+abs(comm_rxBeami'*phase(:,i))^2 <= 0;
end
cvx_end
comm_rxBeami = comm_rxBeam;
iteration = iteration + 1;
result = [result, gamma0];
if (length(result)>=10) )
break;
end
Don’t apply crude, unsafeguarded (no Trust Region or Line Search) Successive Convex Approximation (SCA) to a new problem … unless your name happens to be Stephen Boyd. There’s a reason high quality non-convex nonlinear optimization solvers are more than 10 lines long.
If you change the starting point and/or the solver you might get lucky. or you might not. You might be better off changing 1e-10 to 0,although I don’t know whether that will make any difference.
Thank you very much for your reply. I replaced the inv_pos function with the quad_over_lin function to achieve SCA convergence, which is quite strange. However, I have encountered a new problem and hope you can help me solve it. Thank you.
I tried to add code to further improve my work, but CVX reported an error. I am sure that this line of code is mathematically correct and very simple.
When I added Code 1, CVX told me:
Disciplined convex programming error:
Invalid numeric values (NaNs) may not be used in CVX expressions.
Error occurs in Eta(i) <= 2*real(comm_rxBeami’*phase(:,i)*phase(:,i)‘*comm_rxBeam)-abs(comm_rxBeami’*phase(:,i))^2;
When I added Code 2, CVX told me there is no solution.
Below is my code.
while 1
cvx_begin
cvx_solver MOSEK
variable comm_rxBeam(num) complex
variable Gamma
variable Zeta(UAV_num,1)
variable Eta(UAV_num,1)
variable computing_allocation(UAV_num,1)
minimize(Gamma)
subject to
Zeta >= 0;
Eta >= 0;
computing_allocation >= 0;
sum(computing_allocation) <= computing_BScapacity;
norm(comm_rxBeam,2) <= 1;
for i=1:UAV_num
Eta(i) <= 2*real(comm_rxBeami'*phase(:,i)*phase(:,i)'*comm_rxBeam)-abs(comm_rxBeami'*phase(:,i))^2;
Zeta(i) <= B*log(1+comm_txPower*Eta(i)*comm_referenceGain/(noisepower*d(i)^(alpha)))/log(2);
Gamma >= quad_over_lin(sqrt(computing_offloadingRatio(i)*computing_sensingData), Zeta(i))...
%+quad_over_lin(sqrt(offloadingRatio(i)*Data*cyclesPerBit), computing_allocation(i));%尝试添加的代码1
%+offloadingRatio(i)*Data*cyclesPerBit*inv_pos(computing_allocation(i));%尝试添加的代码2
end
cvx_end
result = [result, Gamma];
if (length(result)>=5) && (abs(result(end)-result(end-1))<1e-5)
break;
end
comm_rxBeami = comm_rxBeam;
end
So your point is that the function 1/x I added has made the problem more complicated. Both of my approaches are correct, but neither has found the optimal solution. Then, is the only thing I can do now to try changing the starting point, or to give up optimizing this “x” within this CVX problem and instead use alternating optimization (I don’t know what trust region should be added for SCA)。
If you want to make SCA or alternating optimization work, you’re pretty much on your own as far as this forum goes. I provided disclaimers, but you’re welcome to try anyway. Good luck.