Skip to main content

Gurobi solvetime in pyomo

Answered

Comments

2 comments

  • Riley Clement
    • Gurobi Staff

    Hi Zhiyu,

    I've had a look and this issue is independent of Gurobi version.

    The exact change that causes the difference in behavior was introduced in this commit:

    https://github.com/Pyomo/pyomo/commit/35877632ef13c2a80aff01c7de479405ce0de777

    This commit is not directly related to the “Time” attribute, but causes Pyomo to call Gurobi in a different way, and the Time attribute is not added.

    To me it looks like the “Time” attribute is a mistake and should never have been there.  It's also not clear what the time is referring to, but it is certainly not the optimization time.  To me it looks like accessing the optimization time should be done via results.solver.wall_time

    - Riley

     

    0
  • Daniel Montes
    • First Comment

    Pyomo devs are refactoring the solver interfaces.

    You can now use the latests Gurobi interface with:

    from pyomo.contrib.solver.solvers.gurobi_direct import GurobiDirect
    
    opt = GurobiDirect()
    
    results = opt.solve(model)
    
    wall_time = results.timing_info["wall_time"]
    1

Please sign in to leave a comment.