# Disciplined convex programming error:Invalid operation: {-23.0259} / {0.693147}

This is my code:
a_ij0 = [1,0,0;1,1,1;1,0,1];
Cg_k0 = [6.3e-07,4.8e-07,3.6e-07];
Cg_e0 = 1.2e-06;
p_k0 = [0.2,0.17,0.13];
noise = e-10;

cvx_solver SeDuMi
cvx_begin
variable p_k(1,3)

``````f_exp(1) = log2(Cg_k0(1)*(p_k(1)+a_ij0(2,1)*p_k(2)+a_ij0(3,1)*p_k(3))+noise)%/log(2);
f_exp(2) = log2(Cg_k0(2)*(p_k(2)+a_ij0(1,2)*p_k(1)+a_ij0(3,2)*p_k(3))+noise)%/log(2);
f_exp(3) = log2(Cg_k0(3)*(p_k(3)+a_ij0(1,3)*p_k(1)+a_ij0(2,3)*p_k(2))+noise)%/log(2);

g_exp_ub(1) = g_exp0(1)+(Cg_k0(1)*(a_ij0(2,1)*(p_k(2)-p_k0(2))+a_ij0(3,1)*(p_k(3)-p_k0(3))))/...
((Cg_k0(1)*(a_ij0(2,1)*p_k0(2)+a_ij0(3,1)*p_k0(3))+noise)*log(2));
g_exp_ub(2) = g_exp0(2)+(Cg_k0(2)*(a_ij0(1,2)*(p_k(1)-p_k0(1))+a_ij0(3,2)*(p_k(3)-p_k0(3))))/...
((Cg_k0(2)*(a_ij0(1,2)*p_k0(1)+a_ij0(3,2)*p_k0(3))+noise)*log(2));
g_exp_ub(3) = g_exp0(3)+(Cg_k0(3)*(a_ij0(1,3)*(p_k(1)-p_k0(1))+a_ij0(2,3)*(p_k(2)-p_k0(2))))/...
((Cg_k0(3)*(a_ij0(1,3)*p_k0(1)+a_ij0(2,3)*p_k0(2))+noise)*log(2));

fe_exp_ub(1) = fe_exp0(1)+Cg_e0*((p_k(1)-p_k0(1))+a_ij0(2,1)*(p_k(2)-p_k0(2))+a_ij0(3,1)*(p_k(3)-p_k0(3)))/...
((Cg_e0*(p_k0(1)+a_ij0(2,1)*p_k0(2)+a_ij0(3,1)*p_k0(3))+noise)*log(2));
fe_exp_ub(2) = fe_exp0(2)+Cg_e0*(a_ij0(1,2)*(p_k(1)-p_k0(1))+(p_k(2)-p_k0(2))+a_ij0(3,2)*(p_k(3)-p_k0(3)))/...
((Cg_e0*(a_ij0(1,2)*p_k0(1)+p_k0(2)+a_ij0(3,2)*p_k0(3))+noise)*log(2));
fe_exp_ub(3) = fe_exp0(3)+Cg_e0*(a_ij0(1,3)*(p_k(1)-p_k0(1))+a_ij0(2,3)*(p_k(2)-p_k0(2))+(p_k(3)-p_k0(3)))/...
((Cg_e0*(a_ij0(1,3)*p_k0(1)+a_ij0(2,3)*p_k0(2)+p_k0(3))+noise)*log(2));

ge_exp(1) = log2(Cg_e0*(a_ij0(2,1)*p_k(2)+a_ij0(3,1)*p_k(3))+noise);
ge_exp(2) = log2(Cg_e0*(a_ij0(1,2)*p_k(1)+a_ij0(3,2)*p_k(3))+noise);
ge_exp(3) = log2(Cg_e0*(a_ij0(1,3)*p_k(1)+a_ij0(2,3)*p_k(2))+noise);

result3 = sum(f_exp-g_exp_ub-fe_exp_ub+ge_exp);
maximize result3
subject to
p_k >= 0;
sum(p_k) <= P_max;
``````

cvx_end

after running I got this error:
CVX Warning:
Models involving “log” or other functions in the log, exp, and entropy
family are solved using an experimental successive approximation method.
This method is slower and less reliable than the method CVX employs for
other models. Please see the section of the user’s guide entitled
The successive approximation method
for more details about the approach, and for instructions on how to
suppress this warning message in the future.

f_exp =

``````cvx: concave
``````

f_exp =

``````cvx: concave 1x2 vector
``````

f_exp =

``````cvx: concave 1x3 vector
``````

Disciplined convex programming error:
Invalid operation: {-23.0259} / {0.693147}

ge_exp(2) = log2(Cg_e0*(a_ij0(1,2)*p_k(1)+a_ij0(3,2)*p_k(3))+noise);

I think the reason for this error is a_ij0(1,2)=0, a_ij0(3,2)=0, The equation is equivalent to ge_exp(2)=log2(noise);
if I write ge_exp(2)=log2(noise), the code will run successfully. But a_ij0 is the optimization variable of one of the subproblems in BCD algorithm.
I don’t know how to deal with it. If you have any suggestion, please tell me. Thanks a lot.

cvx does not allow log2(), write it as log()/log(2) instead.

I tried, but still this error.

Disciplined convex programming error:
Invalid operation: {-23.0259} / {0.693147}

ge_exp(2) = log(Cg_e0*(a_ij0(1,2)*p_k(1)+a_ij0(3,2)*p_k(3))+noise)/log(2);

I found my mistake. should write like this
ge_exp(2) = log(Cg_e0*(a_ij0(1,2)*p_k(1)+a_ij0(3,2)p_k(3))+noise)(1/log(2))