Brownian Distance Variance Constraints: private API
PortfolioOptimisers.set_brownian_distance_variance_constraints! — Function
set_brownian_distance_variance_constraints!(
model::Model,
::NormOneConeBrownianDistanceVariance,
Dt::AbstractMatrix{<:Union{Number, AbstractJuMPScalar}},
Dx::AbstractMatrix{<:Union{Number, AbstractJuMPScalar}};
prefix
)
Add the rows that bound each entry of the distance matrix Dt from below by the absolute value of the matching entry of Dx.
The formulation selects the rows. Both methods state the same feasible set, $D_{ij} \geq |\Delta_{ij}|$ for every pair of observations, so both give the same optimum. NormOneConeBrownianDistanceVariance adds one cone of dimension two for each entry on or below the diagonal. IneqBrownianDistanceVariance adds two matrix rows of $T^2$ linear inequalities each. Dx is antisymmetric and Dt is symmetric, so the entry $(j, i)$ of each matrix row repeats the entry $(i, j)$ of the other.
JuMP formulation
Variables
Dt: read, the symmetric matrix $\mathbf{D}$.
Constraints
cbdvariance_noc: underNormOneConeBrownianDistanceVariance, $(s_c D_{ij},\, s_c \Delta_{ij}) \in \mathcal{K}_{1}$, which is $D_{ij} \geq |\Delta_{ij}|$, $\forall\, 1 \leq j \leq i \leq T$.cp_bdvariance: underIneqBrownianDistanceVariance, $s_c (\mathbf{D} - \boldsymbol{\Delta}) \geq 0$, entry by entry.cn_bdvariance: underIneqBrownianDistanceVariance, $s_c (\mathbf{D} + \boldsymbol{\Delta}) \geq 0$, entry by entry.
Each name carries the namespace prefix.
Where:
- $\mathbf{D}$: Symmetric $T \times T$ matrix variable of the distances between the portfolio returns, with entries $D_{ij}$.
- $\boldsymbol{\Delta}$: The expression
Dx, the $T \times T$ matrix of the differences $\Delta_{ij} = \hat{r}_i - \hat{r}_j$ of the net portfolio returns $\hat{r}_i$ innet_X. - $T$: Number of observations.
- $\mathcal{K}_{q} = \{(t, \boldsymbol{x}) : t \geq \lVert \boldsymbol{x} \rVert_{q}\}$: Norm cone of order $q$. $\mathcal{K}_{2}$ is the second-order cone.
- $s_c$: Constraint scale. It multiplies both sides of a row, so a positive value leaves the feasible set unchanged.
Relaxation
The encoding is not exact: the entries below bound the quantity instead of reproducing it, and the bound is tight only under the condition stated here.
- The rows bound $D_{ij}$ from below by $|\Delta_{ij}|$, so $\mathbf{D}$ is the distance matrix of
net_Xonly when every row is tight. - The risk expression of
set_brownian_distance_risk_constraint!increases in each entry of a non-negative $\mathbf{D}$. So the rows are tight when the objective minimises the risk. - Under a bound on the risk and an objective that does not minimise it, an entry of $\mathbf{D}$ can exceed $|\Delta_{ij}|$. The risk at the true distance matrix is then at or below the risk at $\mathbf{D}$, so the bound still holds the value of the functor of
BrownianDistanceVariance.
Arguments
model::JuMP.Model: The JuMP optimisation model.::BrownianDistanceVarianceFormulation: The formulation, which selects the rows.Dt::MatNum: $\mathbf{D}$.Dx::MatNum: $\boldsymbol{\Delta}$.
Keyword arguments
prefix::Symbol: Model State namespace of the build (default: empty, i.e. the bare key).
Returns
nothing.
Related
PortfolioOptimisers.set_brownian_distance_risk_constraint! — Function
set_brownian_distance_risk_constraint!(
model::Model,
::QuadRiskExpr,
Dt::AbstractMatrix{<:Union{Number, AbstractJuMPScalar}},
iT2::Number;
prefix
) -> Any
Register the risk expression of BrownianDistanceVariance over the distance matrix Dt, and return it.
The expression is equation 9 of [215], the disciplined-convex upper bound on the distance variance that the docstring of BrownianDistanceVariance derives. QuadRiskExpr states it as a quadratic form in Dt. RSOCRiskExpr holds each of its two squares with a rotated second-order cone, so the expression is affine in the variables and a bound on the risk is a conic row.
JuMP formulation
Variables
Dt: read, the symmetric matrix $\mathbf{D}$.tDt: created underRSOCRiskExpr, the scalar $t$.tsum_Dt: created underRSOCRiskExpr, the scalar $u$.
Expressions
bdvariance_risk: $\frac{1}{T^2} \left( \lVert \mathbf{D} \rVert_F^2 + \frac{1}{T^2} \left( \boldsymbol{1}^\intercal \mathbf{D} \boldsymbol{1} \right)^2 \right)$ underQuadRiskExpr, and $\frac{1}{T^2} (t + u)$ underRSOCRiskExpr.
Constraints
rsoc_Dt: underRSOCRiskExpr, $(s_c t,\, s_c / 2,\, s_c \operatorname{vec}(\mathbf{D})) \in \mathcal{K}_{r}$, which is $t \geq \lVert \mathbf{D} \rVert_F^2$.rsoc_sum_Dt: underRSOCRiskExpr, $(s_c u,\, s_c / 2,\, s_c \boldsymbol{1}^\intercal \mathbf{D} \boldsymbol{1} / T) \in \mathcal{K}_{r}$, which is $u \geq \left( \boldsymbol{1}^\intercal \mathbf{D} \boldsymbol{1} / T \right)^2$. The factor $1 / T$ keeps $u$ of the size of $t$, so both reach the same relative accuracy in the solver.
Each name carries the namespace prefix.
Where:
- $\mathbf{D}$: Symmetric $T \times T$ matrix variable of the distances between the portfolio returns.
- $T$: Number of observations.
- $\boldsymbol{1}$: Column vector of ones, $T \times 1$.
- $\lVert \cdot \rVert_F$: Frobenius norm.
- $t$, $u$: Epigraph variables of the two squares.
- $\mathcal{K}_{r} = \{(a, b, \boldsymbol{x}) : 2 a b \geq \lVert \boldsymbol{x} \rVert_2^2,\, a \geq 0,\, b \geq 0\}$: Rotated second-order cone. The model states it with a JuMP.RotatedSecondOrderCone.
- $s_c$: Constraint scale. It multiplies both sides of a row, so a positive value leaves the feasible set unchanged.
Relaxation
The encoding is not exact: the entries below bound the quantity instead of reproducing it, and the bound is tight only under the condition stated here.
bdvariance_risklies at or above the distance variance $\frac{1}{T^2} \lVert \mathbf{C}_T \mathbf{D} \mathbf{C}_T \rVert_F^2$ of $\mathbf{D}$, with $\mathbf{C}_T$ the centring matrix. The gap is $\frac{2}{T^3} \lVert \mathbf{D} \boldsymbol{1} \rVert_2^2$, which is zero only when every entry of $\mathbf{D}$ is zero, that is, for a constant series of portfolio returns. On Gaussian returns at $T = 50$ the bound is 6.9 times the distance variance.- Under
QuadRiskExprbdvariance_riskis exact in $\mathbf{D}$. - Under
RSOCRiskExpr$t$ and $u$ lie at or above their squares, sobdvariance_risklies at or above the expression ofQuadRiskExpr. Both are tight when the objective minimises the risk.
Arguments
model::JuMP.Model: The JuMP optimisation model.::QuadRiskExpror::RSOCRiskExpr: The risk expression formulation.Dt::MatNum: $\mathbf{D}$.iT2::Number: $1 / T^2$.
Keyword arguments
prefix::Symbol: Model State namespace of the build (default: empty, i.e. the bare key).
Returns
bdvariance_risk: The risk expression.
Related
PortfolioOptimisers.set_brownian_distance_bounds_expr! — Function
set_brownian_distance_bounds_expr!(model::JuMP.Model, ::Nothing, bdvariance_risk; prefix::Symbol = Symbol("")) -> bdvariance_risk
set_brownian_distance_bounds_expr!(model::JuMP.Model, ::RkRtBounds, bdvariance_risk; prefix::Symbol = Symbol("")) -> bdvariance_devReturn the expression that the bound of a BrownianDistanceVariance acts on, and build it when the measure has a bound.
Without a bound, the method returns the risk expression and builds nothing. With a bound, it adds the square root of the risk expression to model and returns it. Both formulations of the risk expression state the same quantity, a sum of squares of the distances and of their sum. Its square root is the norm of one vector, so a second-order cone bounds it. The deviation has degree one in the weights and $k$, and the bound of the measure acts on it. The bound must be in the units of a deviation, as variance_risk_bounds_val gives it.
Mathematical definition
\[\begin{align} \mathrm{BDVar}(\mathbf{D}) &= \frac{1}{T^2} \sum_{i, j} D_{ij}^2 + \frac{1}{T^4} \left(\sum_{i, j} D_{ij}\right)^2 = \left\lVert \begin{bmatrix} \frac{1}{T} \operatorname{vec}(\mathbf{D}) \\ \frac{1}{T^2} \sum_{i, j} D_{ij} \end{bmatrix} \right\rVert_2^2\,. \end{align}\]
Where:
- $\mathrm{BDVar}(\mathbf{D})$: The risk expression at the distance matrix $\mathbf{D}$.
- $\mathbf{D}$: Symmetric matrix variable of the distances between the portfolio returns.
- $T$: Number of observations.
JuMP formulation
Variables
bdvariance_dev: $\sigma_{\mathrm{BD}}$, the deviation.
Constraints
cbdvariance_dev_soc: $\left(s_c \sigma_{\mathrm{BD}}, \frac{s_c}{T} \operatorname{vec}(\mathbf{D}), \frac{s_c}{T^2} \sum_{i, j} D_{ij}\right) \in \mathcal{K}_{2}$, which is $\sigma_{\mathrm{BD}} \geq \sqrt{\mathrm{BDVar}(\mathbf{D})}$.
Each name carries the namespace prefix.
Where:
- $\sigma_{\mathrm{BD}}$: The deviation variable.
- $\mathcal{K}_{q} = \{(t, \boldsymbol{x}) : t \geq \lVert \boldsymbol{x} \rVert_{q}\}$: Norm cone of order $q$. $\mathcal{K}_{2}$ is the second-order cone.
- $s_c$: Constraint scale. It multiplies both sides of a row, so a positive value leaves the feasible set unchanged.
Relaxation
The encoding is not exact: the entries below bound the quantity instead of reproducing it, and the bound is tight only under the condition stated here.
bdvariance_devlies at or above $\sqrt{\mathrm{BDVar}(\mathbf{D})}$. A bound on it is exact, because the weights satisfy it when the square root of their risk expression is at most the bound.
Arguments
model::JuMP.Model: The JuMP optimisation model.ub: The bound in the units of a deviation, ornothing. The method reads only its type.bdvariance_risk: The risk expression.
Keyword arguments
prefix::Symbol: Model State namespace of the build (default: empty, i.e. the bare key).
Returns
bdvariance_riskwithout a bound.bdvariance_devwith a bound: the deviation variable. A second call with the sameprefixreturns the registered variable.
Related
References
- [215]
- D. Cajas. Portfolio Optimization of Brownian Distance Variance. Available at SSRN 4561293 (2023).