Different solutions when changing the Threads parameter
AnsweredHello,
I am solving a linear program using Gurobi 9.5.2. I am solving in parallel. Additionally, I set the Method parameter to 4.
My solutions differ when I increase the Threads parameter from 1 to 2. The delta is small but non-zero (the solutions always match up to the first five decimal places).
Thanks,
Jake
-
Hi Jake,
The delta is small but non-zero (the solutions always match up to the first five decimal places).
Changing any parameter can lead to a slightly different final optimal solution point as long as MIPGap > 0. Please note that in some cases, due to machien precision and possible numerical inaccuracy, even for MIPGap = 0, the final optimal solution may be different in later decimal places for different runs. See also Is Gurobi deterministic?
Best regards,
Jaromił0 -
Hi Jaromil,
Isn't this answer only relevant to mixed integer programming?
Thanks,
Jake
0 -
Hi Jake,
Sorry, I missed that you are solving an LP.
For LP it can happen as well. This is because different algorithms are executed depending on the number of Threads.
You should try experimenting with the Method=0,1,2 values to see a possible slight difference in the objective value. This is because every algorithm, Primal/Dual Simplex and Barrier, are differently prone to numerical trouble and numerical inaccuracies. If you are interested in decimal places after the 5th one, you should try experimenting with the FeasibilityTol, OptimalityTol, NumericFocus, and Quad parameters.
Best regards,
Jaromił0 -
Hi Jaromil,
For LP it can happen as well. This is because different algorithms are executed depending on the number of Threads.
But I set the Method parameter to 4.
Thanks,
Jake
0 -
But I set the Method parameter to 4.
Yes, and from the documentation of the Method parameter:
Method=3 and Method=4 will run dual simplex, barrier, and sometimes primal simplex (depending on the number of available threads)
So running Method=4 with only 1 Thread will fire up only one algorithm while with 2 Threads it will fire up 2 algorithms. This may lead to a numerically slightly different optimal solution.
Best regards,
Jaromił0 -
Ahh. Thank you, Jaromił!
0
Please sign in to leave a comment.
Comments
6 comments