错误使用 .* (line 262) Disciplined convex programming error: Invalid quadratic form(s): not a square

Uncategorized
May 7, 2021
L

M

I have no idea what the formula is. Does the objective function evaluate to a scalar? Have you proven it is convex (of course it must be real, scalar), i.e., the quantity being maximized is concave?

If your function is of the form y/z^2, that is neither convex nor concave, even for y >= 0, and therefore can’t be used in CVX.

If after doing this, you still have a problem worthy of presentation, please copy and paste text of the code, using Pre-fromatted text icon. Do not just show us images.

L
Replying to #2

Thanks,Mark
In fact, this is all of my code. In this article, the author changed the values of x,y,z, which were originally 0,1, into continuous variables. If the y/d^2 form is not considered convex, then how do I modify this form to be accepted by CVX

cvx_begin
variable a
variable f_loc
variable f_fog
variable T_iu
variable T_id
variable x
variable y
variable z

T=0.5;
n=0.51;
B=1.1;
E0=0;
Y=10^-23;
k_i=10^-29;
D_i=3000;
q_i=1000; ,
C_i=D_iq_i;
O_i=2;
F_fog=4
10^9;
F_loc=10^9;
F_cloud=2.510^9;
N_0=10^-12;
R_cf=5
10^6;
w=35000;
hi=510^-4;
R_max=w
log(1+30hi^2/N_0);
R=3
10^6;
P=3;
Ej=0.01;
Hj=0.2;
Bj=0.01;
ej=0.0001;
p=500;
M=500;
a_=0.5;
f_loc_=0.5*10^9;

maximize( n*P*hi*hi*T *a  -k_i*C_i*x*f_loc*f_loc   -Y*(B*D_i)*(B*D_i)'*(B*D_i)*y/((hi)*hi*(T_iu*T_iu))  -Y*(B*D_i)*(B*D_i)*(B*D_i)*z/((hi)*hi*(T_iu*T_iu)) -p*(y+z-x))


subject to
x+y+z==1;%%C4
f_fog<=F_fog;
f_fog>=0;
f_loc>=0;
f_loc<F_loc;
(1-x)*B*D/R<=T_iu;
 (1-x)*B*D/R_max<=T_id;
 a<=1;
 a>=0;
   x<=1;
 x>=0;
   y<=1;
 y>=0;
   z<=1;
 z>=0;

10^9/(f_loc)^2+1/10^9/(1-a)^2 <= (2*T(1-x)*M+1)/C_i ; % C_2a
B*C_i*(10^9/(f_loc)^2+1/10^9/(1-a)^2)+   (0.2/2/(1-a)^2+(T_iu+B*D_i/R_cf)^2/0.5/0.2)+    (0.2/2/(1-a)^2+(T_id)^2/0.5/0.2) <=2*T*((1-y)*M+1)

(0.2/2/(1-a)^2+(T_iu+B*D_i/R_cf)^2/0.5/0.2)+    (0.2/2/(1-a)^2+(T_id)^2/0.5/0.2)   +2*((B+o_i)/R_CF+B*C_i/F_cloud)/(1-a) <=2*T*((1-y)*M+1)

 0.5*k_i*C_i(a_*(f_loc_)^2/a^2+f_loc^4/a_/f_loc_^2)+0.5*(a_*t_/a^2+t^2/a_/t_)-0<=n*P*hi^2*T*((1-x)*M+1);   %C 11a

 0.5*Y*(B*D_i)^3*(T_iu_^2/a_/T_iy^4+a_/T_iu^2/a^2)/h_i^2+0.5*(a_*t_/a^2+t^2/a_/t_)-0<=n*P*hi^2*T*((1-y)*M+1); 


   0.5*Y*(B*D_i)^3*(T_iu_^2/a_/T_iy^4+a_/T_iu^2/a^2)/h_i^2+0.5*(a_*t_/a^2+t^2/a_/t_)-0<=n*P*hi^2*T*((1-z)*M+1); 

cvx_end

M

Where is your proof that the objective function being maximized is concave?

Even if you get the problem accepted by CVX, the numerical scaling of your input data is atrocious.