Why the difference in time is considerable when I use Gurobi to solve the same model formulated by gurobipy and Pyomo respectively?
AnsweredI am building a large linear programming model with tens of millions of variables using Pyomo, which occupies many RAM (over 128 GB). Therefore, I used gurobipy to rebuild this model to reduce the RAM. It works very well and RAM occupied decreased by 40%. BUT, I found the gurobi spend much more time solving the model built by gurobipy compared with Pyomo (one specific example is 760s vs 576s). As the gurobi log file shows, two models have the same number of rows and variables. Of course, the two models also have the same optimization results. I have tested different parameter combinations of the model multiple times which has consistent results. The time difference is found in the process of DPushes and PPushes. I am not sure what happened, could you provide some insights about this? thanks a lot.
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
It is very possible that Pyomo adds variables and constraints to the model in a slightly different order. This can already have an impact on the model's performance, cf. Is Gurobi Optimizer deterministic?
The time difference is found in the process of DPushes and PPushes
You could try experimenting with the Crossover parameter to overcome this difference.
Best regards,
Jaromił0 -
Dear Jaromił,
Thank you for your response.
I will double-check the order of variables or constraints to re-test the solution speed.
Best regards,
Zhanwei
0
Post is closed for comments.
Comments
3 comments