Gurobi produces different result when .mps file contains objective offset
AnsweredSo I have two .mps files (lets name them a.mps and b.mps). The only difference between them is that b.mps has objective offset:
RHS
RHS OBJROW 268550900
Gurobi finds feasible solution with the gap of 3.2052% for model in a.mps in 36 seconds, with best objective of 254'444'789.3. If we account for objective offset we get 14'106'110.7. As for the b.mps Gurobi finds feasible solution with the gap of 9.9425% in 19 minutes, with best objective of 6'716'250.0. Why it may be happening?
a.mps was created using pythonmip library with CoinorCbc as backend solver. I added objective offset line into b.mps manually. If I use Gurobi as backend solver in pythonmip, the resultant .mps is solved by Gurobi in a manner, similar to b.mps, which leads me to believe that solution of b.mps is the right one.
I guess, it may be to do with tolerances? Maybe while parsing .mps file, when it encounters value of particular magnitude it affects some tolerance settings?
Gurobi version: 9.5.1

A constant in the objective function can drastically change the relative MIPGap. Especially if the objective value jumps from very big to very small (in absolute values). Moreover, the addition of an objective constant may change the solution path, see Is Gurobi Optimizer deterministic?
If the rest of your model is well scaled and the objective constant is the only very big value, I would recommend to remove this constant from the objective and solve without it. You can always just add it after the optimization process has finished.
0 
Jaromił Najman Thank you for the reply. I get it now.
0
Please sign in to leave a comment.
Comments
2 comments