Solver Runtime
回答済みHi,
I'm trying to do a time study of different formulations. My goal is to have a few formulations solve for the same thing, so the objective value and variable values will be the same, but what I should see change is the time it takes for the solver to solve the different formulations. How can I extract that time from Gurobi in Pyomo and append it into a list. That way I can create a plot of solver runtime vs formulation. I believe this is referred to as the Wall time.
Thank you
-
Hi Tyler,
According to Pyomo's documentation you can use the \(\texttt{get_model_attr("RunTime")}\) method.
Best regards,
Jaromił0 -
Hi Jaromil,
Thank you for getting back to me. I looked into this, but the operation you posted can only be used if you use the Gurobi persistent solver. The command does not work for the shell solver. Also, when I use the persistent solver vs just the shell solve I get noticeably different results. The solver time goes up by 50% when you use the persistent one. is there a command similar to this for when using just the shell solver? I know this adds another question, but why would the persistent solver require more time, if the model is the same.
Thank you,
Tyler
0 -
Hi Tyler,
For the shell solver, you should be able to directly use Gurobi methods unless there is another Pyomo layer on top of the Gurobi shell. In your case it would be the getAttr() method.
The solver time goes up by 50% when you use the persistent one. is there a command similar to this for when using just the shell solver? I know this adds another question, but why would the persistent solver require more time, if the model is the same.
It is often the case that 3rd party software manipulates the model a bit under the hood, e.g., they add constraints and/or variables in a different order. This can already be enough to affect the solver's performance. Thus, we recommend to use Gurobi's Python API. It is very intuitive and it shouldn't be hard to switch to Gurobi's native Python API if you have been working with Pyomo before.
Best regards,
Jaromił0
サインインしてコメントを残してください。
コメント
3件のコメント