I’m not sure I know enough about the implementation of Convex.jl to see if that’s what’s going on there, but I’ll look a bit harder, later.
I also realized that the MATLAB cvx example of a partially specified function uses an infimal projection (i.e. min f(u,w), which is always convex as long as f(u,w) is jointly convex). They note that it is jointly convex in both variables, u and w. They don’t note that in this case, cvx treats the partial minimum of a convex function as convex, despite failing the DCP analyzer. Convex conjugate, (i.e. sup(<x,z>-f(x)), also fails the DCP analyzer, but is likewise always convex.
I guess, good next steps:
- Test out the MATLAB cvx example on Convex.jl with Julia 1.0
- If it fails, add it as an issue to the GitHub (feature request or bug)
- Do a bit of reading to see if its possible to implement convex conjugate of convex function as an atom in a DCP.
- If it is possible, it would allow Convex.jl to implement all convex piecewise-linear-quadratic functions. Probably worth a feature request in that case.
For completeness, the function that I wanted to represent in CVX was a quadratic penalty on x for laying outside of some box defined by the origin and vector b:
f(x) = 1/2 * norm(x.-min.(max.(x, zeros(length(x))), b))^2
It’s definitely convex, but it doesn’t follow the DCP composition rules as explicitly written (If someone can think of a way to write it, explicitly, according to DCP composition, that would be awesome, but I’m not sure its possible). However, it’s fenchel conjugate is
f*(z) = 1/2 norm(z)^2 + max(0, dot(b,z))
which is the sum of convex functions and thus DCP compliant. I can define
f**(x) = f(x) = maximize(dot(x,z)-f(z)
)which I hope to include the actual problem I’m trying to solve.