Skip to content

Commit

Permalink
Fix gap setting after optimize
Browse files Browse the repository at this point in the history
Fixed rare case when gurobi returns unbounded model with a worthless solution
  • Loading branch information
Sebastian Heger authored and sebheger committed Mar 24, 2022
1 parent f14bd68 commit 030d976
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mip/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,11 @@ def optimize(
)

self._status = self.solver.optimize(relax)
# has a solution and is a MIP
if self.num_solutions and self.num_int > 0:
# has a solution
if self._status in (
mip.OptimizationStatus.OPTIMAL,
mip.OptimizationStatus.FEASIBLE,
) and self.num_int > 0:
best = self.objective_value
lb = self.objective_bound
if abs(best) <= 1e-10:
Expand Down

0 comments on commit 030d976

Please sign in to comment.