Skip to content

Commit

Permalink
Update LQOI (#178)
Browse files Browse the repository at this point in the history
* Prepare for upgraded LQOI

* Update REQUIRE
  • Loading branch information
odow authored Dec 17, 2018
1 parent 6bdf304 commit eb0b271
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
julia 0.6
MathProgBase 0.5 0.8
Compat 0.33
LinQuadOptInterface 0.4 0.5
LinQuadOptInterface 0.5 0.6
23 changes: 10 additions & 13 deletions src/MOIWrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ function LQOI.add_mip_starts!(model::Optimizer, columns::Vector{Int}, starts::Ve
update_model!(model.inner)
return
end
function MOI.supports(
::Optimizer, ::MOI.VariablePrimalStart, ::Type{MOI.VariableIndex})
return true
end


LQOI.solve_mip_problem!(model::Optimizer) = LQOI.solve_linear_problem!(model)

Expand All @@ -359,21 +364,13 @@ function LQOI.get_termination_status(model::Optimizer)
if stat == :loaded
return MOI.OtherError
elseif stat == :optimal
return MOI.Success
return MOI.Optimal
elseif stat == :infeasible
if has_dual_ray(model)
return MOI.Success
else
return MOI.InfeasibleNoResult
end
return MOI.Infeasible
elseif stat == :inf_or_unbd
return MOI.InfeasibleOrUnbounded
elseif stat == :unbounded
if has_primal_ray(model)
return MOI.Success
else
return MOI.UnboundedNoResult
end
return MOI.DualInfeasible
elseif stat == :cutoff
return MOI.ObjectiveLimit
elseif stat == :iteration_limit
Expand Down Expand Up @@ -418,7 +415,7 @@ end
function LQOI.get_dual_status(model::Optimizer)
stat = get_status(model.inner)
if is_mip(model.inner) || is_qcp(model.inner)
return MOI.UnknownResultStatus
return MOI.NoSolution
else
if stat == :optimal
return MOI.FeasiblePoint
Expand All @@ -430,7 +427,7 @@ function LQOI.get_dual_status(model::Optimizer)
return MOI.FeasiblePoint
end
end
return MOI.UnknownResultStatus
return MOI.NoSolution
end

function LQOI.get_variable_primal_solution!(model::Optimizer, dest)
Expand Down
10 changes: 7 additions & 3 deletions test/MOIWrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ end
end
@testset "ModelLike tests" begin
solver = Gurobi.Optimizer()

@test MOI.get(solver, MOI.SolverName()) == "Gurobi"

@testset "default_objective_test" begin
MOIT.default_objective_test(solver)
end
@testset "default_status_test" begin
MOIT.default_status_test(solver)
end
@testset "nametest" begin
MOIT.nametest(solver)
end
Expand Down Expand Up @@ -240,7 +244,7 @@ end
# We should have a primal feasible solution:
@test MOI.get(m, MOI.PrimalStatus()) == MOI.FeasiblePoint
# But we have no dual status:
@test MOI.get(m, MOI.DualStatus()) == MOI.UnknownResultStatus
@test MOI.get(m, MOI.DualStatus()) == MOI.NoSolution
end

@testset "Constant objective (issue #111)" begin
Expand Down

0 comments on commit eb0b271

Please sign in to comment.