Dani_CVX
(Dani)
October 28, 2020, 12:38pm
1
Hi! Does anyone know how to write the following constraint in cvx?
y * log(sum_i e^(x_i/y)) \leq y*a
where y and x are variables and a is a scalar. It is obviously convex since it is the perspective function of the convex log-sum-exp. I know you can write the log-sum-exp as an exponential cone, but I cannot seem to figure out how to write it for this form. I would really appreciate the help!
<Comment withdrawn due to misreading * as ^ in RHS>
Dani_CVX
(Dani)
October 28, 2020, 1:32pm
3
ay is right? where a is a real number. So I consider the constraint
y * (log(sum_i e^(x_i/y)) - a) \leq 0
<Comment withdrawn due to misreading * as ^ in RHS>
Dani_CVX
(Dani)
October 28, 2020, 1:35pm
5
So I consider the constraint
y * (log(sum_i e^(x_i/y)) - a) \leq 0
Dani_CVX
(Dani)
October 28, 2020, 1:36pm
6
It is the sum of two convex functions which is convex. So y*log(sum_i e^(x_i/y)) is the perspective function of log(sum_i e^(x_i)).
<Comment withdrawn due to misreading * as ^ in RHS>
<Comment withdrawn due to misreading * as ^ in RHS>
Dani_CVX
(Dani)
October 28, 2020, 1:39pm
9
So you say that the following constraint is not convex:
y * log(sum_i e^(x_i/y)) - 2y \leq 0 ?
I withdraw all my comments. I misread the RHS as y^a
, not as y*a
.
Dani_CVX
(Dani)
October 28, 2020, 1:54pm
11
No problem! I already thought there was a misunderstanding. Do you have any idea how to do it for y*a?
Dani_CVX
(Dani)
October 28, 2020, 2:08pm
12
Here is an idea:
y * log(sum_i e^(x_i/y)) - ay \leq 0
is equivalent to
b - ay <= 0
b >= y*log(sum_i e^(x_i/y))
which is equivalent to
b - ay <= 0
y >= sum_i z_i
(z_i, y, (x_i -b)) \in exponential cone for i = 1,…,n
Is this correct?
If you can model a function then you can model its perspective using the same cone types. This is in https://docs.mosek.com/modeling-cookbook/practical.html#perspective-functions where there is also an example with log-sum-exp.
Dani_CVX
(Dani)
October 29, 2020, 9:17am
15
Thank you very much! It looks like my idea is correct since it gives the right answers after implementation.