pyomo
pyomo copied to clipboard
Fix PyROS Subordinate Optimizer Solve Time Access Routines
Fixes #2441 .
Summary/Motivation:
PyROS currently attempts to access subordinate optimizer solve times through the custom-written routine pyros.util.get_time_from_solver invoked on a SolverResults object. However, this routine is prone to an exception in the event the SolverResults.solver attribute has no time attribute (particularly if the SolverResults object was returned by a subsolver interface not linked to GAMS).
Changes proposed in this PR:
- Redefine
pyros.util.get_time_from_solverto more gracefully handleSolverResultsobjects with potentially no timing attributes - Estimate subordinate optimizer solve times using the Pyomo
TicTocTimer(for use in event the subordinate optimizer does not write a measure of the solve time to theSolverResultsobject)
Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:
- I agree my contributions are submitted under the BSD license.
- I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.