I have the following constraint that I want to set in CVX:
A+B-C < sqrt(-A^2+(2B+2C)*A-(B-C)^2)
The lhs is affine hence convex.
I also know that the variables A, B, C are always positive.
I proved that under the positivity assumption, the rhs of the inequality above is concave, meaning that the constraint is convex.
How do I formulate the sqrt function on the rhs such that CVX will accept it as a concave function?
Assuming A=1, B=0 and C=0 your RHS is not well defined.
I implicitly assume that what’s inside the sqrt is always positive.
I’m claiming that the inequality constraint defines a convex region in R^3 wherever it’s well defined.
Under this assumption I’m looking for a way to make CVX accept the constraint.
If it makes the answer to my question easier one can further assume the following stronger conditions on the domain of definition:
- \sqrt A + \sqrt B > \sqrt C
- \sqrt A + \sqrt C > \sqrt B
- \sqrt B + \sqrt C > \sqrt A
These inequalities ensure that the sqrt is always well defined.
A=1, B=0, C=0 leads to a negative sqrt. It is contradicted by 3).
These constraints define a convex region.
For example, since A,B,C are positive, 3) can be rewritten as:
2\sqrt{BC} > A-B-C, which is convex since \sqrt{BC} is concave.
If you write it as
(A+B-C)^2 + A^2 + (B-C)^2 < 2A(B+C)
then you have a rotated quadratic cone (rotated_lorentz) assuming A>0, B+C>0.
EDIT: To be completely equivalent with the original formulation (before squaring) we should also account for the case when LHS is strongly negative, more so than -RHS. I guess this should do:
T >= 0
T >= A+B-C
2A(B+C) >= T^2+A^2+(B-C)^2
Nice solution by @Michal_Adamaszek
In CVX, I believe this would be
{[A+B+C; A; B-C],2*A,B+C} = rotated_lorentz(3)
Edit: See typo corrections by @Convexy below, one of which (A+B+C should be A+B-C) was also a “reado” on the original problem, necessitating the correction above by @Michal_Adamaszek
Excelent! I had a feeling that at the end of the day it should be a second order cone, but I overlooked the rotation.
Thank you for this great tip!
There is actually a small typo above. Replace A+B+C with A+B-C and also use == instead of =.
{[A+B-C; A; B-C],2*A,B+C} == rotated_lorentz(3)
I saw in the CVX manual that this is also considered a valid syntax:
{{[A+B-C; A; B-C],2*A,B+C} <In> rotated_lorentz(3)}
This should be used in the “subject to” section of the CVX program after variables A,B,C were defined.
I wonder if there is a way to define in CVX many such constraints simultaneously, without using a loop.