# Help, help! Disciplined convex programming error: Cannot perform the operation:Cannot perform the operation: {real affine} .* {convex}

My code exits a problem indicating that “Cannot perform the operation: {real affine} .* {convex}”.
The code code is as follows.

``````                cvx_begin quiet
cvx_solver Mosek
variable Alpha0(eff_NumUE, num_subcarrier) nonnegative
variable Phi0(eff_NumUE, num_subcarrier) nonnegative

maximize sum(sum( (log_normcdf(Phi0)) + log(1+Alpha0)))
subject to
for k0 = 1:eff_NumUE
for n0 = 1:num_subcarrier
Phi0(k0,n0) <= sqrt(Nk*(1+Alpha0(k0,n0))*inv_pos(2*Alpha0(k0,n0)))* (log(1+Alpha0(k0,n0))-c_max*log(2)); %(33)
end
end
``````

Phi0 and Alpha0 are the optimization variables. Because the right hand in (33) is concave, the constraint (33) is convex.

Could you please tell me how to convert the writing of this constraint into DCP format ? Thanks a lot.

Perhaps the RHS of (33) is concave. Do you have a constructive proof?

The proof is as follows.

Besides, I find that define the expression 2* Alpha0.inv_pos(1+Alpha0) occurs the same mistake.

How should this fractional representation be corrected?

Unfortunately, that is not a constructive proof. So it does not provide any insight as to a possible DCP formulation, if there is one.

As for `2* Alpha0*inv_pos(1+Alpha0)` by itself, although it it concave, `2* Alpha0/(1+Alpha0) ` is not concave over the entirety of its natural domain (in particular, it is convex for `Alpha0 < -1`). Therefore, it seems unlikely there is a DCP-compliant formulation for `2* Alpha0*inv_pos(1+Alpha0)` . However, if someone comes up with such a formulation, they should post it here.

Even if there were such a formulation, you would still need a DCP-compliant formulation for the entirety of the RHS.

Edit: See @jackfsuia 's post below for a formulation for the expression in the first paragraph of this post.

Thanks for the reply, I continue to think of some ways to transform it.

2x/(1+x)=2(1-1/(x+1))=2(1-inv_pos(x+1)), but this is not what you wanted. The thing you proved convexity of is much more complicated.

1 Like

Thank you very much for an inspiring thought!