Skip to main content

Different solutions when changing the Threads parameter

Answered

Comments

6 comments

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    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
  • Jacob Wren
    Gurobi-versary
    Curious
    Collaborator

    Hi Jaromil,

    Isn't this answer only relevant to mixed integer programming?

    Thanks,

    Jake

    0
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    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
  • Jacob Wren
    Gurobi-versary
    Curious
    Collaborator

    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
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    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
  • Jacob Wren
    Gurobi-versary
    Curious
    Collaborator

    Ahh. Thank you, Jaromił!

    0

Please sign in to leave a comment.