FactorModelSet

(class from pyomo.contrib.pyros.uncertainty_sets)

class pyomo.contrib.pyros.uncertainty_sets.FactorModelSet(origin, number_of_factors, psi_mat, beta)[source]

Bases: UncertaintySet

A factor model (i.e., “net-alpha” model) set.

Parameters:
  • origin ((N,) array_like) – Uncertain parameter values around which deviations are restrained.

  • number_of_factors (int) – Natural number representing the dimension of the space to which the set projects.

  • psi_mat ((N, F) array_like) – Matrix, of full column rank, designating each uncertain parameter’s contribution to each factor. Each row is associated with a separate uncertain parameter. Each column is associated with a separate factor. Number of columns F of psi_mat should be equal to number_of_factors. Since psi_mat is expected to be full column rank, we require F <= N.

  • beta (numeric type) – Real value between 0 and 1 specifying the fraction of the independent factors that can simultaneously attain their extreme values.

Examples

A 4D factor model set with a 2D factor space:

>>> from pyomo.contrib.pyros import FactorModelSet
>>> import numpy as np
>>> fset = FactorModelSet(
...     origin=np.zeros(4),
...     number_of_factors=2,
...     psi_mat=[[0, 0.1], [0, 0.1], [0.1, 0], [0.1, 0]],
...     beta=0.5,
... )
>>> fset.origin
array([0., 0., 0., 0.])
>>> fset.number_of_factors
2
>>> fset.psi_mat
array([[0. , 0.1],
       [0. , 0.1],
       [0.1, 0. ],
       [0.1, 0. ]])
>>> fset.beta
0.5
__init__(origin, number_of_factors, psi_mat, beta)[source]

Initialize self (see class docstring).

Methods

__init__(origin, number_of_factors, psi_mat, ...)

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 factor model 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

beta

Real number ranging from 0 to 1 representing the fraction of the independent factors that can simultaneously attain their extreme values.

dim

Dimension N of the factor model set.

geometry

Geometry of the factor model set.

number_of_factors

Natural number representing the dimension F of the space to which the set projects.

origin

Uncertain parameter values around which deviations are restrained.

parameter_bounds

Bounds in each dimension of the factor model set.

psi_mat

Factor loading matrix, i.e., a full column rank matrix for which each entry indicates how strongly the factor corresponding to the entry's column is related to the uncertain parameter corresponding to the entry's row.

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

Determine whether a given point lies in the factor model 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

property beta

Real number ranging from 0 to 1 representing the fraction of the independent factors that can simultaneously attain their extreme values.

Note that, mathematically, setting beta = 0 will enforce that as many factors will be above 0 as there will be below 0 (i.e., “zero-net-alpha” model). If beta = 1, then the set is numerically equivalent to a BoxSet with bounds [self.origin - psi @ np.ones(F), self.origin + psi @ np.ones(F)].T.

Type:

numeric type

property dim

Dimension N of the factor model set.

Type:

int

property geometry

Geometry of the factor model set. See the Geometry class documentation.

property number_of_factors

Natural number representing the dimension F of the space to which the set projects.

This attribute is immutable, may only be set at object construction, and must be equal to the number of columns of the factor loading matrix self.psi_mat. Therefore, since we also require that self.psi_mat be full column rank, number_of_factors must not exceed the set dimension.

Type:

int

property origin

Uncertain parameter values around which deviations are restrained.

Type:

(N,) numpy.ndarray

property parameter_bounds

Bounds in each dimension of the factor model set.

Returns:

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

Return type:

list of tuples

property psi_mat

Factor loading matrix, i.e., a full column rank matrix for which each entry indicates how strongly the factor corresponding to the entry’s column is related to the uncertain parameter corresponding to the entry’s row. Since psi_mat is expected to be full column rank, we require F <= N.

Type:

(N, F) numpy.ndarray

property type

Brief description of the type of the uncertainty set.

Type:

str