问题
I am solving an ILP with Pyomo and GLPK. Running on the command line, pyomo outputs the time in seconds it takes for each step. Now, when I look into the results.json file that is output, I get a section that looks like this:
"Solver": [
{
"Error rc": 0,
"Statistics": {
"Branch and bound": {
"Number of bounded subproblems": "13",
"Number of created subproblems": "13"
}
},
"Status": "ok",
"Termination condition": "optimal",
"Time": 2.9578073024749756
}
]
What is the meaning of "Time" in this context? I am trying to lower the solving time by applying heuristics to fix some variables. Interestingly, this does not lower the command line running time, but significantly does for the time value in the results.json file.
回答1:
It corresponds to the time actually spent in the solver. Total time, from the view of the command-line, will include (1) the time to build the Pyomo model, (2) the time to translate the Pyomo model into whatever form the solver expects (e.g., an LP file), (3) the time spent inside of the solver, and (4) the time spent loading the solver solution back into the Pyomo model.
As models become really large, (1) and (2) can start to become significant. For relatively easy model classes (e.g., LP's and sometimes MIPs), you will likely start to hit a bottleneck with Pyomo before industrial solvers like Cplex and Gurobi begin to struggle, but there are steps you can take to lower the Pyomo time when that becomes an issue. For more difficult model classes (e.g., MINLP), you are likely to hit the limitations of current solver capabilities before Pyomo (Python) processing time becomes an issue.
来源:https://stackoverflow.com/questions/45034035/meaning-of-time-in-pyomos-results-json