adjust_solver_time_settings

(function from pyomo.contrib.pyros.util)

pyomo.contrib.pyros.util.adjust_solver_time_settings(timing_data_obj, solver, config)[source]

Adjust maximum time allowed for subordinate solver, based on total PyROS solver elapsed time up to this point.

Parameters:
  • timing_data_obj (Bunch) – PyROS timekeeper.

  • solver (solver type) – Subordinate solver for which to adjust the max time setting.

  • config (ConfigDict) – PyROS solver config.

Returns:

  • original_max_time_setting (float or None) – If IPOPT or BARON is used, a float is returned. If GAMS is used, the options.add_options attribute of solver is returned. Otherwise, None is returned.

  • custom_setting_present (bool or None) – If IPOPT or BARON is used, True if the max time is specified, False otherwise. If GAMS is used, True if the attribute options.add_options is not None, False otherwise. If config.time_limit is None, then None is returned.

Note

  1. Adjustment only supported for GAMS, BARON, and IPOPT interfaces. This routine can be generalized to other solvers after a generic Pyomo interface to the time limit setting is introduced.

  2. For IPOPT and BARON, the CPU time limit, rather than the wallclock time limit, may be adjusted, as there may be no means by which to specify the wall time limit explicitly.

  3. For GAMS, we adjust the time limit through the GAMS Reslim option. However, this may be overridden by any user specifications included in a GAMS optfile, which may be difficult to track down.

  4. To ensure the time limit is specified to a strictly positive value, the time limit is adjusted to a value of at least 1 second.