-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for complex vector cones #2450
Comments
What is preventing Hypatia or a bridge from supporting Why do we need to define complex cones? Perhaps this issue is an ask for a bridge? |
I don't know, I don't understand the architecture of MOI. I guessed that one needed to define the complex cone in MOI because it has both @variable(model, t)
@variable(model, x[1:d] in ComplexPlane())
@constraint(model, [t;x] in NormInfinityCone()) instead. |
@blegat should chime in here. He has more thoughts on the design of the Complex bridges. |
In MOI, we assume that the components of cones are real because some bridges operations wouldn't be valid for complex numbers (e.g., SlackBridge creates real numbers). |
I see, so the only way to get a nice interface is to define the complex cones in JuMP. For the 2-norm cone it doesn't seem that a MOI version is necessary, as JuMP could directly translate it into a real 2-norm cone with For the other cones, though, a MOI layer is necessary (as far as I understand), as there is no direct translation into the real versions. As for determining whether the expressions are real or complex, isn't it exactly what @odow did in jump-dev/JuMP.jl#3695? |
Yes, you can see that it's considering that nonlinear expressions may be complex.
What do you mean by "no direct translation" ? Can you give an example ? |
Well it's what I wrote in the first comment; if |
So you could create I complex version |
Yep, that's it, although I think the most convenient definition would be |
Why would it be more convenient ? This isn't consistent with |
Because that's how Hypatia does it, so if you define it the same way no reshuffling will be necessary. I'm not a fan of the indexing in |
For the hermitian PSD cone, we can't change before MOI v2 since that would be breaking and I don't remember getting any comment on the choice of ordering (see #1962). |
I was referring to this comment and this bug. In any case I wasn't suggesting that the indexing should be changed, I was just saying it is not an example we should follow (although to be fair Hypatia is the only external package that is using the indexing, so it wouldn't really be breaking). But as for the infinity norm cone I don't think it really makes a difference, the reshuffling is simple enough that it won't cause any bugs. |
@araujoms is right, it was a surprisingly big pain actually to implement the various transformations between Hypatia's format and MOI's format. It is my fault though for not noticing that the proposed MOI format did not match the format Hypatia was already using at that point. I would love for the format to change to match Hypatia's in future (where complex off-diag entries are represented with consecutive real then imaginary parts). |
I don't really understand the problem of supporting If some bridges are invalid, then that is a bug and they should be fixed to not apply. I don't want to start adding a bunch of |
See #2451 |
What if you add |
🤷 If it is possible to support complex variables in the regular cones it would be more convenient for the users as well, I'd rather not have to switch between Some syntax would be needed to constrain variables upon creation, perhaps |
My point is that it should NOT get bridged by slack bridge, because slack cannot apply to complex functions. That is a bug. |
See #2468 for the bug fix removing Complex support from some bridges |
I don't really understand the julia> isreal(1 + im - im)
true So |
So I didn't want to break existing code (like Polynomials) for which we don't know. So we had to default to false positives. So we'd need to define In MOI 2.0, I'd like to switch to making bridges opt-in instead of opt-out. |
MOI 2.0 is still far in the future so I'd rather have a cleaner solution in the meantime. If we add the function and let PolyJuMP implement it before we use the function, I don't think we go for the function that default to assuming functions may be
A bridge is always equivalent to a mathematical relation between sets so if the function satisfies a few mathematical properties (e.g., being real), there is no reason we cannot opt-in by default. |
But this was the entire point. We have no way of knowing if an arbitrary |
I think it's sufficiently rare to define new MOI functions that we can have a list of functions that are required to be implemented for any |
Kinda agree. I see both arguments for MOI 2.0. But for now, disallowing bridges unless functions implement |
I'm also okay to make this function private for now. |
If the default of |
Is there anything left to do here? |
Could you please clarify what you have decided? So in the end you're not defining new complex sets, but allowing complex vectors to be added to the existing ones? So in order to get support for the complex norm one cone in Hypatia I need to add support for |
The variables are real but the cones may have complex entries. So |
Thanks for the information. I can't do this now, but I'll get around to it eventually. |
Yip. But this is just a straight up bug that has existed since we started allowing, for example, |
Sooo... |
Closing because I don't know if there is anything left to do here. Current suggestion is to add |
It would be nice to have the complex version of the vector cones defined in MOI, so that we have we nice a interface for the solvers that can handle them.
Specifically, the one I need is the infinity norm cone, but I think it also makes sense to add the 1-norm cone, as that is also directly supported by Hypatia, and the 2-norm cones, as they are so easy to do.
For solvers that cannot handle the cones directly maybe it's useful to add a bridge? One can rewrite
t >= norm(x,Inf)
in a horrendous way asand
t >= norm(x,1)
in an even uglier way aswhere
u
is a vector of optimization variables of the same length asx
.For the 2-norm cones I think the only thing that makes sense is to add a bridge, as
t >= norm(x)
can be nicely written as[t;real.(x);imag.(x)] in SecondOrderCone()
, and2*t*u >= norm(x)^2
as[t;u;real.(x);imag.(x)] in RotatedSecondOrderCone()
The text was updated successfully, but these errors were encountered: