Given a vector decision variable x and vectors a, b of real scalars, I am trying to model the following quantity to be used inside an optimization objective:
While this model can be solved using Mosek under CVX, .CVX will not exploit the native power cone capability of Mosek 9.0 (nor its native exponential cone capability, for that matter).
For the power 3/2 the rewriting it to using two quadratic cones works well. Using a true power cone instead is more convenient but will not buy you any performance in my experience.
The story is different for powers p/q where p and q are not small integers.
Thank you very much for your suggestion! I would be extremely appreciative if you can kindly show how I can re-write the expression Mark provided as two quadratic cones. Thank you.
You can explicitly write your model in CVX using the quadratic cones. However, that is nor necessary. If you use pow_pos, as in my first post in this thread, CVX does the reformulation for you - that is part of the benefit of CVX - to save human effort and reduce human error propensity.
Many thanks! One quick Q: if I wanted to define a new variable w = x / sum(x) inside cvx_begin, then, how could I do that? Basically, I have constraints on w even though x is my decision variable. I was trying:
cvx_begin
variable x(n)
variable w(n);
maximize( - sum_square_abs(w) )
subject to
w == x / sum(x);
0 <= sum_square_abs(w) <= 1/10;
........
cvx_end
How does x come into play? You (sort of) define w in terms of x, but x is not otherwise used at least in what you show of the program; and so is irrelevant, except for triggering a CVX violation.
CVX objects to 0 <= sum_square_abs(w) because it is a non-convex constraint. However, the lower bound of zero must be trivially satisfied, and therefore that constraint need not be included at all. Getting rid of that plus the two lines involving x, yields a rather trivial problem which CVX accepts and solves. Of course, I don’t know what’s in the part of the program you have not shown.
Presuming you really do need sum_square(x./sum(x)) <= 1/10, that is a non-convex constraint according to my calculations, and so you will be out of luck with CVX.
Thank you again for your help. Is there a way that I can specify custom tolerance for my soln? for example, I just need the solution to be accurate to the hundreds, tens place. The reason being that I run into Inaccurate/Solved situations. currently, I am using cvx_precision low but any other way to do this? I am calling for mosek as the solver. Should I place this new tolerance after cvx_begin or before? Thank you.
However, if you only care about accuracy in the hundreds place, it suggests your problem is poorly scaled, which might be the root cause of why you are getting inaccurate solved. Changing solver tolerances might not do you much good, but re-scaling so that coefficients, objective value and argmin elements are either exactly zero or within a small number of orders of magnitude of one might help. Perhaps if you show all the Mosek solver output and solution, the Mosek guys (two of whom have already posted in this thread) can give you some more specific advice.
Are there any other tolerances that I could add on?
(I see the full list here https://docs.mosek.com/9.0/toolbox/param-groups.html#doc-param-groups)
Finally, if there might be a way for me to reduce the tolerances from [ϵ^3/8,ϵ^1/4,ϵ^1/4] then would be much appreciated. Thank you.
In general reducing the requested accuracy is not going to change much.
Finally, most likely the time cvx spends generating the model is bigger than the Mosek solution time. Have you verified that Mosek solution time is the bottleneck?