Closed mlubin closed 8 years ago
y*log(x/y)
is concave, so {(x,y,z): y*log(x/y) >= z}
is a convex set. We can represent this using the exponential cone {(x,y,z): y*exp(x/y) <= z}
using the following reasoning:
y*log(x/y) >= z
iff
log(x/y) >= z/y
(supposing y>0
) iff
x/y >= exp(z/y)
iff
x >= y*exp(z/y)
,
which is the standard exponential cone form.
If you don't want to create a new atom, I'd add a new variable z
and the constraint
ExpConstraint(z, y, x)
,
and replace y*log(x/y)
by z
anywhere you want to use it. (This constraint can be used like any other constraint in Convex.)
Okay, good to see that it's at least representable. Would be nice to have an atom for the functional form. What do the other DCP languages do here?
I'm not aware of (a name for) this atom existing in other DCP languages... Perhaps @SteveDiamond or @mcg1969 can comment?
@mlubin, can you say more about how this function arises for you?
Oh yeah, look at rel_entr
. We don't have an exact atom for the perspective of log but enough people ask that we should.
I see! The function Miles was interested in (perspective of log) is just the negative of relative entropy:
-x log(x/y) = x log(y/x)
Perspective functions come up pretty often in disjunctive modeling for mixed-integer nonlinear problems, e.g. http://link.springer.com/article/10.1007%2Fs10107-010-0360-z
I'd be happy with a rel_entr
atom.
Yes, that's right. CVX doesn't attempt to model general perspective functions. But the perspective of the logarithm itself is indeed representable through the rel_entr
function, with a bit of effort.
quad_over_lin
is another perspective atom, by the way
That's right! I personally don't think the perspective transformation itself needs to be exposed in a modeling environment, as long as the atoms that represent them, like quad_over_lin
and rel_entr
, are made available.
rel_entr
is a big improvement over the manual modeling using the exponential cone as @madeleineudell suggested, although I think there's something to be said for the syntax to match the user's mental model of the problem, when it's possible.
rel_entr
isn't immediately identifiable as a way to model the perspective of log
, and the community of MINLP people who use the perspective of log
might never think or talk about entropy functions. Having to use terminology from a different field just seems like a bit of an unnecessary barrier between the user and the code.
Just an observation though, as I said I'm happy to go off and use rel_entr
.
Oh, yes, by all means: if there are a lot of people who want something called, say, log_perspective
that implements y log(x/y)
, it should probably be implemented. All I was saying was that there needn't be some sort of higher-level function like perspective(fn, x, y)
to implement perspectives for any function. It might be cool academically to do this, and indeed I've thought about it (with conic solvers it's possible)! I just don't think it will be widely appreciated, and then it's just something else to break.
Here's a relative entropy atom sketch: b228b4fd9682e8d0dfaa275b520be7e3cce3970a. Not yet tested, but perhaps enough for @mlubin to play with?
@mcg1969, agreed with your assessment. Perspective functions don't come up all that often, and when they do, it might be in a more structured context, e.g., disjunctive modeling, where the more natural user-facing representation of the problem is at a level above DCP.
@madeleineudell, thanks for writing that up, I'll play with it when I get a chance.
Well then it's perfectly fine to add a
log_perspective (x, y ) = - relative_entropy (x, y )
Or whatever terminology you think would be easiest to search for. On Aug 31, 2015 7:55 PM, "Miles Lubin" notifications@github.com wrote:
rel_entr is a big improvement over the manual modeling using the exponential cone as @madeleineudell https://github.com/madeleineudell suggested, although I think there's something to be said for the syntax to match the user's mental model of the problem, when it's possible. rel_entr isn't immediately identifiable as a way to model the perspective of log, and the community of MINLP people who use the perspective of log might never think or talk about entropy functions. Having to use terminology from a different field just seems like a bit of an unnecessary barrier between the user and the code.
Just an observation though, as I said I'm happy to go off and use rel_entr .
— Reply to this email directly or view it on GitHub https://github.com/JuliaOpt/Convex.jl/issues/100#issuecomment-136559824.
Closed by 9296fe8fa160dc12864f0691b460c30d351f74d0
What's the DCP way to represent
y*log(x/y)
? It should be an easy conversion to the exponential cone.