-
Notifications
You must be signed in to change notification settings - Fork 82
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
Update list of excluded nonlinear tests #587
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #587 +/- ##
==========================================
- Coverage 92.16% 86.61% -5.56%
==========================================
Files 6 6
Lines 2630 2630
==========================================
- Hits 2424 2278 -146
- Misses 206 352 +146 ☔ View full report in Codecov by Sentry. |
These are a blocker for release. I need to look into what's going on. There might be an issue with bridging the scalar nonlinear objective function. |
Ah. I think it might be Gurobi.jl/src/MOI_wrapper/MOI_nonlinear.jl Line 330 in 729ecb9
which mucks up everything because the user didn't add these variables. |
The first issue I run into if I enable only MOI.supports(model, MOI.ObjectiveFunction{F}()) is false for Gurobi.jl. Further if I just run the body of the test: using Test
using Gurobi
MOI = Gurobi.MOI
env = Gurobi.Env()
model = Gurobi.Optimizer(env)
MOI.Utilities.loadfromstring!(
model,
"""
variables: w, x, y, z
minobjective: ScalarNonlinearFunction(w * z * (w + x + y) + y)
c2: ScalarNonlinearFunction(w * x * y * z) >= 25.0
c3: ScalarNonlinearFunction(w^2 + x^2 + y^2 + z^2) == 40.0
w in Interval(1.0, 5.0)
x in Interval(1.0, 5.0)
y in Interval(1.0, 5.0)
z in Interval(1.0, 5.0)
""",
) then I get the expected error
So is there a testing issue to sort out first? Or is MOI confused by the support for nonlinear constraints but not nonlinear objectives? |
The julia> @requires MOI.supports(model, MOI.ObjectiveFunction{F}())
ERROR: LoadError: RequirementUnmet: MOI.supports(model, MOI.ObjectiveFunction{F}()) |
Your point is for e.g. the hs071 tests, the following does not work as expected due to the added variables?
So we should be adding the variables directly in the Gurobi API, not through MOI? |
The tests run with a bridge that reformulates the objective into an epigraph constraint: Gurobi.jl/test/MOI/MOI_wrapper.jl Lines 49 to 50 in 9720c80
Yes, we also need to check that any other bookkeeping related to adding variables/columns is still valid. |
The tests are still running locally, but this is going in the right direction. |
@odow do you need any input from us here? Are the additional variables something that JuMP/MOI can handle, or not? |
The additional variables need to be filtered out of all the various calls so that from MOI's point of view they don't exist. This also affects variable deletion, etc. I think the current This PR is a good start if you want to keep going. I don't remember where I got up to exactly, but I think it's a blocker for releasing v12, unless we want to mark it as experimental with some known bugs. |
Why add them to the MOI layer if they just need to be filtered out at every step afterwards? Wouldn't it be simpler not to track them at all in MOI and have them only exist in the Gurobi model? |
I think I tried that to begin with, but then it made deletion hard. If you delete the nonlinear constraint you also have to delete the variable and then shift all the indices? This PR might not be the best approach. |
True, but @torressa sorted out that logic for deletion of regular variables, so I imagine the same approach would work here. I'll give it a go (in a separate PR to avoid breaking your work here). |
Closing in favour of #590 |
Let's see what the damage is