BoxSet

(class from pyomo.contrib.pyros.uncertainty_sets)

class pyomo.contrib.pyros.uncertainty_sets.BoxSet(bounds)[source]

Bases: UncertaintySet

A hyper-rectangle (i.e., “box”).

Parameters:

bounds ((N, 2) array_like) – Lower and upper bounds for each dimension of the set.

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] for idx in range(5)])
>>> hypercube_5d.bounds
array([[0, 1],
       [0, 1],
       [0, 1],
       [0, 1],
       [0, 1]])
__init__(bounds)[source]

Initialize self (see class docstring).

Methods

__init__(bounds)

Initialize self (see class docstring).

compute_auxiliary_uncertain_param_vals(point)

Compute auxiliary uncertain parameter values for a given point.

is_bounded(config)

Determine whether the uncertainty set is bounded.

is_nonempty(config)

Return True if the uncertainty set is nonempty, else False.

is_valid(config)

Return True if the uncertainty set is bounded and non-empty, else False.

point_in_set(point)

Determine whether a given point lies in the uncertainty set.

set_as_constraint([uncertain_params, block])

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).

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_param_vals(point, solver=None)

Compute auxiliary uncertain parameter values for a given point. The point need not be in the uncertainty set.

Parameters:
  • point ((N,) array-like) – Point of interest.

  • solver (Pyomo solver, optional) – If needed, a Pyomo solver with which to compute the auxiliary values.

Returns:

aux_space_pt – Computed auxiliary uncertain parameter values.

Return type:

numpy.ndarray

is_bounded(config)

Determine whether the uncertainty set is bounded.

Parameters:

config (ConfigDict) – PyROS solver configuration.

Returns:

True if the uncertainty set is certified to be bounded, and False otherwise.

Return type:

bool

Notes

This check is carried out by 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 during the validation step of a PyROS solver call.

is_nonempty(config)

Return True if the uncertainty set is nonempty, else False.

is_valid(config)

Return True if the uncertainty set is bounded and non-empty, else False.

point_in_set(point)

Determine whether a given point lies in the uncertainty set.

Parameters:

point ((N,) array-like) – Point (parameter value) of interest.

Returns:

is_in_set – True if the point lies in the uncertainty set, False otherwise.

Return type:

bool

Notes

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.

set_as_constraint(uncertain_params=None, block=None)[source]

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).

Parameters:
  • 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.

Returns:

A collection of the components added or addressed.

Return type:

UncertaintyQuantification

property bounds

Lower and upper bounds for each dimension of the set.

The bounds of a BoxSet instance can be changed, such that the dimension of the set remains unchanged.

Type:

(N, 2) numpy.ndarray

property dim

Dimension N of the box set.

Type:

int

property geometry

Geometry of the box set. See the Geometry class documentation.

property parameter_bounds

Bounds in each dimension of the box set. This is numerically equivalent to the bounds attribute.

Returns:

List, length N, of 2-tuples. Each tuple specifies the bounds in its corresponding dimension.

Return type:

list of tuples

property type

Brief description of the type of the uncertainty set.

Type:

str