Skip to content

Commit 030d976

Browse files
Sebastian Hegersebheger
authored andcommitted
Fix gap setting after optimize
Fixed rare case when gurobi returns unbounded model with a worthless solution
1 parent f14bd68 commit 030d976

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

mip/model.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,8 +616,11 @@ def optimize(
616616
)
617617

618618
self._status = self.solver.optimize(relax)
619-
# has a solution and is a MIP
620-
if self.num_solutions and self.num_int > 0:
619+
# has a solution
620+
if self._status in (
621+
mip.OptimizationStatus.OPTIMAL,
622+
mip.OptimizationStatus.FEASIBLE,
623+
) and self.num_int > 0:
621624
best = self.objective_value
622625
lb = self.objective_bound
623626
if abs(best) <= 1e-10:

0 commit comments

Comments
 (0)