Illegal operation: log( {convex} ) in a certain convex constraint

Hi everyone. There is a constraint as below:

This constraint only has two variables: Sk,j[n] and qj[n].
Obviously, the first part Rk.m[N] is a quadratic term repect to qj[n]. And the constant Ak,j[n] >= 0. Thus, the first part Rk.m[N] is concave. The second part which has the -log function is certainly concave. In conclusion, this constraint is convex.

But when I use cvx, it always says: Illegal operation: log( {convex} ). I understand that in cvx, we should make sure the formula within the log function should be concave. But I have no idea how to write the above convex constraint legally.

Thanks in advance!


Thanks for visiting this forum.

Presuming you are willing for S_{k,j}[n] to be implicitly constrained to be positive, I think you can adapt the formulation in the 3rd entry of the Entropy table in the Conic Modeling Cheatsheet

Hi Mark. Thanks so much for your help! The document you provide is certainly helpful. But I think it only works when there is only one variables. However, in my constraint, there are more than one variables.

The picture below illustrates what I mean: as you can see, the right part of the picture prove the idea you provide. But when I try to extend the model to mulitiple-variables case. A (x1x2) appears in the new constraints. Isn’t it?

Thanks again for your kind help!

Hi Mark, I mean, when there is a (x1*x2) in my constraint, it will have a error: Invalid quadratic form(s): not a square. Isn’t it?

If you want to do logarithm of sum of inverses, like on the right side of your scan, there are better ways. See for two of them.

Oh, Thanks so much Michal. It seems a great way to adjust the model. I will try as soon as possible. Thanks again!

1 Like

Hi,LIAO YUAN.I think your problem is from communication of Multi-UAV.I also meet the same problem now,could you please tell me how do you deal with it.I will appreciate you if you could show me the code about this problem.

Hi Alice. Yes, you are right. It is certainly about UAV communication. I had emailed to the author, Wu Qingqing ( and he provided related code,

sum(assignment1.*( GP1_R_lb(:,: ) + log( 1 - inv_pos( (S2(:,: ) + H^2)./( ones(K,1)p2 ) + 1 ) )/log(2) ) + …
( GP2_R_lb(:,: ) + log( 1 - inv_pos( (S1(:,: ) + H^2)./( ones(K,1)*p1 ) + 1 ) )/log(2) ),2 ) >=t_traj;

I tested it and it works well! Please refer to the code above. By the way, really nice to hear that we focus on the same research area hahaha.


Please conduct private communications via the forum message function, not by public posts.

I’m sorry for breaking the rules of the forum, I am new here,I’m not familiar with some of the functions of the forum, I am not sure how to utilize the forum message function,for example,I want to leave you a message. What should I do.I’m sorry for the inconvenience.

Click on the name of the forum member. then click on message.

cvx will reject the form as variable multiplication,the Variables are coupled,maybe divided it into two subproblrm then Overall optimization? kan wo zi liao,liao yuan.

Hi Yuan Liao, I have the similar problems with yours and I didn’t understand your codes well, can I have more details about this problem? Thank you very much!

Hi panyu, thanks so much for your communication. The code above is all from the author. In my side, it actually works well. Could u please provide a more specific description of your problem?