Quadratic / Linear Optimization

My original problem is :
\underset{\alpha}{minimize} \frac{ R^2 +G^2 \sum_{i=1}^k {\alpha_i}^2 }{ 2 \sum_{i=1}^k \alpha_i }

R, G, k are known constants.

Although I know I can solve this in closed form by symmetry but I need to solve some other generalizations of this problem and so need to solve this with CVX.

I am trying to solve this problem with epi-graph trick

    variable alphaS(K)
    variable t
    minimize t
    subject to
         ( R^2 + G^2 * sum_square( alphaS ) ) - t * (2*sum(alphaS) ) < 0
         alphaS >= 0

CVX throws the following error

Disciplined convex programming error:
    Invalid quadratic form(s): not a square.
Error in cvx/mtimes (line 36)
    z = feval( oper, x, y );

Error in lowest_upper_bound (line 21)
         ( R^2 + G^2 * sum_square( alphaS ) ) - t * (2*sum(alphaS) ) < 0

Is it possible to fix this and solve my problem with CVX?

You have the following simple conic quadratic optimization problem:

min s
subject to
G^2 t - sum_i alpha_i = 0
beta = R/G
2 s t >= beta^2 + \sum_i (alpha_i)^2, s,t>=0 (This is a rotated quadratic cone.)

And yes that can be solved in closed form since there is only one conic quadratic constraint.

You may find


a valuable resource of modeling tricks.

You’re going to want to look at the function quad_over_lin.

Now Erling, CVX users aren’t supposed to need to know those tricks, they’re just supposed to go to the function reference where most of them are implemented for you! :slight_smile:

OK, so I think the easiest way to go here is


And before you proceed to go further with your problem, please read the user guide, in particular the DCP ruleset section. You should not have even tried your “epigraph trick” because it violates those rules. To use CVX effectively you must understand those rules in advance.