Implements WassersteinAmbiguitySet.


class picos.expressions.uncertain.pert_wasserstein.WassersteinAmbiguitySet(parameter_name, p, eps, samples, weights=1)[source]

Bases: PerturbationUniverse

A wasserstein ambiguity set centered at a discrete distribution.

Model of uncertainty

As a distributional ambiguity set, an instance \mathcal{P} of this class

  1. represents a safety region for a partially known (ambiguous) probability distribution \Xi \in \mathcal{P} and

  2. provides a random, ambiguously distributed perturbation parameter \xi \sim \Xi that can be used to define worst-case-expectation expressions of the form

    \mathop{(\max\;\textit{or}\;\min)}_{\Xi \in \mathcal{P}}
\mathbb{E}_\Xi[f(x, \xi)]

    for a selection of functions f and a decision variable x.


Formally, this class can describe discrepancy-based ambiguity sets of the form

\mathcal{P} = \left\{
    \Xi \in \mathcal{M} ~\middle|~
    \operatorname{W}_p(\Xi, \Xi_\text{N}) \leq \epsilon

where discrepancy from the discrete nominal distribution

\Xi_\text{N} = \sum_{i = 1}^N w_i \delta_{\xi_{(i)}} \in \mathcal{M}

is measured with respect to the Wasserstein distance of order p \geq 1,

\operatorname{W}_p(\Xi, \Xi') =
        \inf_{\Phi \in \Pi(\Xi, \Xi')}
        \int_{\mathbb{R}^m \times \mathbb{R}^m}
        \lVert \phi - \phi' \rVert^p \;
            \mathop{}\!\mathrm{d} \phi
            \mathop{}\!\mathrm{d} \phi')


  1. \mathcal{M} is the set of all Borel probability measures on \mathbb{R}^n for some n \in \mathbb{Z}_{\geq 1},

  2. \Pi(\Xi, \Xi') denotes the set of all couplings of \Xi and \Xi',

  3. \xi_{(i)} \in \mathbb{R}^n for all i \in [N] are the N \in \mathbb{Z}_{\geq 1} samples comprising the support of \Xi_\text{N},

  4. w_i \in \mathbb{R}_{\geq 0} are weights denoting the nominal probabilitiy mass at \xi_{(i)} for all i \in [N],

  5. \delta_{\xi_{(i)}} denotes the Dirac delta function with unit mass at \xi_{(i)} for all i \in [N] and where

  6. \epsilon \in \mathbb{R}_{\geq 0} controls the radius of the ambiguity set.

Supported functions

For p = 1:

  1. A convex piecewise linear function f(x, \xi) = max_{i=1}^k a_i(x,
\xi) where a is biaffine in x and \xi for all i \in [k]. This can be written as picos.max([a_1, ..., a_k]) in Python.

  2. A concave piecewise linear function f(x, \xi) = min_{i=1}^k a_i(x,
\xi) where a is biaffine in x and \xi for all i \in [k]. This can be written as picos.min([a_1, ..., a_k]) in Python.

For p = 2:

  1. A squared norm f(x, \xi) = \lVert A(x, \xi) \rVert_F^2 where A is biaffine in x and \xi. This can be written as abs(A)**2 in Python.

__init__(parameter_name, p, eps, samples, weights=1)[source]

Create a WassersteinAmbiguitySet.

  • parameter_name (str) – Name of the random parameter \xi.

  • p (float) – The Wasserstein type/order parameter p.

  • eps (float) – The Wasserstein ball radius \epsilon.

  • samples (aynthing recognized by Samples) – The support of the discrete distribution \Xi_\text{D} given as the samples \xi_{(i)}. The original shape of the samples determines the shape of \xi.

  • weights – A vector denoting the nonnegative weight (e.g. frequency or probability) of each sample. Its length must match the number of samples provided. The argument will be normalized such that its entries sum to one. Entries of zero will be dropped alongside their associated sample. The default value of 1 denotes the empirical distribution on the samples.


Duplicate samples are not detected and can impact performance. If duplicate samples are likely, make sure to detect them and encode their frequency in the weight vector.

property distributional

Implement for PerturbationUniverse.

property eps

The Wasserstein ball radius \epsilon.

property p

The Wasserstein order p.

property parameter

The random perturbation parameter \xi.

property samples

The registered samples as a Samples object.

property weights

The sample weights a constant PICOS vector.