-
Notifications
You must be signed in to change notification settings - Fork 7
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
Compatibility with LinQuadOptInterface solvers (like Gurobi and GLPK) #31
Comments
Yeah, the other (non-OSQP) solver interfaces were pretty far behind, and I guess they're still not quite there. I see you already opened an issue with LQOI (JuliaOpt/LinQuadOptInterface.jl#32), which I was going to suggest. |
Oh, yeah, I was just about to cross-post that here 🙂 |
JuliaOpt/LinQuadOptInterface.jl#37 allows model = Model(GLPK.GLPKOptimizerLP())
x = Variable(model)
lhs = [x]
rhs = [0.]
@constraint model lhs <= rhs
solve!(model)
|
That MethodError is jump-dev/MathOptInterface.jl#426 |
Ok, I think I have the constraint issues worked out. Unfortunately, it looks like the way quadratic objectives are handled is different between OSQP and LQOI. Specifically, the doubling of the quadratic coefficients along the diagonal of the cost matrix results in the wrong answer being returned. For example: using SimpleQP, Gurobi
model = Model(GurobiOptimizer())
x = [Variable(model) for _ in 1:1]
@objective model Minimize (x[1] - 1.5)^2
solve!(model)
SimpleQP.value.(model, x) gives an optimal solution of 0.75, whereas if we undo the doubling by minimizing |
I think we can close this now. Currently requires master versions of MOI, LQOI, and solver packages. |
Currently, constrained optimization doesn't work with the upcoming Gurobi MOI interface. For example:
gives:
(using SimpleQP master, Gurobi.jl with jump-dev/Gurobi.jl#125 , MOI master, and LQOI with JuliaOpt/LinQuadOptInterface.jl#29 ).
It looks like LInQuadOptInterface defines the available
canset
/canmodify
methods, and it only supports things like scalar variable change rather than replacing the constraint function. Gurobi seems to have the relevant low-level APIs to change variable coefficients: https://www.gurobi.com/documentation/8.0/refman/c_grbchgcoeffs.html so I think this should at least be possible. For example, we could probably implement additionalcanset
/set!
methods in Gurobi.jl to supplement the ones implemented in LQOI. Or maybe we could update LQOI to allow setting an affine constraint function by using the availablemodify!
methods.The text was updated successfully, but these errors were encountered: