-
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
Fix issue #2452 #2464
Fix issue #2452 #2464
Conversation
So this seemed to do the job, but I'm not sure I can tell you why. |
What's happening for example in the test you added ?
In this example, |
Ah, but it is actually:
because when we try to get MathOptInterface.jl/src/Bridges/Constraint/bridges/vectorize.jl Lines 229 to 240 in 606ba2e
But MOI.get(model, attr, bridge.vector_constraint) returns the "unbridged" version of the function instead of the bridged. (Because it doesn't have a way to indicate that it will handle the variable bridges afterwards.)
The problematic method which does the unbridging is: MathOptInterface.jl/src/Bridges/bridge_optimizer.jl Lines 1380 to 1404 in 606ba2e
I tried adding some new |
Nightly failure is JuliaLang/julia#53896 (comment) |
Okay. I think I understand this a lot better now. I've simplified the implementation and everything looks green. |
I think we still need the |
Co-authored-by: Benoît Legat <benoit.legat@gmail.com>
Can you construct a test that demonstrates the current behavior is wrong? Otherwise, I vote we keep this as-is. I don't really understand the ins and outs of call-in-context. |
So perhaps if we kept the I've added a test that the user can't add a function with a constant if there are variable bridges. I don't know well this was ever tested. It didn't, for example, have a check for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking more about it, your implementation should also handle the tricky cases with nontrivial context, see the comments I have added. In the initial implementation, I thought getting the constraint function was going to give it in the solver variable but it gives it in the variables of the current context so your PR fixes it the best way I think
The implementation of what is going on at each level is certainly non-trivial. |
Thank you for your help on this issue! Unfortunately, I think this PR does not fully fix #2452. It seems that using the latest master branch, the result of the pure MOI MWE is now correct but the original MWE still gives the same (incorrect) result. Interestingly, using |
I've re-opened #2452. I'm sure I tested it at some point and it was fixed... |
Okay. I've dug deeper, and now I have no confidence that this was actually the right fix. It just fixed the surface level |
Fixes #2452
https://github.com/jump-dev/MathOptInterface.jl/actions/runs/8548954452https://github.com/jump-dev/MathOptInterface.jl/actions/runs/8550055568https://github.com/jump-dev/MathOptInterface.jl/actions/runs/8550389750