B=10^3;
d_iA=20;
d_im=20;
a=3;
b_1=0.0001;
h_iA=b_1d_iA^(-a);
g_im=b_1d_iA^(-a);
n2_m=0.01;
n_A=0.0090909;
f_AP=410^6;
f_i=0.410^6;
L_i=210^5;
D_i=0.6;
C_AP=106;
C_i=10^3;
c=0.1;
p_maxi=2;
s=10^(-28);
a_i=0.5;
l_i=810^4;
t_AP=(C_AP(L_i-l_i))/f_AP;
A_5=f_AP*(L_i-l_i);
A_6=B*(D_if_AP-C_AP(L_i-l_i));
B_2=(2^(A_5/A_6)-1)n2_m;
B_3=h_iA-(2^(A_5/A_6))(1-c)h_iA;
B_1=B_2/B_3;
Max=max(B_1,0);
cvx_begin
variables p_i
A_1=sC_il_if_i^2D_ia_ir_iA;
A_2=D_ip_ia_i(L_i-l_i);
A_3=(1-a_i)sC_iL_if_i^2t_APr_iA;
A_4=(1-a_i)sC_iL_if_i^2*(L_i-l_i);
R_on=sC_iL_if_i^2D_ir_iA;
R_um=A_1+A_2+A_3+A_4;
F=0.1;
R_i=R_um-FR_on;
minimize(R_i);
subject to
p_i >= Max
p_i <= p_maxi
r_iA==Blog2((n_An2_m+n2_mh_iAp_i)/(n_An2_m+n_Ag_im*p_i))
cvx_end
Disciplined convex programming error:
Cannot perform the operation: {real affine} ./ {real affine}
error ./ (line 19)
z = times( x, y, ‘./’ );
error * (line 36)
z = feval( oper, x, y );
error / (line 15)
z = mtimes( x, y, ‘rdivide’ );
error ww (line 42)
r_iA==Blog2((n_An2_m+n2_mh_iAp_i)/(n_An2_m+n_Ag_im*p_i))
This problem has puzzled me for a long time because I think my problem is convex. However, CVX cannot solve my problem.
The third constrains in your code is an equality. An equality constraint is not convex unless it is affine. Please check your formulations first.
Divide both sides of the constraint by B, then take 2 to the power of both sides to get rid of log2, then multiply both sides of that by what is the denominator inside what was the log2. I believe this results in an affine equality. which is the constraint you should enter.
In the future, please copy and paste code into your post, and use the Preformatted text on it.
Hi, Mark, thanks for your reply. I have revised the constraint according to your suggestion, that is (2^(r_iA/B))*(n_A*n2_m+n_A*g_im*p_i)==(n_A*n2_m+n2_m*h_iA*p_i)
But CVX still reports errors. The errors reported are
Disciplined convex programming error:
Cannot perform the operation: {log-affine} .* {real affine}
error * (line 36)
z = feval( oper, x, y );
error ww (line 21)
(2^(r_iA/B))*(n_A*n2_m+n_A*g_im*p_i)==(n_A*n2_m+n2_m*h_iA*p_i)
What is r_iA
? I presumed it is a number (constant), but I don’t see it anywhere in your image. If it is not a constant, perhaps the constraint is non-convex.
Also, your input data has horrible values such as 10^(-28)
. That is not good for solvers. you need to improve scaling so that non-zero input data is much close in magnitude to 1.
I’m sorry that I missed a information for r_iA. r_iA is a variable in my problem, that is, there are two variables p_i and r_iA in this problem.
Anyway, mark, big thanks for your detailed observation and help.
Based on that, I will declare this problem to be non-convex.,
In the future, please show the code which resulted in the error message you show, not a different code. The code you show does not declare r_iA
as a variable.
What is the meaning of the third constraint?
You may try to reformulate it as an inequality, and then it should be hopeful to convert it to a convex one.
Ok, I see. Mark, thank you very much!
Ok, I will rethink my optimization problem, thanks for your reply.