IntersectionSet

(class from pyomo.contrib.pyros.uncertainty_sets)

class pyomo.contrib.pyros.uncertainty_sets.IntersectionSet(**unc_sets)[source]

Bases: UncertaintySet

An intersection of two or more uncertainty sets, each of which is represented by an UncertaintySet object.

Parameters:

**unc_sets (dict) – PyROS UncertaintySet objects of which to construct an intersection. At least two uncertainty sets must be provided. All sets must be of the same dimension.

Notes

The \(n\)-dimensional intersection set is defined by

\[\mathcal{Q}_1 \cap \mathcal{Q}_2 \cap \cdots \cap \mathcal{Q}_m\]

in which \(\mathcal{Q}_i \subset \mathbb{R}^n\) refers to the uncertainty set list(unc_sets.values())[i - 1] for \(i = 1, 2, \dots, m\).

Examples

Intersection of origin-centered 2D box (square) and 2D hypersphere (circle):

>>> from pyomo.contrib.pyros import (
...     BoxSet, AxisAlignedEllipsoidalSet, IntersectionSet,
... )
>>> square = BoxSet(bounds=[[-1.5, 1.5], [-1.5, 1.5]])
>>> circle = AxisAlignedEllipsoidalSet(
...     center=[0, 0],
...     half_lengths=[2, 2],
... )
>>> # to construct intersection, pass sets as keyword arguments.
>>> # keywords are arbitrary
>>> intersection = IntersectionSet(set1=square, set2=circle)
>>> intersection.all_sets
UncertaintySetList([...])
__init__(**unc_sets)[source]

Initialize self (see class docstring).

Methods

__init__(**unc_sets)

Initialize self (see class docstring).

compute_auxiliary_uncertain_param_vals(point)

Compute auxiliary uncertain parameter values for a given point.

intersect(Q1, Q2)

Obtain the intersection of two uncertainty sets, accounting for the case where either of the two sets is discrete.

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

Check IntersectionSet validity.

Attributes

all_sets

List of the uncertainty sets of which to take the intersection.

dim

Dimension of the intersection set.

geometry

Geometry of the intersection set.

parameter_bounds

Compute parameter bounds of the intersection set.

scenarios

If the set represented by self reduces to a discrete uncertainty set, then this attribute contains the scenarios that comprise the set.

type

Brief description of the type of the uncertainty set.

Member Documentation

static intersect(Q1, Q2)[source]

Obtain the intersection of two uncertainty sets, accounting for the case where either of the two sets is discrete.

Parameters:
Returns:

Intersection of the sets. A DiscreteScenarioSet is returned if both operand sets are DiscreteScenarioSet instances; otherwise, an IntersectionSet is returned.

Return type:

DiscreteScenarioSet or IntersectionSet

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 intersection set.

Parameters:

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

Returns:

True if the point lies in the set, False otherwise.

Return type:

bool

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]

Check IntersectionSet validity.

Raises:

ValueError – If finiteness or nonemptiness checks fail.

property all_sets

List of the uncertainty sets of which to take the intersection. Must be of minimum length 2.

This attribute may be set through any iterable of UncertaintySet objects, and exhibits similar behavior to a list.

Type:

UncertaintySetList

property dim

Dimension of the intersection set.

Type:

int

property geometry

Geometry of the intersection set.

Type:

Geometry

property parameter_bounds

Compute parameter bounds of the intersection set.

Returns:

If one of the sets to be intersected is discrete, then the list is of length self.dim and contains the coordinate value (lower, upper) bound pairs. Otherwise, an empty list is returned, as the bounds cannot, in general, be computed without access to an optimization solver.

Return type:

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

property scenarios

If the set represented by self reduces to a discrete uncertainty set, then this attribute contains the scenarios that comprise the set. Otherwise, a ValueError is raised.

Type:

list[tuple[numbers.Real, …]]

property type

Brief description of the type of the uncertainty set.

Type:

str