PolyhedralSet

(class from pyomo.contrib.pyros.uncertainty_sets)

class pyomo.contrib.pyros.uncertainty_sets.PolyhedralSet(lhs_coefficients_mat, rhs_vec)[source]

Bases: UncertaintySet

A bounded convex polyhedron or polytope.

Parameters:
  • lhs_coefficients_mat ((M, N) array_like) – Left-hand side coefficients for the linear inequality constraints defining the polyhedral set.

  • rhs_vec ((M,) array_like) – Right-hand side values for the linear inequality constraints defining the polyhedral set. Each entry is an upper bound for the quantity lhs_coefficients_mat @ x, where x is an (N,) array representing any point in the polyhedral set.

Notes

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

\[\left\{ q \in \mathbb{R}^n\, \middle| \, A q \leq b \right\}\]

in which \(A \in \mathbb{R}^{m \times n}\) refers to lhs_coefficients_mat, and \(b \in \mathbb{R}^m\) refers to rhs_vec.

Examples

2D polyhedral set with 4 defining inequalities:

>>> from pyomo.contrib.pyros import PolyhedralSet
>>> pset = PolyhedralSet(
...     lhs_coefficients_mat=[[-1, 0], [0, -1], [-1, 1], [1, 0]],
...     rhs_vec=[0, 0, 0, 1],
... )
>>> pset.coefficients_mat
array([[-1,  0],
       [ 0, -1],
       [-1,  1],
       [ 1,  0]])
>>> pset.rhs_vec
array([0, 0, 0, 1])
__init__(lhs_coefficients_mat, rhs_vec)[source]

Initialize self (see class docstring).

Methods

__init__(lhs_coefficients_mat, rhs_vec)

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)

Check PolyhedralSet validity.

Attributes

coefficients_mat

Coefficient matrix for the (linear) inequality constraints defining the polyhedral set.

dim

Dimension N of the polyhedral set.

geometry

Geometry of the polyhedral set.

parameter_bounds

Bounds in each dimension of the polyhedral set.

rhs_vec

Right-hand side values (upper bounds) for the (linear) inequality constraints defining the polyhedral 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)

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)

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]

Check PolyhedralSet validity.

Raises:

ValueError – If any uncertainty set attributes are not valid. (e.g., numeric values are infinite, or self.coefficients_mat has column of zeros). If bounded and nonempty checks fail.

property coefficients_mat

Coefficient matrix for the (linear) inequality constraints defining the polyhedral set.

In tandem with the rhs_vec attribute, this matrix should be such that the polyhedral set is nonempty and bounded. Such a check is performed only at instance construction.

Type:

(M, N) numpy.ndarray

property dim

Dimension N of the polyhedral set.

Type:

int

property geometry

Geometry of the polyhedral set.

Type:

Geometry

property parameter_bounds

Bounds in each dimension of the polyhedral set.

Currently, an empty list is returned, as the bounds cannot, in general, be computed without access to an optimization solver.

property rhs_vec

Right-hand side values (upper bounds) for the (linear) inequality constraints defining the polyhedral set.

Type:

(M,) numpy.ndarray

property type

Brief description of the type of the uncertainty set.

Type:

str