From f7453bcd7ea34fff096ce1441ecd0b18ac2e8746 Mon Sep 17 00:00:00 2001 From: Miles Lubin Date: Sun, 19 Feb 2017 21:31:43 -0500 Subject: [PATCH] hack to correct getobjbound --- src/GLPKInterfaceMIP.jl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/GLPKInterfaceMIP.jl b/src/GLPKInterfaceMIP.jl index f2f80bc..627f2ba 100644 --- a/src/GLPKInterfaceMIP.jl +++ b/src/GLPKInterfaceMIP.jl @@ -509,7 +509,17 @@ end getobjval(lpm::GLPKMathProgModelMIP) = GLPK.mip_obj_val(lpm.inner) -getobjbound(lpm::GLPKMathProgModelMIP) = lpm.objbound +function getobjbound(lpm::GLPKMathProgModelMIP) + # This is a hack. We observed some cases where mip_status == OPT + # and objval and objbound didn't match. + # We can fix this case, but objbound may still be incorrect in + # cases where the solver terminates early. + if GLPK.mip_status(lpm.inner) == GLPK.OPT + return GLPK.mip_obj_val(lpm.inner) + else + return lpm.objbound + end +end function getsolution(lpm::GLPKMathProgModelMIP) lp = lpm.inner