# How to write these function with disciplined convex programming rule to use CVX? x*(2^(y/x)-1)

I have the following functions in an optimization problem.

$$x\times 2^{(y/x)-1}$$

$$x \log (a+b\times 2^{(y/cx)-1} )$$

Here, x,y>0, and also a,b,c>0, and b>a. For these conditions, I checked that both these functions are convex (their Hessian is positive semidefinite). If I want to solve the optimization problem using CVX, I need to write these functions using a disciplined convex programming rule. Can anyone please help me how to do that? Even the first function has affine divided by affine form, and therefore, I am getting an error when running the code with only the first function. Many thanks for your help.

• This is a mathematics site, not a programming site. Jul 10, 2020 at 2:14
• I have seen similar posts on this site, so posted it. Jul 10, 2020 at 2:15
• A simple search finds no CVX.... Jul 10, 2020 at 7:47
• @DavidG.Stork: In my opinion, this question is ok. It is about "how can I explain to CVX that this function is convex" and this is rather a question of mathematics (and not of programming).
– gerw
Jul 10, 2020 at 12:29
• @David G. Stork wrote "A simple search finds no CVX.." I entered CVX in the search box on the top of this page, and many pertinent "how to reformulate optimization problems to comply with CVX's Disciplined Convex Programming rules" questions were displayed. In this context, "Disciplined Convex Programming " does not refer to computer programming. it means "optimization", for instance as in "Linear Programming", or "Nonlinear Programming",, or in this case, "Convex Programming". I request you remove your downvote of the question, if you cast one. Jul 11, 2020 at 12:00

$$x\times 2^{(y/x)-1}$$ can be reformulated as $$\frac{1}{2log(2)}xe^\frac{y}{x}$$

If this appears in an objective function, replace $$x\times 2^{(y/x)-1}$$ with $$z$$, where $$z$$ is declared a variable in CVX; and add the constraint, {y,x,2*log(2)*z} == exponential(1) to specify an exponential cone constraint, x*exp(y/x) <= 2*log(2)*z)

If it appears in a constraint: $$x\times 2^{(y/x)-1} \le z$$, handle it in a similar manner to what I showed for appearance in the objective function, except z need not be declared a variable, unless it already is a variable.

I leave $$x \log (a+b\times 2^{(y/cx)-1} )$$ to you as an exercise.

• Thank you so much. I actually read some of the posts yesterday and trying to solve by myself. Can you please check my post in CVXR. ask.cvxr.com/t/… Jul 13, 2020 at 2:03

If $$f$$ is convex, then the perspective $$g(x,t) = t \, f(x / t)$$ is convex.

Your first function is the perspective of $$f(y) = 2^{y - 1}$$ which is convex. The second function is the perspective of $$f(y) = \log( a + b \, 2^{y/c -1})$$ which is also convex.

Maybe you can invoke the perspective function in CVX.

• Unfortunately, CVX has no perspective function to invoke. Jul 10, 2020 at 16:11
• There is also a more specific statement that if $f$ is expressible using a certain family of cones, then so is its perspective function. That helps here(see the answer by @MarkL.Stone). Jul 11, 2020 at 9:39