Sequential computing vs Parallel computing using Gurobi
AnsweredHi,
I'm solving a MILP using Gurobi in Julia. The optimisation is done independently for 10k firms. I tried two ways. One is to define the model first up to some model parameters, and then loop over firms, get firm-specific parameters, and implement optimize!(model) in the loop sequentially. The other way is to utilize parallel computation over firms and define the model @everywhere in each worker, call the model for each worker, and solve the optimization problem in parallel. However, I found that over 1000 firms, 6 firms have different results comparing sequential vs. parallel computation.
I tried to investigate the reason. In the first approach, if I define the model inside the loop such that each iteration(firm) calls the model again, the results are same as the parallel approach. So, I am wondering whether in a sequential setting, after one iteration of optimize!(model), whether there is any update in setting for the next iteration, because that could explain the differences. In parallel, every iteration calls a new (same) model, so there is no update of settings in Gurobi optimizer.
-
Hi,
I am not a Julia expert, but provided that the Julia interface can modify the Gurobi model without creating it from scratch and calls optimize() again on the updated model, you will most probably observe a different solution path. Gurobi tries to continue from the last results using as much information as possible from the last solve. This may lead to an alternative optimal solution having the same optimal objective value but potentially different variable values. Is this what happens when you mention "different results"?
Best regards,
Mario0
Please sign in to leave a comment.
Comments
1 comment