-
Notifications
You must be signed in to change notification settings - Fork 27
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
Possible Bug with Maximization in Lower Level #182
Comments
Can you try with a MIP solver and a MIP mode (sos, fortuny amat, indicator)? |
I can also reproduce this behavior with Gurobi and SOS1Mode(). using JuMP, BilevelJuMP, Gurobi
F = [1,2]
c = Dict(1=>1, 2=>1)
C = 1
a = 13
b = 1
model = BilevelModel(Gurobi.Optimizer, mode = BilevelJuMP.SOS1Mode())
@variable(Lower(model), q[F] >= 0)
@variable(Upper(model), Q >= 0)
@objective(Upper(model), Max, ((a-b * (q[1] + q[2] + Q)) * Q - C*Q) )
@objective(Lower(model), Max, ((a-b * (q[1] + q[2] + Q)) * q[1] - C*q[1] + (a-b * (q[1] + q[2] + Q)) * q[2] - C*q[2] + b*q[1]*q[2]) )
set_optimizer_attribute(model, "NonConvex", 2)
optimize!(model)
@assert isapprox(value.(Q), 6; atol=1e-3)
@assert isapprox(value.(q).data, [2,2]; atol=1e-3) |
Managed to take a look at this now. For both Problems, the KKTs stated in BilevelJuMP are actually different. |
Thanks! I will take a look. |
Hi all,
great package, it really makes life a lot easier!
I noticed some strange behavior when the lower level problem is a maximization. See attached a MWE illustrating this, it is based on: Siddiqui S, Gabriel SA (2013). An sos1-based approach for solving mpecs with a natural gas market applica-
tion. Networks and Spatial Economics 13(2):205–227.
Since, in the original publication there are two lower level players, I reformulated both lower level problems into a single one (with equivalent KKTs).
When minimizing the negative of the lower objective, results are as expected. However running the same code but switching to maximizing the actual objective gives wrong results.
The MWE is:
Edit: In an earlier version, there has been a copy/paste issue, this is now corrected
The text was updated successfully, but these errors were encountered: