call_solver
(function from pyomo.contrib.pyros.util
)
- pyomo.contrib.pyros.util.call_solver(model, solver, config, timing_obj, timer_name, err_msg)[source]
Solve a model with a given optimizer, keeping track of wall time requirements.
- Parameters:
model (ConcreteModel) – Model of interest.
solver (Pyomo solver type) – Subordinate optimizer.
config (ConfigDict) – PyROS solver settings.
timing_obj (TimingData) – PyROS solver timing data object.
timer_name (str) – Name of sub timer under the hierarchical timer contained in
timing_obj
to start/stop for keeping track of solve time requirements.err_msg (str) – Message to log through
config.progress_logger.exception()
in event an ApplicationError is raised while attempting to solve the model.
- Returns:
Solve results. Note that
results.solver
contains an additional attribute, named afterTIC_TOC_SOLVE_TIME_ATTR
, of which the value is set to the recorded solver wall time.- Return type:
- Raises:
ApplicationError – If ApplicationError is raised by the solver. In this case, err_msg is logged through
config.progress_logger.exception()
before the exception is raised.