14.2.12 Class Domain

mosek.fusion.Domain

The Domain class defines a set of static method for creating various variable and constraint domains. A Domain object specifies a subset of Rn, which can be used to define the feasible domain of variables and expressions.

For further details on the use of these, see Model.Variable and Model.Constraint.

Static members:

Domain.Axis – Set the dimension along which the cones are created.

Domain.Binary – Creates a domain of binary variables.

Domain.EqualsTo – Defines the domain consisting of a fixed point.

Domain.GreaterThan – Defines the domain specified by a lower bound in each dimension.

Domain.InDExpCone – Defines the dual exponential cone.

Domain.InDGeoMeanCone – Defines the domain of dual geometric mean cones.

Domain.InDPowerCone – Defines the dual power cone.

Domain.InPExpCone – Defines the primal exponential cone.

Domain.InPGeoMeanCone – Defines the domain of primal geometric mean cones.

Domain.InPPowerCone – Defines the primal power cone.

Domain.InPSDCone – Creates a domain of Positive Semidefinite matrices.

Domain.InQCone – Defines the domain of quadratic cones.

Domain.InRange – Creates a domain specified by a range in each dimension.

Domain.InRotatedQCone – Defines the domain of rotated quadratic cones.

Domain.InSVecPSDCone – Creates a domain of vectorized Positive Semidefinite matrices.

Domain.Integral – Creates a domain of integral variables.

Domain.IsTrilPSD – Creates a domain of Positive Semidefinite matrices.

Domain.LessThan – Defines the domain specified by an upper bound in each dimension.

Domain.Sparse – Use a sparse representation.

Domain.Unbounded – Creates a domain in which variables are unbounded.

Domain.Axis
ConeDomain Domain.Axis(ConeDomain c, int a)

Set the dimension along which the cones are created. If this conic domain is used for a variable or expression of dimension d, then the conic constraint will be applicable to all vectors obtained by fixing the coordinates other than a-th and moving along the a-th coordinate. If d=2 this can be used to define the conditions “every row of the matrix is in a cone” and “every column of a matrix is in a cone”.

The default is the last dimension a=d1.

Parameters:
  • c (ConeDomain) – A conic domain.

  • a (int) – The axis.

Return:

(ConeDomain)

Domain.Binary
RangeDomain Domain.Binary(int n)
RangeDomain Domain.Binary(int m, int n)
RangeDomain Domain.Binary(int[] dims)
RangeDomain Domain.Binary()

Create a domain of binary variables. A binary domain can only be used when creating variables, but is not allowed in a constraint. Another way of restricting variables to be integers is the method Variable.MakeInteger.

Parameters:
  • n (int) – Dimension size.

  • m (int) – Dimension size.

  • dims (int[]) – A list of dimension sizes.

Return:

(RangeDomain)

Domain.EqualsTo
LinearDomain Domain.EqualsTo(double b)
LinearDomain Domain.EqualsTo(double b, int n)
LinearDomain Domain.EqualsTo(double b, int m, int n)
LinearDomain Domain.EqualsTo(double b, int[] dims)
LinearDomain Domain.EqualsTo(double[] a1)
LinearDomain Domain.EqualsTo(double[,] a2)
LinearDomain Domain.EqualsTo(double[] a1, int[] dims)
LinearDomain Domain.EqualsTo(Matrix mx)

Defines the domain consisting of a fixed point.

Parameters:
  • b (double) – A single value. This is scalable: it means that each element in the variable or constraint is fixed to b.

  • n (int) – Dimension size.

  • m (int) – Dimension size.

  • dims (int[]) – A list of dimension sizes.

  • a1 (double[]) – A one-dimensional array of bounds. The shape must match the variable or constraint with which it is used.

  • a2 (double[,]) – A two-dimensional array of bounds. The shape must match the variable or constraint with which it is used.

  • mx (Matrix) – A matrix of bound values. The shape must match the variable or constraint with which it is used.

Return:

(LinearDomain)

Domain.GreaterThan
LinearDomain Domain.GreaterThan(double b)
LinearDomain Domain.GreaterThan(double b, int n)
LinearDomain Domain.GreaterThan(double b, int m, int n)
LinearDomain Domain.GreaterThan(double b, int[] dims)
LinearDomain Domain.GreaterThan(double[] a1)
LinearDomain Domain.GreaterThan(double[,] a2)
LinearDomain Domain.GreaterThan(double[] a1, int[] dims)
LinearDomain Domain.GreaterThan(Matrix mx)

Defines the domain specified by a lower bound in each dimension.

Parameters:
  • b (double) – A single value. This is scalable: it means that each element in the variable or constraint is greater than or equal to b.

  • n (int) – Dimension size.

  • m (int) – Dimension size.

  • dims (int[]) – A list of dimension sizes.

  • a1 (double[]) – A one-dimensional array of bounds. The shape must match the variable or constraint with which it is used.

  • a2 (double[,]) – A two-dimensional array of bounds. The shape must match the variable or constraint with which it is used.

  • mx (Matrix) – A matrix of bound values. The shape must match the variable or constraint with which it is used.

Return:

(LinearDomain)

Domain.InDExpCone
ConeDomain Domain.InDExpCone()
ConeDomain Domain.InDExpCone(int m)
ConeDomain Domain.InDExpCone(int[] dims)

Defines the domain of dual exponential cones:

{xR3 : x1x3e1ex2/x3, x1>0, x3<0}

The conic domain scales as follows. If a variable or expression constrained to an exponential cone is not a single vector but a d-dimensional variable then the conic domain is applicable to all vectors obtained by fixing the first d1 coordinates and moving along the last coordinate. If d=2 it means that each row of a matrix must belong to a cone. See also Domain.Axis.

If m was given the domain is a product of m such cones.

Parameters:
  • m (int) – The number of cones (default 1).

  • dims (int[]) – Shape of the domain.

Return:

(ConeDomain)

Domain.InDGeoMeanCone
ConeDomain Domain.InDGeoMeanCone()
ConeDomain Domain.InDGeoMeanCone(int n)
ConeDomain Domain.InDGeoMeanCone(int m, int n)
ConeDomain Domain.InDGeoMeanCone(int[] dims)

Defines the domain of dual geometric mean cones:

{xRn : (n1)(i=1n1xi)1/(n1)|xn|, x1,,xn10}

The conic domain scales as follows. If a variable or expression constrained to a cone is not a single vector but a d-dimensional variable then the conic domain is applicable to all vectors obtained by fixing the first d1 coordinates and moving along the last coordinate. If d=2 it means that each row of a matrix must belong to a cone. See also Domain.Axis.

If m was given the domain is a product of m such cones.

Parameters:
  • n (int) – The size of each cone; at least 2.

  • m (int) – The number of cones (default 1).

  • dims (int[]) – Shape of the domain.

Return:

(ConeDomain)

Domain.InDPowerCone
ConeDomain Domain.InDPowerCone(double alpha)
ConeDomain Domain.InDPowerCone(double alpha, int m)
ConeDomain Domain.InDPowerCone(double alpha, int[] dims)
ConeDomain Domain.InDPowerCone(double[] alphas)
ConeDomain Domain.InDPowerCone(double[] alphas, int m)
ConeDomain Domain.InDPowerCone(double[] alphas, int[] dims)

Defines the domain of dual power cones. For a single double argument alpha it defines the set

{xRn : (x1α)α(x21α)1αi=3nxi2, x1,x20}.

For an array alphas of length nl, consisting of weights for the cone, it defines the set

{xRn : i=1nl(xiβi)βixnl+12++xn2, x1,,xnl0}.

where βi are the weights normalized to add up to 1, ie. βi=αi/(jαj) for i=1,,nl.

The conic domain scales as follows. If a variable or expression constrained to a power cone is not a single vector but a d-dimensional variable then the conic domain is applicable to all vectors obtained by fixing the first d1 coordinates and moving along the last coordinate. If d=2 it means that each row of a matrix must belong to a cone. See also Domain.Axis.

If m was given the domain is a product of m such cones.

Parameters:
  • alpha (double) – The exponent of the power cone. Must be between 0 and 1.

  • m (int) – The number of cones (default 1).

  • dims (int[]) – Shape of the domain.

  • alphas (double[]) – The weights of the power cone. Must be positive.

Return:

(ConeDomain)

Domain.InPExpCone
ConeDomain Domain.InPExpCone()
ConeDomain Domain.InPExpCone(int m)
ConeDomain Domain.InPExpCone(int[] dims)

Defines the domain of primal exponential cones:

{xR3 : x1x2ex3/x2, x1,x2>0}

The conic domain scales as follows. If a variable or expression constrained to an exponential cone is not a single vector but a d-dimensional variable then the conic domain is applicable to all vectors obtained by fixing the first d1 coordinates and moving along the last coordinate. If d=2 it means that each row of a matrix must belong to a cone. See also Domain.Axis.

If m was given the domain is a product of m such cones.

Parameters:
  • m (int) – The number of cones (default 1).

  • dims (int[]) – Shape of the domain.

Return:

(ConeDomain)

Domain.InPGeoMeanCone
ConeDomain Domain.InPGeoMeanCone()
ConeDomain Domain.InPGeoMeanCone(int n)
ConeDomain Domain.InPGeoMeanCone(int m, int n)
ConeDomain Domain.InPGeoMeanCone(int[] dims)

Defines the domain of primal geometric mean cones:

{xRn : (i=1n1xi)1/(n1)|xn|, x1,xn10}

The conic domain scales as follows. If a variable or expression constrained to a cone is not a single vector but a d-dimensional variable then the conic domain is applicable to all vectors obtained by fixing the first d1 coordinates and moving along the last coordinate. If d=2 it means that each row of a matrix must belong to a cone. See also Domain.Axis.

If m was given the domain is a product of m such cones.

Parameters:
  • n (int) – The size of each cone; at least 2.

  • m (int) – The number of cones (default 1).

  • dims (int[]) – Shape of the domain.

Return:

(ConeDomain)

Domain.InPPowerCone
ConeDomain Domain.InPPowerCone(double alpha)
ConeDomain Domain.InPPowerCone(double alpha, int m)
ConeDomain Domain.InPPowerCone(double alpha, int[] dims)
ConeDomain Domain.InPPowerCone(double[] alphas)
ConeDomain Domain.InPPowerCone(double[] alphas, int m)
ConeDomain Domain.InPPowerCone(double[] alphas, int[] dims)

Defines the domain of primal power cones. For a single double argument alpha it defines the set

{xRn : x1αx21αi=3nxi2, x1,x20}.

For an array alphas of length nl, consisting of weights for the cone, it defines the set

{xRn : i=1nlxiβixnl+12++xn2, x1,,xnl0}.

where βi are the weights normalized to add up to 1, ie. βi=αi/(jαj) for i=1,,nl.

The conic domain scales as follows. If a variable or expression constrained to a power cone is not a single vector but a d-dimensional variable then the conic domain is applicable to all vectors obtained by fixing the first d1 coordinates and moving along the last coordinate. If d=2 it means that each row of a matrix must belong to a cone. See also Domain.Axis.

If m was given the domain is a product of m such cones.

Parameters:
  • alpha (double) – The exponent of the power cone. Must be between 0 and 1.

  • m (int) – The number of cones (default 1).

  • dims (int[]) – Shape of the domain.

  • alphas (double[]) – The weights of the power cone. Must be positive.

Return:

(ConeDomain)

Domain.InPSDCone
PSDDomain Domain.InPSDCone()
PSDDomain Domain.InPSDCone(int n)
PSDDomain Domain.InPSDCone(int n, int m)

When used to create a new variable in Model.Variable it defines a domain of symmetric positive semidefinite matrices, that is

S+n={XRn×n : X=XT, yTXy0, for all y}.

The shape of the result is n×n. If m was given the domain is a product of m such cones, that is of shape m×n×n.

When used to impose a constraint in Model.Constraint it defines a domain

{XRn×n : 12(X+XT)S+n}.

i.e. a positive semidefinite matrix without the symmetry assumption.

Parameters:
  • n (int) – Dimension of the PSD matrix.

  • m (int) – Number of matrices (default 1).

Return:

(PSDDomain)

Domain.InQCone
ConeDomain Domain.InQCone()
ConeDomain Domain.InQCone(int n)
ConeDomain Domain.InQCone(int m, int n)
ConeDomain Domain.InQCone(int[] dims)

Defines the domain of quadratic cones:

{xRn : x12i=2nxi2, x10}

The conic domain scales as follows. If a variable or expression constrained to a quadratic cone is not a single vector but a d-dimensional variable then the conic domain is applicable to all vectors obtained by fixing the first d1 coordinates and moving along the last coordinate. If d=2 it means that each row of a matrix must belong to a cone. See also Domain.Axis.

If m was given the domain is a product of m such cones.

Parameters:
  • n (int) – The size of each cone; at least 2.

  • m (int) – The number of cones (default 1).

  • dims (int[]) – Shape of the domain.

Return:

(ConeDomain)

Domain.InRange
RangeDomain Domain.InRange(double lb, double ub)
RangeDomain Domain.InRange(double lb, double[] uba)
RangeDomain Domain.InRange(double[] lba, double ub)
RangeDomain Domain.InRange(double[] lba, double[] uba)
RangeDomain Domain.InRange(double lb, double ub, int[] dims)
RangeDomain Domain.InRange(double lb, double[] uba, int[] dims)
RangeDomain Domain.InRange(double[] lba, double ub, int[] dims)
RangeDomain Domain.InRange(double[] lba, double[] uba, int[] dims)
RangeDomain Domain.InRange(double[,] lba, double[,] uba)
RangeDomain Domain.InRange(Matrix lbm, Matrix ubm)

Creates a domain specified by a range in each dimension.

Parameters:
  • lb (double) – The lower bound as a common scalar value.

  • ub (double) – The upper bound as a common scalar value.

  • uba (double[]) – The upper bounds as an array.

  • uba (double[,]) – The upper bounds as an array.

  • lba (double[]) – The lower bounds as an array.

  • lba (double[,]) – The lower bounds as an array.

  • dims (int[]) – A list of dimension sizes.

  • lbm (Matrix) – The lower bounds as a Matrix object.

  • ubm (Matrix) – The upper bounds as a Matrix object.

Return:

(RangeDomain)

Domain.InRotatedQCone
ConeDomain Domain.InRotatedQCone()
ConeDomain Domain.InRotatedQCone(int n)
ConeDomain Domain.InRotatedQCone(int m, int n)
ConeDomain Domain.InRotatedQCone(int[] dims)

Defines the domain of rotated quadratic cones:

{xRn : 2x1x2i=3nxi2, x1,x20}

The conic domain scales as follows. If a variable or expression constrained to a quadratic cone is not a single vector but a d-dimensional variable then the conic domain is applicable to all vectors obtained by fixing the first d1 coordinates and moving along the last coordinate. If d=2 it means that each row of a matrix must belong to a cone. See also Domain.Axis.

If m was given the domain is a product of m such cones.

Parameters:
  • n (int) – The size of each cone; at least 3.

  • m (int) – The number of cones (default 1).

  • dims (int[]) – Shape of the domain.

Return:

(ConeDomain)

Domain.InSVecPSDCone
ConeDomain Domain.InSVecPSDCone()
ConeDomain Domain.InSVecPSDCone(int n)
ConeDomain Domain.InSVecPSDCone(int d1, int d2)
ConeDomain Domain.InSVecPSDCone(int[] dims)

Creates a domain of vectorized Positive Semidefinite matrices:

{(x1,,xd(d+1)/2)Rn : sMat(x)S+d}={sVec(X) : XS+d},

where

sVec(X)=(X11,2X21,,2Xd1,X22,2X32,,Xdd),

and

sMat(x)=[x1x2/2xd/2x2/2xd+1x2d1/2xd/2x2d1/2xd(d+1)/2].

In other words, the domain consists of vectorizations of the lower-triangular part of a positive semidefinite matrix, with the non-diagonal elements additionally rescaled.

Parameters:
  • n (int) – Length of the vectorization - this must be of the form d(d+1)/2 for some positive integer d.

  • d1 (int) – Size of first dimension of the domain.

  • d2 (int) – Size of second dimension of the domain.

  • dims (int[]) – Shape of the domain.

Return:

(ConeDomain)

Domain.Integral
ConeDomain Domain.Integral(ConeDomain c)
LinearDomain Domain.Integral(LinearDomain ld)
RangeDomain Domain.Integral(RangeDomain rd)

Modify a given domain restricting its elements to be integral. An integral domain can only be used when creating variables, but is not allowed in a constraint. Another way of restricting variables to be integers is the method Variable.MakeInteger.

Parameters:
Return:
Domain.IsTrilPSD
PSDDomain Domain.IsTrilPSD()
PSDDomain Domain.IsTrilPSD(int n)
PSDDomain Domain.IsTrilPSD(int n, int m)

Creates an object representing a cone of the form

{XRn×n : tril(X)S+n}.

i.e. the lower triangular part of X defines the symmetric matrix that is positive semidefinite. The shape of the result is n×n. If m was given the domain is a product of m such cones, that is of shape m×n×n.

Parameters:
  • n (int) – Dimension of the PSD matrix.

  • m (int) – Number of matrices (default 1).

Return:

(PSDDomain)

Domain.LessThan
LinearDomain Domain.LessThan(double b)
LinearDomain Domain.LessThan(double b, int n)
LinearDomain Domain.LessThan(double b, int m, int n)
LinearDomain Domain.LessThan(double b, int[] dims)
LinearDomain Domain.LessThan(double[] a1)
LinearDomain Domain.LessThan(double[,] a2)
LinearDomain Domain.LessThan(double[] a1, int[] dims)
LinearDomain Domain.LessThan(Matrix mx)

Defines the domain specified by an upper bound in each dimension.

Parameters:
  • b (double) – A single value. This is scalable: it means that each element in the variable or constraint is less than or equal to b.

  • n (int) – Dimension size.

  • m (int) – Dimension size.

  • dims (int[]) – A list of dimension sizes.

  • a1 (double[]) – A one-dimensional array of bounds. The shape must match the variable or constraint with which it is used.

  • a2 (double[,]) – A two-dimensional array of bounds. The shape must match the variable or constraint with which it is used.

  • mx (Matrix) – A matrix of bound values. The shape must match the variable or constraint with which it is used.

Return:

(LinearDomain)

Domain.Sparse
LinearDomain Domain.Sparse(LinearDomain ld, int[] sparsity)
LinearDomain Domain.Sparse(LinearDomain ld, int[,] sparsity)
RangeDomain Domain.Sparse(RangeDomain rd, int[] sparsity)
RangeDomain Domain.Sparse(RangeDomain rd, int[,] sparsity)

Given a linear domain, this method explicitly suggest to Fusion that a sparse representation is helpful.

Parameters:
  • ld (LinearDomain) – The linear sparse domain.

  • sparsity (int[]) – Sparsity pattern.

  • sparsity (int[,]) – Sparsity pattern.

  • rd (RangeDomain) – The ranged sparse domain.

Return:
Domain.Unbounded
LinearDomain Domain.Unbounded()
LinearDomain Domain.Unbounded(int n)
LinearDomain Domain.Unbounded(int m, int n)
LinearDomain Domain.Unbounded(int[] dims)

Creates a domain in which variables are unbounded.

Parameters:
  • n (int) – Dimension size.

  • m (int) – Dimension size.

  • dims (int[]) – A list of dimension sizes.

Return:

(LinearDomain)