# Let this function be supported by CVX

The function is f(x1,x2)=x1*2^[(1-x2)/x1],x1>=0,0<=x2<=1
I have proved this function is jointly convex of x1 and x2,but this function cannot be supported by CVX.
So is there some solutions for this question? Thanks very much!

I remain skeptical that this is actually convex. But even if it is, there’s no way it will ever be supported in CVX. It’s simply too far outside of the scope of the solvers that CVX supports.

I am not questioning mcg’s assessment of this being outside of CVX’s scope. However, I did compute the eigenvalues of the Hessian, and verified that the Hessian is psd, and therefore the function convex, over the stated constraint region (but not over the entirety of [x1,x2] in R^2).

Well done, Mark, thanks. But of course, the fact that the domain must be artificially constrained to preserve convexity (x_2\leq 1 specifically) is one very strong reason why CVX cannot support it. CVX supports functions that are convex over their natural domains.

I think, only x1>=0, no matter the constraint of x2, this function is convex. So is it still unsolved by CVX? If this is unsloved by CVX, how to get the optimal solution of this convex optimization, using interior-point methods?Thanks for your answer~

Yanting, I’m not sure if it is important to you to parameterize this in terms of x_1 and x_2, but if not, I believe this can be done in CVX. The function you ask about is

f(x_1,x_2)=x_12^{(1-x_2)/x_1}\text{ for }x_1>0,0\le x_2\le 1.

(I’ve changed the constraint on x_1 to be a strict inequality because it appears in the denominator.)

Now, consider a different parameterization, y_1=\log_2(x_1) and y_2=\log_2(1-x_2). (One side effect of this parameterization is that x_2=1 may be unobtainable.) Notice that

\log_2 f(x_1,x_2)=\log_2(x_1)+(1-x_2)/x_1=y_1+2^{y_2-y_1}.

This is a (jointly) convex function in (y_1,y_2) and easily expressed in CVX. Furthermore, since g(z)=2^z is a convex and increasing function (use power(2,z) in CVX), by the composition rules allowed in DCP, the function

\tilde f(y_1,y_2) = 2^{y_1+2^{y_2-y_1}}\text{ for }y_2\le 0

is jointly convex in (y_1,y_2) and allowed in CVX. Notice that the constraints on x_1 and x_2 translate simply to y_2\le0.

The main point is that

f(x_1,x_2)=\tilde f\left(\log_2(x_1), \log_2(1-x_2)\right)=\tilde f(y_1,y_2)

and while f(x_1,x_2) might not conform to DCP, \tilde f(y_1,y_2) does.

Hopefully mcg or Mark will correct me if I’m wrong here.

Your assessment on convexity is correct. So go ahead and try Bien’s CVX solution below, presuming his proposed parametrization doesn’t cause havoc somewhere else in your problem formulation (you haven’t told us the entirety of your optimization problem).

Thanks for all the answers. My entirety of optimization problem is min x2^3 + x1* 2^[(1-x2)/x1] -x1+1-x2. s.t. a* x1+b(1-x2)<=0; 1-x2-x1*c<=0;x1>=0;0<=x2<=1; So I think, using Bien‘s solution, the first term in objective is not convex. So maybe some other solutions are still needed. Thanks again!

It would have been nice if you had provided the complete specification to begin with, including all constraints. I believe that Bien’s proposed solution will not result in a CVX compliant model given the entirety of your formulation. I’ll defer to him if he has some wizardry to overcome this.