(class from pyomo.contrib.pyros.uncertainty_sets)
pyomo.contrib.pyros.uncertainty_sets
Bases: UncertaintySet
UncertaintySet
A hyperrectangle (or box).
bounds ((N, 2) array_like) – Lower and upper bounds for each dimension of the set.
Notes
The \(n\)-dimensional box set is defined by
in which \(q^\text{L} \in \mathbb{R}^n\) refers to numpy.array(bounds)[:, 0], and \(q^\text{U} \in \mathbb{R}^n\) refers to numpy.array(bounds)[:, 1].
numpy.array(bounds)[:, 0]
numpy.array(bounds)[:, 1]
Examples
1D box set (interval):
>>> from pyomo.contrib.pyros import BoxSet >>> interval = BoxSet(bounds=[(1, 2)]) >>> interval.bounds array([[1, 2]])
2D box set:
>>> box_set = BoxSet(bounds=[[1, 2], [3, 4]]) >>> box_set.bounds array([[1, 2], [3, 4]])
5D hypercube with bounds 0 and 1 in each dimension:
>>> hypercube_5d = BoxSet(bounds=[[0, 1]] * 5) >>> hypercube_5d.bounds array([[0, 1], [0, 1], [0, 1], [0, 1], [0, 1]])
Initialize self (see class docstring).
Methods
__init__(bounds)
__init__
compute_auxiliary_uncertain_param_vals(point)
compute_auxiliary_uncertain_param_vals
Compute auxiliary uncertain parameter values for a given point.
is_bounded(config)
is_bounded
Determine whether the uncertainty set is bounded.
is_nonempty(config)
is_nonempty
Determine whether the uncertainty set is nonempty.
point_in_set(point)
point_in_set
Determine whether a given point lies in the uncertainty set.
set_as_constraint([uncertain_params, block])
set_as_constraint
Construct a block of Pyomo constraint(s) defining the uncertainty set on variables representing the uncertain parameters, for use in a two-stage robust optimization problem or subproblem (such as a PyROS separation subproblem).
validate(config)
validate
Check BoxSet validity.
Attributes
bounds
Lower and upper bounds for each dimension of the set.
dim
Dimension N of the box set.
geometry
Geometry of the box set.
parameter_bounds
Bounds in each dimension of the box set.
type
Brief description of the type of the uncertainty set.
Member Documentation
Compute auxiliary uncertain parameter values for a given point. The point need not be in the uncertainty set.
point ((N,) array-like) – Point of interest.
solver (Pyomo solver, optional) – If needed, a Pyomo solver with which to compute the auxiliary values.
aux_space_pt – Computed auxiliary uncertain parameter values.
numpy.ndarray
config (ConfigDict) – PyROS solver configuration.
True if the uncertainty set is certified to be bounded, and False otherwise.
bool
This check is carried out by checking if all parameter bounds are finite.
If no parameter bounds are available, the following processes are run to perform the check: (i) feasibility-based bounds tightening is used to obtain parameter bounds, and if not all bound are found, (ii) solving a sequence of maximization and minimization problems (in which the objective for each problem is the value of a single uncertain parameter). If any of the optimization models cannot be solved successfully to optimality, then False is returned.
This method is invoked by self.validate().
self.validate()
True if the uncertainty set is nonempty, and False otherwise.
point ((N,) array-like) – Point (parameter value) of interest.
True if the point lies in the uncertainty set, False otherwise.
This method is invoked at the outset of a PyROS solver call to determine whether a user-specified nominal parameter realization lies in the uncertainty set.
uncertain_params (None, Var, or list of Var, optional) – Variable objects representing the (main) uncertain parameters. If None is passed, then new variable objects are constructed.
block (BlockData or None, optional) – Block on which to declare the constraints and any new variable objects. If None is passed, then a new block is constructed.
A collection of the components added or addressed.
UncertaintyQuantification
ValueError – If any uncertainty set attributes are not valid. (e.g., numeric values are infinite, or self.parameter_bounds has LB > UB.)
self.parameter_bounds
The bounds of a BoxSet instance can be changed, such that the dimension of the set remains unchanged.
(N, 2) numpy.ndarray
int
Geometry
Bounds in each dimension of the box set. This is numerically equivalent to the bounds attribute.
List, length N, of coordinate value (lower, upper) bound pairs.
list[tuple[numbers.Real, numbers.Real]]
str