How to check the methods and attributes of pyomo SolverFactory

Viewed 14

I am using the following code to work with pyomo model.

opt = pe.SolverFactory('gurobi')
res = opt.solve(model, tee=False,options=solver_opt)
walltime = res.solver.time

I tried several times to get the code snippet "res.solver.time" for obtaining the "walltime". Hence, I want to know where I can get the full list of methods and attributes in "opt". Then I can obtain other useful information. Thank you for help.

1 Answers

Anytime I'm poking around for a particular feature, I keep a terminal window open with ipython and use the code introspection feature to poke around (input 4 below). Then you can use ? or ?? (deep info, typically the source code) to get more info as in input 3 below.

Just type the command, '.', tab and poke around

This is the same stuff you would get from any IDE that supports introspection based code completion. I like PyCharm for same reasons.

Realize of course that what is shown below are the methods associated with pyomo's opt object and NOT the solver (glpk in my case, gurobi in yours) options!

enter image description here

Related