-
Notifications
You must be signed in to change notification settings - Fork 81
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
DNMY: MOI #125
Conversation
What about tagging a new release that covers 8.0 before merging this? |
Also dropping julia 0.5... |
Yes I was about to ask that. Shall we leave Julia 0.5, tag as v0.3.4, then drop julia 0.5, merge this and tag as v0.4.0? |
AFAIK we can't even tag a new version that claims to support 0.5. So drop 0.5 and tag Gurobi.jl 0.4. |
Tests are green! |
We decided on the name |
Renamed to |
I'm getting the same issue here as in jump-dev/GLPK.jl#53 (comment) : I can set |
test/MOIWrapper.jl
Outdated
nothing | ||
end | ||
|
||
MOI.set!(m, Gurobi.CallbackFunction(), callback_function) |
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.
# (0,0) +---+---+ (2,0) | ||
TOL = 1e-6 # Allow for some impreciseness in the solution | ||
if y_val - x_val > 1 + TOL | ||
Gurobi.cblazy!(cb_data, m, |
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.
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.
Oarsome!
test/MOIWrapper.jl
Outdated
if cb_where == Gurobi.CB_MIPSOL | ||
sol = [0.0, 0.0] | ||
Gurobi.cbget_mipsol_sol(cb_data, cb_where, sol) | ||
x_val, y_val = sol |
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.
The only thing is it's not clear how to inject the MIP solution back into MOI-land so that it can be queried via VariablePrimal
This is now rebased on to master. See jump-dev/MathOptInterface.jl#404, JuliaOpt/LinQuadOptInterface.jl#30, JuliaOpt/LinQuadOptInterface.jl#31 for the commented tests |
This (or LQOI) has an issue with duplicate terms in the affine part of the objective function: using MathOptInterface
using Gurobi
using Compat.Test
const MOI = MathOptInterface
atol = 1e-4
rtol = 1e-8
# Minimize (x - 1.5)^2 = x^2 - 3 * x + 2.25
model = GurobiOptimizer(OutputFlag=0)
v = MOI.addvariables!(model, 1)
# this works:
# obj = MOI.ScalarQuadraticFunction([MOI.ScalarAffineTerm(-3.0, v[1])], MOI.ScalarQuadraticTerm.(2.0, v, v), 2.25)
# this doesn't:
obj = MOI.ScalarQuadraticFunction([MOI.ScalarAffineTerm(-1.5, v[1]), MOI.ScalarAffineTerm(-1.5, v[1])], MOI.ScalarQuadraticTerm.(2.0, v, v), 2.25)
MOI.set!(model, MOI.ObjectiveFunction{MOI.ScalarQuadraticFunction{Float64}}(), obj)
MOI.set!(model, MOI.ObjectiveSense(), MOI.MinSense)
MOI.optimize!(model)
@test MOI.get(model, MOI.VariablePrimal(), v) ≈ [1.5] atol=atol rtol=rtol (This is the reason for tkoolen/Parametron.jl#31 (comment)). |
nvars = num_vars(instance.inner) | ||
obj = zeros(Float64, nvars) | ||
for (col, coef) in zip(columns, coefficients) | ||
obj[col] = coef |
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.
This should be a +=
to support duplicate terms.
Since MOI and LQOI are settling down, I'm going to merge this. We can fix up any outstanding issues in separate PRs. |
@odow did you resolve the issue with duplicate terms? It's fine if not, but we should open an issue to be sure it doesn't get forgotten. |
Blockers
This PR
I've copied the code from https://github.com/JuliaOpt/MathOptInterfaceGurobi.jl
MOI tests currently fail.