From c7cee79e1747665e7e6ab2d1f571d589298b9ccb Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Wed, 5 Dec 2018 11:01:43 -0600 Subject: [PATCH] Fix ray queries for Gurobi 8 (#175) * Fix ray queries for Gurobi 8 * Update comments --- src/MOIWrapper.jl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/MOIWrapper.jl b/src/MOIWrapper.jl index d8dacea8..2b4d45d4 100644 --- a/src/MOIWrapper.jl +++ b/src/MOIWrapper.jl @@ -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) @@ -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)