I’m trying to use a partially defined function as in DCP documentation. I have a minimization problem including convex function that isn’t a disciplined convex function. It’s fenchel conjugate is, however, so I was hoping to represent the original function as its biconjugate, so that I could use Convex.jl.
To test drive this, I wrote a little script for finding the conjugate and biconjugate of 1/2 x^2. This is a neat function that equals its conjugate, so its a good test. I thought would work, but doesn’t.
function conjugate(z) x = Variable() y = 1/2*x^2 problem = maximize(z*x-y) solve!(problem, SCSSolver(verbose=false)) return problem.optval end function biconjugate(x) z = Variable() problem = maximize(x*z-conjugate(z)) solve!(problem, SCSSolver(verbose=false)) return problem.optval end
conjugate(z) behaves correctly, approximately returning 1/2 z^2
ERROR: multiplication of two non-constant expressions is not DCP compliant
It gives the same error even if the biconjugate problem is written
problem = maximize(Constant(x)*z-conjugate(z))
What’s going on here? I could understand if Convex.jl didn’t recognize conjugate(z) as convex, but the multiplication error indicates a problem with Constant(x)*z.
(Using Julia v0.6)