CartesianProductSet

(class from pyomo.contrib.pyros.uncertainty_sets)

class pyomo.contrib.pyros.uncertainty_sets.CartesianProductSet(all_sets)[source]

Bases: UncertaintySet

A Cartesian product of uncertainty sets.

The order and identities of the uncertainty sets involved in the Cartesian product are immutable, and all sets in the product should be non-discrete.

Parameters:

all_sets (Sequence[UncertaintySet]) – Uncertainty sets of which the product is to be taken.

Raises:

TypeError – If any entry of all_sets is not of type UncertaintySet.

Notes

Given uncertainty sets \(\mathcal{Q}_1 \in \mathbb{R}^{n_1}\), \(\mathcal{Q}_2 \in \mathbb{R}^{n_2}\), \(\dots\), \(\mathcal{Q}_m \in \mathbb{R}^{n_m}\), collectively represented by the argument all_sets, the \((n_1 + n_2 + \dots + n_m)\)-dimensional Cartesian product set is defined by

\[\mathcal{Q}_1 \times \mathcal{Q}_2 \times \cdots \times \mathcal{Q}_m.\]

Examples

Cartesian product of 1D box/interval and 2D hypersphere (circle):

>>> from pyomo.contrib.pyros import (
...     BoxSet, AxisAlignedEllipsoidalSet, CartesianProductSet,
... )
>>> interval = BoxSet(bounds=[[-1.5, 1.5]])
>>> circle = AxisAlignedEllipsoidalSet(
...     center=[0, 0],
...     half_lengths=[2, 2],
... )
>>> cartesian_product = CartesianProductSet([interval, circle])
__init__(all_sets)[source]

Initialize self (see class docstring).

Methods

__init__(all_sets)

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)

Determine whether the uncertainty set is nonempty.

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

validate(config)

Validate the Cartesian product set instance.

Attributes

dim

Dimension of the cartesian product set.

geometry

Geometry of the Cartesian product set, assuming that there are no discrete sets.

parameter_bounds

Bounds for the value of each uncertain parameter constrained by the set (i.e. bounds for each set dimension).

type

Brief description of the type of the uncertainty set.

Member Documentation

compute_auxiliary_uncertain_param_vals(point, solver=None)[source]

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

is_nonempty(config)

Determine whether the uncertainty set is nonempty.

Parameters:

config (ConfigDict) – PyROS solver configuration.

Returns:

True if the uncertainty set is nonempty, and False otherwise.

Return type:

bool

point_in_set(point)[source]

Determine whether a given point lies in the uncertainty set.

Parameters:

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

Returns:

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

validate(config)[source]

Validate the Cartesian product set instance.

Parameters:

config (ConfigDict) – PyROS solver configuration.

Raises:

ValueError – If any set involved in the product has a discrete geometry.

property dim

Dimension of the cartesian product set.

Type:

int

property geometry

Geometry of the Cartesian product set, assuming that there are no discrete sets. See the Geometry class documentation.

Type:

Geometry

property parameter_bounds

Bounds for the value of each uncertain parameter constrained by the set (i.e. bounds for each set dimension).

Returns:

If the parameter_bounds method returns a nonempty list for all sets involved in the Cartesian product, then this list is of length self.dim and contain the (lower, upper) bound pairs. Otherwise, the list is empty.

Return type:

list[tuple[numbers.Real, numbers.Real]]

property type

Brief description of the type of the uncertainty set.

Type:

str