Skip to content

Commit 42beef8

Browse files
authored
Merge pull request #37 from JuliaOpt/ml/objbound
hack to correct getobjbound
2 parents c797259 + f7453bc commit 42beef8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/GLPKInterfaceMIP.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,17 @@ end
509509

510510
getobjval(lpm::GLPKMathProgModelMIP) = GLPK.mip_obj_val(lpm.inner)
511511

512-
getobjbound(lpm::GLPKMathProgModelMIP) = lpm.objbound
512+
function getobjbound(lpm::GLPKMathProgModelMIP)
513+
# This is a hack. We observed some cases where mip_status == OPT
514+
# and objval and objbound didn't match.
515+
# We can fix this case, but objbound may still be incorrect in
516+
# cases where the solver terminates early.
517+
if GLPK.mip_status(lpm.inner) == GLPK.OPT
518+
return GLPK.mip_obj_val(lpm.inner)
519+
else
520+
return lpm.objbound
521+
end
522+
end
513523

514524
function getsolution(lpm::GLPKMathProgModelMIP)
515525
lp = lpm.inner

0 commit comments

Comments
 (0)