# Problem with multiplication of two variables

Hello. Here is the problem Iβm trying to optimize.

π(π₯,π¦) = \sum_{i = 1}^{N} log(1 + (gi * hi * xi * yi/(hi * yi+gi * xi)) , x,y have non negative elements.

The code I have written and not working is as follows

cvx_begin gp
variable xCVX nonnegative
variable yCVX nonnegative
Objective = log(1+((8 * xCVX * yCVX)/((4 * xCVX + 2 * yCVX))));
maximize (Objective)
cvx_end


I know the objective is concave so I used maximization and since there are multiplication, I used gp. but I get the error

Disciplined convex programming error:
Illegal operation: {real constant} + {log-concave}

and without gp i get

Error using .* (line 262)
Disciplined convex programming error:
Invalid quadratic form(s): not a square.

changing the cost function with variable change ui = xi/yi and vi = yi/xi to
π(u,v) = \sum_{i = 1}^{N} log(1 + (gi * hi /(gi / ui +hi / vi)) , u,v have non negative elements.
and finally w=1/ui z = 1/vi will lead to
π(w,z) = \sum_{i = 1}^{N} log(1 + (gi * hi /(gi * wi +hi * zi)) , w,z have non negative elements.
will result in Illegal operation: log( {convex} ).
here there is no multiplication of w or z

What is the trick to solve this optimization problem?

Have you proven the optimization problem is convex? Unless you show otherwise, I will assume it is not convex.

As I just wrote in another topic,

You canβt mix code which follows the βregularβ CVX DCP rules with code which follows gp rules in one CVX invocation. You have to pick one or the other set of rules and diligently follow those rules (use cvx_begin gp if following the gp rules).

Edit: It is a convex optimization problem.

I have proven that it is concave, and since, I ran for maximization

Well, it is a really large amount of notes, but it will lead to the condition that if gx+hy+ghxy would be greater than zero, for each i index, then each phrase is concave and since the sum of concave phrases would be concave, finally the total sum would be concave. And since all of my initialization is satisfying this condition, I wonder why I canβt solve this problem with cvx.

That is not a convincing proof. I donβt know what " condition that if gx+hy+ghxy would be greater than zero" means (perhaps thereβs a typo?). There have been many false claims and supposed but incorrect convexity (concavity) proofs on this forum.

But even if it is a convex opt6imization problem, you should know from reading the link I provided that that does not necessarily mean the problem can be formulated for CVX. And even if it can, that any forum reader has figured out how to do so.

The concavity proof starts with N = 1. which means
π(π₯,π¦) =log(1 + (g* h * x* y/(h* y+g * x)) , x,y have non negative elements.
Then calculate the gradient vector and Hessian matrix. Since this relaxed problem has only two variables, it will lead to the fact the Hessian matrix is 2*2, which means if h11 and matrix determinant would be less than zero, then the H is negative definite, and hence the system is concave. This condition results in the fact that (gx+hy+ghxy >0). Now consider the non-relaxed problem. Since the sum of concave problems is concave, the total problem under this condition is concave. And I have selected all gi and hi to be positive. For more information, g and h are Reighley channel coefficients.

The argument of log is 1 + 1/2*harmonic mean of 2*xCVX and 4*yCVX, which is concave. Therefore, log can be applied to it and is concave.

So this can be handled using either of the the techniques in section 3.2.7 Harmonic mean of Mosek Modeling Cookbook