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 of this class defines a perturbation parameter
where is a finite set of scenarios and denotes the convex hull.
Usually, the scenarios are observed or projected realizations of the uncertain data and 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 .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
meansTrue
when SciPy is available andFalse
otherwise.
- worst_case(scalar, direction)[source]¶
Implement for
PerturbationUniverse
.
- property distributional¶
Implement for
PerturbationUniverse
.
- property parameter¶
Implement for
PerturbationUniverse
.