PyROS
(class from pyomo.contrib.pyros.pyros
)
- class pyomo.contrib.pyros.pyros.PyROS[source]
Bases:
object
PyROS (Pyomo Robust Optimization Solver) implementing a generalized robust cutting-set algorithm (GRCS) to solve two-stage NLP optimization models under uncertainty.
- __init__()
Methods
__init__
()available
([exception_flag])Check if solver is available.
License for using PyROS
solve
(model, first_stage_variables, ...)Solve a model.
version
()Return a 3-tuple describing the solver version.
Attributes
CONFIG
Member Documentation
- solve(model, first_stage_variables, second_stage_variables, uncertain_params, uncertainty_set, local_solver, global_solver, **kwds)[source]
Solve a model.
- Parameters:
model (ConcreteModel) – The deterministic model.
first_stage_variables (VarData, Var, or iterable of VarData/Var) – First-stage model variables (or design variables).
second_stage_variables (VarData, Var, or iterable of VarData/Var) – Second-stage model variables (or control variables).
uncertain_params (ParamData, Param, or iterable of ParamData/Param) – Uncertain model parameters. The mutable attribute for all uncertain parameter objects must be set to True.
uncertainty_set (UncertaintySet) – Uncertainty set against which the solution(s) returned will be confirmed to be robust.
local_solver (str or solver type) – Subordinate local NLP solver. If a str is passed, then the str is cast to
SolverFactory(local_solver)
.global_solver (str or solver type) – Subordinate global NLP solver. If a str is passed, then the str is cast to
SolverFactory(global_solver)
.
- Returns:
return_soln – Summary of PyROS termination outcome.
- Return type:
- Keyword Arguments:
time_limit (NonNegativeFloat, optional) – Wall time limit for the execution of the PyROS solver in seconds (including time spent by subsolvers). If None is provided, then no time limit is enforced.
keepfiles (bool, default=False) – Export subproblems with a non-acceptable termination status for debugging purposes. If True is provided, then the argument subproblem_file_directory must also be specified.
tee (bool, default=False) – Output subordinate solver logs for all subproblems.
load_solution (bool, default=True) – Load final solution(s) found by PyROS to the deterministic model provided.
symbolic_solver_labels (bool, default=False) – True to ensure the component names given to the subordinate solvers for every subproblem reflect the names of the corresponding Pyomo modeling components, False otherwise.
objective_focus (InEnum[ObjectiveType], default=<ObjectiveType.nominal: 2>) –
Objective focus for the master problems:
ObjectiveType.nominal: Optimize the objective function subject to the nominal uncertain parameter realization.
ObjectiveType.worst_case: Optimize the objective function subject to the worst-case uncertain parameter realization.
By default, ObjectiveType.nominal is chosen.
A worst-case objective focus is required for certification of robust optimality of the final solution(s) returned by PyROS. If a nominal objective focus is chosen, then only robust feasibility is guaranteed.
nominal_uncertain_param_vals (list, default=[]) – Nominal uncertain parameter realization. Entries should be provided in an order consistent with the entries of the argument uncertain_params. If an empty list is provided, then the values of the Param objects specified through uncertain_params are chosen.
decision_rule_order (In[0, 1, 2], default=0) –
Order (or degree) of the polynomial decision rule functions for approximating the adjustability of the second stage variables with respect to the uncertain parameters.
Choices are:
0: static recourse
1: affine recourse
2: quadratic recourse
solve_master_globally (bool, default=False) – True to solve all master problems with the subordinate global solver, False to solve all master problems with the subordinate local solver. Along with a worst-case objective focus (see argument objective_focus), solving the master problems to global optimality is required for certification of robust optimality of the final solution(s) returned by PyROS. Otherwise, only robust feasibility is guaranteed.
max_iter (positive int or -1, default=-1) – Iteration limit. If -1 is provided, then no iteration limit is enforced.
robust_feasibility_tolerance (NonNegativeFloat, default=0.0001) – Relative tolerance for assessing maximal inequality constraint violations during the GRCS separation step.
separation_priority_order (dict, default={}) – Mapping from model inequality constraint names to positive integers specifying the priorities of their corresponding separation subproblems. A higher integer value indicates a higher priority. Constraints not referenced in the dict assume a priority of 0. Separation subproblems are solved in order of decreasing priority.
progress_logger (None, str or logging.Logger, default=<PreformattedLogger pyomo.contrib.pyros (INFO)>) – Logger (or name thereof) used for reporting PyROS solver progress. If None or a str is provided, then
progress_logger
is cast tologging.getLogger(progress_logger)
. In the default case, progress_logger is set to apyomo.contrib.pyros.util.PreformattedLogger
object of levellogging.INFO
.backup_local_solvers (str, solver type, or Iterable of str/solver type, default=[]) – Additional subordinate local NLP optimizers to invoke in the event the primary local NLP optimizer fails to solve a subproblem to an acceptable termination condition.
backup_global_solvers (str, solver type, or Iterable of str/solver type, default=[]) – Additional subordinate global NLP optimizers to invoke in the event the primary global NLP optimizer fails to solve a subproblem to an acceptable termination condition.
subproblem_file_directory (Path, optional) – Directory to which to export subproblems not successfully solved to an acceptable termination condition. In the event
keepfiles=True
is specified, a str or path-like referring to an existing directory must be provided.bypass_local_separation (bool, default=False) – This is an advanced option. Solve all separation subproblems with the subordinate global solver(s) only. This option is useful for expediting PyROS in the event that the subordinate global optimizer(s) provided can quickly solve separation subproblems to global optimality.
bypass_global_separation (bool, default=False) – This is an advanced option. Solve all separation subproblems with the subordinate local solver(s) only. If True is chosen, then robustness of the final solution(s) returned by PyROS is not guaranteed, and a warning will be issued at termination. This option is useful for expediting PyROS in the event that the subordinate global optimizer provided cannot tractably solve separation subproblems to global optimality.