Pyomo: Access the solve time from solver

633 views
Skip to first unread message

sheif...@gmail.com

unread,
Feb 8, 2021, 9:53:13 AM2/8/21
to Pyomo Forum
Hello,

I am trying to test scalability for a model by timing a variety of sized problems. I am currently using Python's "time" feature before and after calling opt.solve(M) but for comparison I would also like to be able to access my solver's (Gurobi's) built-in timer for the actual solve itself (rather than the overall time for Pyomo to write the MIP and then for Gurobi to solve). However I am running into issues of accessing that value. Please advise! 

Thanks in advance! 

She'ifa
PhD Student (Mathematics)

Michael Bynum

unread,
Feb 8, 2021, 9:57:55 AM2/8/21
to Pyomo Forum
If you use the direct or persistent interface to Gurobi (https://pyomo.readthedocs.io/en/stable/advanced_topics/persistent_solvers.html), you can access the wall clock time:

res = opt.solve(m)
res.solver.wallclock_time

Michael

Reply all
Reply to author
Forward
0 new messages