picos.expressions.uncertain.pert_scenario

Implements ScenarioPerturbationSet.

Classes

class picos.expressions.uncertain.pert_scenario.ScenarioPerturbationSet(parameter_name, scenarios, compute_hull=None)[source]

Bases: PerturbationUniverse

A scenario description of a Perturbation.

Definition

An instance \Theta of this class defines a perturbation parameter

\theta \in \Theta = \operatorname{conv}(S)

where S \subset \mathbb{R}^{m \times n} is a finite set of scenarios and \operatorname{conv} denotes the convex hull.

Usually, the scenarios are observed or projected realizations of the uncertain data and \theta is used to represent the data directly.

Example

>>> from picos.uncertain import ScenarioPerturbationSet
>>> scenarios = [[1, -1], [1, 1], [-1, -1], [-1, 1], [0, 0]]
>>> S = ScenarioPerturbationSet("s", scenarios, False); S
<2×1 Scenario Perturbation Set: conv({5 2×1 scenarios})>
>>> s = S.parameter; s
<2×1 Perturbation: s>
>>> # Compute largest sum of entries over all points in S.
>>> value, realization = S.worst_case(s[0] + s[1], "max")
>>> round(value,  4)
2.0
>>> print(realization)
[ 1.00e+00]
[ 1.00e+00]
__init__(parameter_name, scenarios, compute_hull=None)[source]

Create a ScenarioPerturbationSet.

Parameters
  • parameter_name (str) – Name of the parameter that lives in the set.

  • scenarios (anything recognized by picos.Samples) – A collection of data points of same shape representing S.

  • compute_hull (bool) – Whether to use SciPy to compute the convex hull of the data points and discard points in the interior. This can speed up the solution process significantly, in particular when the scenarios come from observations and when the data is low-dimensional. On the other hand, when the given scenarios are known to be on the boundary of their convex hull, then disabling this speeds up initialization of the perturbation set. The default value of None means True when SciPy is available and False otherwise.

worst_case(scalar, direction)[source]

Implement for PerturbationUniverse.

property distributional

Implement for PerturbationUniverse.

property parameter

Implement for PerturbationUniverse.

property scenarios

The registered scenarios as a Samples object.