DiscreteScenarioSet

(class from pyomo.contrib.pyros.uncertainty_sets)

class pyomo.contrib.pyros.uncertainty_sets.DiscreteScenarioSet(scenarios)[source]

Bases: UncertaintySet

A set of finitely many distinct points (or scenarios).

Parameters:

scenarios ((M, N) array_like) – A sequence of M distinct uncertain parameter realizations.

Notes

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

\[\left\{ q^1, q^2, \dots, q^m \right\}\]

in which \(q^i \in \mathbb{R}^n\) refers to scenarios[i - 1] for \(i = 1, 2, \dots, m\).

Examples

2D set with three scenarios:

>>> from pyomo.contrib.pyros import DiscreteScenarioSet
>>> discrete_set = DiscreteScenarioSet(
...     scenarios=[[1, 1], [2, 1], [1, 2]],
... )
>>> discrete_set.scenarios
[(1, 1), (2, 1), (1, 2)]
__init__(scenarios)[source]

Initialize self (see class docstring).

Methods

__init__(scenarios)

Initialize self (see class docstring).

compute_auxiliary_uncertain_param_vals(point)

Compute auxiliary uncertain parameter values for a given point.

is_bounded(config)

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

is_nonempty(config)

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

point_in_set(point)

Determine whether a given point lies in the discrete scenario 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 DiscreteScenarioSet validity.

Attributes

dim

Dimension N of the discrete scenario set.

geometry

Geometry of the discrete scenario set.

parameter_bounds

Bounds in each dimension of the discrete scenario set.

scenarios

Uncertain parameter realizations comprising the set.

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)

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

Parameters:

config (ConfigDict) – PyROS solver configuration.

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)[source]

Return 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 discrete scenario 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 DiscreteScenarioSet validity.

Raises:

ValueError – If finiteness or nonemptiness checks fail.

property dim

Dimension N of the discrete scenario set.

Type:

int

property geometry

Geometry of the discrete scenario set.

Type:

Geometry

property parameter_bounds

Bounds in each dimension of the discrete scenario set.

Returns:

List, length N, of coordinate value (lower, upper) bound pairs.

Return type:

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

property scenarios

Uncertain parameter realizations comprising the set. Each tuple is an uncertain parameter realization.

Note that the scenarios attribute may be modified, but only such that the dimension of the set remains unchanged.

Type:

list[tuple[numbers.Real, …]]

property type

Brief description of the type of the uncertainty set.

Type:

str