Getting correct result only when setting InFeasTol parameter
AnsweredHi,
I have a concern regarding the parameters set for Gurobi in Python. I know the solution to my mathematical model that I formulated however I get an incorrect value from Gurobi and I believe the reason is that Gurobi gives me values that are not 0 or 1 for binary variables.
To clarify, x(i,j,k) is a binary variable but here is a small screenshot of result I get from gurobi:
As you can see the value of objective function is 28.2 obtained by gurobi. However the correct value of objective function (which is total distance that I'm minimizing) should be 33.4 miles. On the same model now, when I set a parameter for tolerance by the following line, I get the correct answer:
m.Params.IntFeasTol = 1e09
But this makes the computational time increase significantly from 3 seconds to 8 minutes.
For my research, I have to compare two models that are different only in some constraints. So I need to get the same objective function value on both models which I do when I set this parameter to 1e09 on the first model. But since I get the correct value on the second model whitout this parameter, it runs faster although it is a larger model (based on number of variables an constraints) and this makes my comparison meaningless because I need to run both models under the same condition.
Is there any reason why I'm getting the wrong result without the tolerance value?

Hi Azi,
Is there any reason why I'm getting the wrong result without the tolerance value?
Every mathematical software has to work with tolerances due to floating point arithmetic (with very few exceptions). Thus, the solution you obtain is correct within tolerances. Decreasing these tolerances as you did with setting the IntFeasTol parameter is expected to deteriorate performance because more tedious computations have to be performed. You could try setting the IntegralityFocus parameter available in the latest version of Gurobi which will make Gurobi focus on true integer values, i.e., \(\{0,1\}\) in your case, only. Please note that using this parameter will very likely worsen the performance.
For more details of why tolerances are needed and may rise difficulties, please have a look at the the article by Ed Klotz on IllConditioning and Numerical Instability in MIPs.
Best regards,
Jaromił0
Please sign in to leave a comment.
Comments
1 comment