Disciplined convex programming error:Illegal operation: sqrt( {convex} )


I was wondering if anybody can tell me how I can define the concave function f(x,y) = \sqrt{xy} where x,y>=0 in the CVX. The problem is that CVX declares the following error:
“Disciplined convex programming error:Illegal operation: sqrt( {convex} ).”

Thank you in advance!

You can use rotated_lorentz http://cvxr.com/cvx/doc/funcref.html#sets

norm(z) <= sqrt(x*y), x >= 0, y >= 0
can be specified as
{z,x,y} == rotated_lorentz(n)
where n is the dimension of the vector z.

You will need to reformulated so as to be able to achieve what you want by such a constraint. This will have to be in the context of a convex optimization problem, or it won’t work.

1 Like

Thank you for the prompt response. Now, I want to express my main optimization problem which I think might not be formulated in the CVX via rotated_lorentz(n). I’ve taken the function from a paper in which it was claimed that the following function is concave:
W_k = \sum_{\ell\neq k}^K\sum_{m=1}^N\sum_{n=1}^N\alpha(k,\ell,m,n)\sqrt{x_{m\ell}x_{n\ell}}\\+\sum_{m=1}^N\sum_{n=1}^N\beta(k,m,n)\sqrt{x_{mk}x_{nk}}+\sum_{\ell=1}^K\sum_{n=1}^N\gamma(k,\ell,n)x_{n\ell}+1.
The optimization variables are x_{nk} for n=1,2,\dots N and k=1,2,\dots K and all Greek letters are constants which are independent of the optimization variables.

Presumably, \alpha and \beta are nonnegative.

This therefore consists of a sum of terms of the form c*sqrt(x*y), where c \ge 0, plus affine terms which can be directly entered into CVX as is.

Each individual term, c*sqrt(x*y), can be handled by declaring z to be a CVX variable, and entering
c*z, plus the constraint {z,x,y} == rotated_lorentz(1)

I’ll let you work out all the indexing.

1 Like

I’d appreciate your help Mark!

Thatt’s not really a CVX matter. I showed you what to do. Each different product of variables will have its own "z``. it’s your responsibility to understand whatever model you found in a paper. i barely have time to figure out the notation and conventions in the papers I am interested in.