Skip to content

Commit

Permalink
Fix ray queries for Gurobi 8 (#175)
Browse files Browse the repository at this point in the history
* Fix ray queries for Gurobi 8

* Update comments
  • Loading branch information
odow authored Dec 5, 2018
1 parent 9959c0a commit c7cee79
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/MOIWrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,9 @@ end

function has_dual_ray(model::Optimizer)
try
# Note: for performance reasons, we only try to get 0 elements.
Gurobi.get_dblattrarray(model.inner, "FarkasDual", 1, 0)
# Note: for performance reasons, we try to get 1 element because for
# some versions of Gurobi, we cannot query 0 elements without error.
Gurobi.get_dblattrarray(model.inner, "FarkasDual", 1, 1)
return true
catch ex
if isa(ex, Gurobi.GurobiError)
Expand All @@ -514,8 +515,9 @@ end

function has_primal_ray(model::Optimizer)
try
# Note: for performance reasons, we only try to get 0 elements.
Gurobi.get_dblattrarray(model.inner, "UnbdRay", 1, 0)
# Note: for performance reasons, we try to get 1 element because for
# some versions of Gurobi, we cannot query 0 elements without error.
Gurobi.get_dblattrarray(model.inner, "UnbdRay", 1, 1)
return true
catch ex
if isa(ex, Gurobi.GurobiError)
Expand Down

0 comments on commit c7cee79

Please sign in to comment.