Optimizing a sum of exponential functions


(Abdoulaye Saadou) #1

Hello,
Is there any way to optimized a a sum of customized exponential functions in CVX? Please, consider the following problem:

 minimize(-(exp(a.x) + exp(b.y)))
 subject to
 L <= x <= U
M <= y <= N
 x + y <= B

My variables are x and y while L, M, U, N, a, b and B are all constants.

Thanks.


(Mark L. Stone) #2

What are a.x and b.y ?

Note that
-(exp(a*x) + exp(b*y))
is concave, and therefore can not be minimized in CVX, but can be maximized. Is that your objective function?


(Abdoulaye Saadou) #3

Hi Mark,
Thanks for replying. My actual objective function is (exp(0.5087x) + exp(0.50875y)) which i need to maximize. So, a and b are parameters (i.e. a = 0.5087 and b = 0.50875). I need to find the optimal values of my variables x and y that maximize my objective function. In other words, my optimization problem is formulated as

maximize (exp(0.5087x) + exp(0.50875y))
subject to
0 <= x <= 3
0 <= y <= 3
x + y <= 3

Thank you.


(Mark L. Stone) #4

Everything I wrote above after note that, applies to your problem. It is a concave optimization problem (minimizing concave objective subject to convex constraints), so CVX can not be used on it.

That said, it’s easy to see by inspection that the optimal x=0, y=3 (put “everything” on the exponential with the larger coefficient).


(Abdoulaye Saadou) #5

Thank you Mark.
You are right. The values of x and y are 0 and 3 when i try the same problem using the sequential quadratic programming (sqp) algorithm in Matlab. However, when i use the same values for a and b (i.e. a = 0.5087 and b = 0.5087), i get x = 1.5 and y = 1.5. Hence my objective function returns 4.2896, which is less than the value of 5.6 that i would have obtained when x = 0 and y = 3 or vice versa. My intuition was that even though the values of a and b are the same, the optimization tool should only care about finding the values that would maximize the objective function rather than performing just an equal allocation (i.e. x = 1.5 and y = 1.5) . So, i was wondering if CVX would give me a different result (e.g. x = 0 and y = 3).

Thank you so much.


(Mark L. Stone) #6

CVX won’t give you any result. It will reject the problem.

When a = b, any combination of x and y each in [0,3] and adding to 3 will give you the same optimal objective, and are all globally optimal. As to MATLAB sqp (FMINCON?), it is only obligated to give you a local optimum, which it turns out happens to be globally optimal.


(Abdoulaye Saadou) #7

Thank you Mark, for this valuable input. Yes, i was talking about “FMINCON”.
I am sorry to bother you again… I have now picked a concave objective function as follows

maximize (-2* exp(-1.7 * x) - 3*exp(-1.2 * y) + 10)
subject to
0 <= x <= 3
0 <= y <= 3
x + y <= 3

Will this run in CVX? If yes, could you please help me code this problem in CVX. Once i know how to program this, i should be able to extend the function to account for more variables.

Thank you.


(Mark L. Stone) #8

You should (re-)read the CVX Users’ Guide. This is extremely straightforward to implement in CVX.

Just add

cvx begin
variables x y

before the code you have shown, and

cvx_end

after. You always need cvx_begin and cvx_end, and to declare at least one (CVX) variable for any CVX program.


(Abdoulaye Saadou) #9

Thank you for the great explanation and for your promptness as well.
I am all set now.

Thanks.