picos.expressions.uncertain.perturbation¶
Implements a parameterization for (random) noise in data.
Outline¶
Classes¶
A parameter that can be used to describe (random) noise in data. |
|
Base class for uncertain perturbation sets and distributions. |
|
Container for a pair of perturbation universe class type and subtype. |
Classes¶
Perturbation¶
-
class
picos.expressions.uncertain.perturbation.
Perturbation
(universe, name, shape)[source]¶ Bases:
picos.expressions.mutable.Mutable
,picos.expressions.uncertain.uexp_affine.UncertainAffineExpression
A parameter that can be used to describe (random) noise in data.
This is the initial building block for an
UncertainAffineExpression
. In particular, an affine transformation of this parameter represents uncertain data.-
__init__
(universe, name, shape)[source]¶ Create a
Perturbation
.- Parameters
universe (PerturbationUniverse) – Either the set that the perturbation parameter lives in or the distribution according to which the perturbation is distributed.
name (str) – Symbolic string description of the perturbation, similar to a variable’s name.
shape (int or tuple or list) – Algebraic shape of the perturbation parameter.
This constructor is meant for internal use. As a user, you will want to first define a universe (e.g.
ConicPerturbationSet
) for the parameter and obtain the parameter from it.
-
property
universe
¶ The uncertainty universe that the parameter belongs to.
-
PerturbationUniverse¶
-
class
picos.expressions.uncertain.perturbation.
PerturbationUniverse
[source]¶ Bases:
abc.ABC
Base class for uncertain perturbation sets and distributions.
See
distributional
for a distinction between perturbation sets, random distributions and distributional ambiguity sets, all three of which can be represented by this class.The naming scheme for implementing classes is as follows:
Perturbation sets (robust optimization) end in
PerturbationSet
,random distributions (stochastic programming) end in
Distribution
,distributional ambiguity sets (DRO) end in
AmbiguitySet
.
-
classmethod
make_type
(*args, **kwargs)[source]¶ Create a detailed universe type from subtype parameters.
-
worst_case
(scalar, direction)[source]¶ Find a worst-case realization of the uncertainty for an expression.
- Parameters
scalar (UncertainExpression) – A scalar uncertain expression that depends only on the perturbation
parameter
.direction (str) – Either
"min"
or"max"
, denoting the worst-case direction.
- Returns
A pair where the first element is the worst-case (expeceted) value as a
float
and where the second element is a realization of the perturbation parameter that attains this worst case as afloat
or CVXOPT matrix (orNone
for stochastic uncertainty).- Raises
TypeError – When the function is not scalar.
ValueError – When the function depends on other mutables than exactly the
parameter
.picos.uncertain.IntractableWorstCase – When computing the worst-case (expected) value is not supported, in particular when it would require solving a nonconvex problem.
RuntimeError – When the computation is supported but fails.
-
abstract property
distributional
¶ Whether this is a distribution or distributional ambiguity set.
If this is
True
, then this represents a random distribution (stochastic programming) or an ambiguity set of random distributions (distributionally robust optimization) and any expression that depends on its randomparameter
, when used in a constraint or as an objective function, is understood as a (worst-case) expected value.If this is
False
, then this represents a perturbation set (robust optimization) and any expression that depends on its perturbationparameter
, when used in a constraint or as an objective function, is understood as a worst-case value.
-
abstract property
parameter
¶ The perturbation parameter.
-
property
subtype
¶
-
property
type
¶ Detailed type of a perturbation parameter universe.
PerturbationUniverseType¶
-
class
picos.expressions.uncertain.perturbation.
PerturbationUniverseType
(theClass, subtype)[source]¶ Bases:
picos.containers.DetailedType
Container for a pair of perturbation universe class type and subtype.