# picos.expressions.uncertain.pert_moment¶

Implements MomentAmbiguitySet.

Classes

class picos.expressions.uncertain.pert_moment.MomentAmbiguitySet(parameter_name, shape, nominal_mean=0, nominal_covariance='I', alpha=0, beta=1, sample_space=None)[source]

A moment-uncertain description of a random perturbation parameter.

Model of uncertainty

As a distributional ambiguity set, an instance of this class

1. represents a safety region for a partially known (ambiguous) probability distribution and

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

for a selection of functions and a decision variable .

Definition

Formally, this class can describe ambiguity sets of the form

where

1. is the set of all Borel probability measures on ,

2. the sample space bounds the support of and may be given as either or as an -dimensional ellipsoid,

3. and with are the nominal mean and covariance matrix of , respectively, and

4. and are meta-parameters bounding the uncertainty concerning the mean and the covariance matrix, respectively.

Unless , this class can also represent the limit cases of and denoting an unbounded mean and covariance matrix, respectively.

Note

While denotes that the nominal mean is certain, there is a subtle difference between setting on the one hand and assuming a certain form for the covariance matrix on the other hand: In the former case, the worst case covariance matrix may be Lowener smaller than the nominal one. Setting a lower bound on the covarianve matrix is computationally difficult and not supported.

Supported functions

1. A squared norm where is biaffine in and . This can be written as abs(A)**2 in Python.

2. A convex piecewise linear function where is biaffine in and for all . This can be written as picos.max([a_1, ..., a_k]) in Python.

3. A concave piecewise linear function where is biaffine in and for all . This can be written as picos.min([a_1, ..., a_k]) in Python.

Example

We show that for unbounded mean and support (i.e. and ) and for a finite samples space , this distributional ambiguity set can be used in the context of classical (non-distributional) robust optimization applied to least squares problems.

>>> from picos import Constant, diag, Ellipsoid, Problem, RealVariable
>>> from picos.uncertain import ConicPerturbationSet, MomentAmbiguitySet
>>> import numpy
>>> numpy.random.seed(1)
>>> # Setup data and variables of the nominal least squares problem.
>>> n = 3
>>> A = Constant("A", numpy.random.random((n, n)))
>>> b = Constant("b", numpy.random.random(n))
>>> x = RealVariable("x", n)
>>> # Setup an ellipsoid S bounding the uncertainty in both models.
>>> N = n**2
>>> S = Ellipsoid(N, diag(range(1, N + 1)), range(N))
>>> # Define and solve both robust models.
>>> U1 = ConicPerturbationSet.from_constraints(
...     "Y", RealVariable("Y", N) << S)
>>> U2 = MomentAmbiguitySet("Z", N, alpha=None, beta=None, sample_space=S)
>>> Y = U1.parameter.reshaped((n, n))
>>> Z = U2.parameter.reshaped((n, n))
>>> P1, P2 = Problem(), Problem()
>>> P1.objective = "min", abs((A + Y)*x - b)
>>> P2.objective = "min", abs((A + Z)*x - b)**2
>>> _ = P1.solve(solver="cvxopt")
>>> x1 = ~x  # Save current value of x as a constant PICOS expression x1.
>>> _ = P2.solve(solver="cvxopt")
>>> x2 = ~x
>>> # Verify that both models yield the same robust regression vector.
>>> x1.equals(x2, relTol=1e-4)
True

__init__(parameter_name, shape, nominal_mean=0, nominal_covariance='I', alpha=0, beta=1, sample_space=None)[source]

Create a MomentAmbiguitySet.

Parameters
property alpha

The parameter .

A value of None denotes .

property beta

The parameter .

A value of None denotes .

property dim

The dimension of the sample space.

property distributional

Implement for PerturbationUniverse.

property nominal_covariance

The nominal covariance matrix .

property nominal_mean

The nominal mean of the ambiguous distribution.

property parameter

The random perturbation parameter .

property sample_space

The sample space (bound on support) .

A value of None means .