Entropy pooling Prior (a): private API
PortfolioOptimisers.AbstractSequentialTailViewConstraint — Type
abstract type AbstractSequentialTailViewConstraint <: AbstractEntropyPoolingTailViewAbstract supertype for the tail view constraints of the sequential convex formulations.
A sequential tail view constraint holds a view that reads as a lower bound, and it splits the assets of the view into two sides. The risk measures of the dual side are concave in the posterior probabilities, and each takes its exact dual block. The risk measures of the primal side have a negative coefficient, and each takes a linear upper bound read at a fixed posterior. The three subtypes differ only in the risk measure. add_ep_tail_view! and ep_refine_tail_view each have one method for the whole family. Each subtype has a method of ep_tail_dual_block! and of ep_tail_surrogate_row for its risk measure.
Related
PortfolioOptimisers.LinearConditionalValueatRiskViewConstraint — Type
struct LinearConditionalValueatRiskViewConstraint{__T_x, __T_coef, __T_alpha, __T_rhs} <: AbstractEntropyPoolingTailViewCarries the loss series and coefficient of every asset, the significance level and the target of a linear conditional value-at-risk view.
ep_add_cvar_view! makes one of these for each view that uses the linear formulation. From it, add_ep_tail_view! then writes the dual representation of CVaR into the model, one block for each asset. Every coefficient is positive. A view whose coefficients have both signs uses another formulation.
Fields
x: The loss series (-returns) of each asset that the view names.
coef: The coefficient that the view gives the risk measure of each asset.
alpha: The significance level of the view.
rhs: The target value of the view.
Constructors
LinearConditionalValueatRiskViewConstraint(x, coef, alpha, rhs)Arguments correspond to the fields above.
Related
References
- [1] D. Cajas. Entropy Pooling with CVaR and EVaR Views. Available at SSRN 7120258 (2026). Section 2.2, Equation 6.
PortfolioOptimisers.IntegerConditionalValueatRiskViewConstraint — Type
struct IntegerConditionalValueatRiskViewConstraint{__T_ord, __T_x, __T_coef, __T_alpha, __T_op, __T_rhs} <: AbstractEntropyPoolingTailViewCarries the ordered tail window of every asset that an integer conditional value-at-risk view names.
ep_add_cvar_view! makes one of these for each view that uses the integer formulation. Each entry of ord and of x belongs to one asset of the view, and coef holds the coefficient of that asset. A view of one asset has one entry, and a view of several assets has one entry for each asset. The window is in ascending order, so the largest loss is last, and the tail that the binary vector marks is at the end of the window. Cajas [1] sorts the window in descending order, and its Equation 3 sets the probability of a marked observation to its posterior probability. The library lets the lowest marked observation hold a part of its probability, so the tail mass can equal alpha.
Fields
ord: The indices of the largest losses of each asset, in ascending order, so the largest loss is last.
x: The loss series (-returns) of the asset that the view names.
coef: The coefficient that the view gives the risk measure of each asset.
alpha: The significance level of the view.
op: The comparison operator of the view, one of:eq,:geqand:leq.
rhs: The target value of the view.
Constructors
IntegerConditionalValueatRiskViewConstraint(ord, x, coef, alpha, op, rhs)Arguments correspond to the fields above.
Related
References
- [1] D. Cajas. Entropy Pooling with CVaR and EVaR Views. Available at SSRN 7120258 (2026). Section 2.2, Equations 3 to 5.
PortfolioOptimisers.ConicEntropicValueatRiskViewConstraint — Type
struct ConicEntropicValueatRiskViewConstraint{__T_x, __T_coef, __T_alpha, __T_rhs} <: AbstractEntropyPoolingTailViewCarries the loss series and coefficient of every asset, the significance level and the target of a conic entropic value-at-risk view.
ep_add_evar_view! makes one of these for each view that uses the conic formulation. From it, add_ep_tail_view! then writes the relative entropy cone of the dual representation of EVaR under probabilities that are not uniform, one cone for each asset. Every coefficient is positive. A view whose coefficients have both signs uses another formulation.
Fields
x: The loss series (-returns) of each asset that the view names.
coef: The coefficient that the view gives the risk measure of each asset.
alpha: The significance level of the view.
rhs: The target value of the view.
Constructors
ConicEntropicValueatRiskViewConstraint(x, coef, alpha, rhs)Arguments correspond to the fields above.
Related
References
- [2] D. Cajas. Entropy Pooling with Relativistic Value at Risk Views. Available at SSRN 7329718 (2026). Section 2, Equation 1, and Section 3.1. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
PortfolioOptimisers.GridEntropicValueatRiskViewConstraint — Type
struct GridEntropicValueatRiskViewConstraint{__T_x, __T_z, __T_alpha, __T_rhs, __T_M} <: AbstractEntropyPoolingTailViewCarries the grid of dual variables from which an upper-bound or equality entropic value-at-risk view selects one point.
A lower-bound grid view is a set of rows on the posterior probabilities alone. These rows go into the constraint dictionary, and not into this tail view constraint. An equality view makes both parts. Its rows go into the dictionary, and its selector block goes into this constraint.
Fields
x: The loss series (-returns) of the asset that the view names.
z: The grid of the dual variables of the entropic value at risk.
alpha: The significance level of the view.
rhs: The target value of the view.
M: Multiplier of the big-M constant of each row of the grid entropic value-at-risk formulation. The constant of a row is the smallest that releases it, soM >= 1, andM = 1keeps every row as tight as the data allow.
Constructors
GridEntropicValueatRiskViewConstraint(x, z, alpha, rhs, M)Arguments correspond to the fields above.
Related
References
- [1] D. Cajas. Entropy Pooling with CVaR and EVaR Views. Available at SSRN 7120258 (2026). Section 2.3, Equations 10 and 11.
PortfolioOptimisers.ConicRelativisticValueatRiskViewConstraint — Type
struct ConicRelativisticValueatRiskViewConstraint{__T_x, __T_coef, __T_alpha, __T_kappa, __T_rhs} <: AbstractEntropyPoolingTailViewCarries the loss series and coefficient of every asset, the significance level, the deformation parameter and the target of a conic relativistic value-at-risk view.
ep_add_rlvar_view! makes one of these for each view that uses the conic formulation. From it, add_ep_tail_view! then writes the power cones of the dual representation of RLVaR, one pair for each observation of each asset. Every coefficient is positive. A view whose coefficients have both signs uses another formulation.
Fields
x: The loss series (-returns) of each asset that the view names.
coef: The coefficient that the view gives the risk measure of each asset.
alpha: The significance level of the view.
kappa: The deformation parameter of the view.
rhs: The target value of the view.
Constructors
ConicRelativisticValueatRiskViewConstraint(x, coef, alpha, kappa, rhs)Arguments correspond to the fields above.
Related
References
- [2] D. Cajas. Entropy Pooling with Relativistic Value at Risk Views. Available at SSRN 7329718 (2026). Section 3.2, Equation 7.
PortfolioOptimisers.GridRelativisticValueatRiskViewConstraint — Type
struct GridRelativisticValueatRiskViewConstraint{__T_x, __T_t, __T_z, __T_alpha, __T_kappa, __T_rhs, __T_M} <: AbstractEntropyPoolingTailViewCarries the grid of primal points from which an upper-bound or equality relativistic value-at-risk view selects one point.
A lower-bound grid view is a set of rows on the posterior probabilities alone. These rows go into the constraint dictionary, and not into this tail view constraint. An equality view makes both parts. Its rows go into the dictionary, and its selector block goes into this constraint. Cajas [2] states no upper-bound view of the relativistic value at risk. The grid and its selector are the library's own, and they use the primal programme as the entropic grid of GridEntropicValueatRiskViewConstraint does.
Fields
x: The loss series (-returns) of the asset that the view names.
t: Shift variable that minimises the objective at each point ofz, with one entry for each grid point. The minimisation uses the probabilities at the centre of the grid. These are the prior probabilities only when the centre is the pair of the prior.
z: The grid of the dual variables of the relativistic value at risk.
alpha: The significance level of the view.
kappa: The deformation parameter of the view.
rhs: The target value of the view.
M: Multiplier of the big-M constant of each row of the grid relativistic value-at-risk formulation. The constant of a row is the smallest that releases it, soM >= 1, andM = 1keeps every row as tight as the data allow.
Constructors
GridRelativisticValueatRiskViewConstraint(x, t, z, alpha, kappa, rhs, M)Arguments correspond to the fields above.
Related
References
- [2] D. Cajas. Entropy Pooling with Relativistic Value at Risk Views. Available at SSRN 7329718 (2026). Section 2, Equation 5.
PortfolioOptimisers.SequentialConditionalValueatRiskViewConstraint — Type
struct SequentialConditionalValueatRiskViewConstraint{__T_xd, __T_cd, __T_xp, __T_cp, __T_c, __T_b, __T_alpha, __T_rhs, __T_iters, __T_tol} <: AbstractSequentialTailViewConstraintCarries the two sides of a sequential conditional value-at-risk view, its surrogate row and its stopping rule.
ep_add_cvar_view! makes one of these for each view that uses SequentialTailView, and reads its first surrogate row with ep_sequential_start. ep_refine_tail_view then reads the row again at each posterior that entropy_pooling finds. Cajas [1] states the dual formulation of the dual side. The sequential formulation, the surrogate row and the later reads are the library's own.
Fields
xd: The loss series (-returns) of each asset on the dual side of the view. When the view reads as a lower bound, these are the assets with a positive coefficient. Each takes the exact dual block of its measure.
cd: The coefficient that the view gives the risk measure of each asset on the dual side. Each coefficient is positive.
xp: The loss series (-returns) of each asset on the primal side of the view. When the view reads as a lower bound, these are the assets with a negative coefficient. Each takes a linear upper bound that its primal representation gives.
cp: The coefficient that the view gives the risk measure of each asset on the primal side. Each coefficient is negative.
c: The coefficients of the surrogate row, one for each observation. They are the coefficient-weighted sum of the linear upper bounds of the primal side, read at the last posterior.
b: The constant of the surrogate row.
alpha: The significance level of the view.
rhs: The target value of the view.
iters: Largest number of re-solves after the first solve. Each re-solve reads the multipliers of the primal representation at the last posterior, which tightens the surrogate row. Zero keeps the first posterior, on which the view holds but the row is slack.
tol: Relative gap between the surrogate row and the risk measures it bounds at which the re-solves stop. The gap is relative to the larger of the absolute target of the view and the largest absolute loss of the primal side.
Constructors
SequentialConditionalValueatRiskViewConstraint(xd, cd, xp, cp, c, b, alpha, rhs, iters, tol)SequentialConditionalValueatRiskViewConstraint(; xd, cd, xp, cp, c, b, alpha, rhs, iters, tol)Arguments and keywords correspond to the fields above.
Related
References
- [1] D. Cajas. Entropy Pooling with CVaR and EVaR Views. Available at SSRN 7120258 (2026). Section 2.2, Equation 6.
PortfolioOptimisers.SequentialEntropicValueatRiskViewConstraint — Type
struct SequentialEntropicValueatRiskViewConstraint{__T_xd, __T_cd, __T_xp, __T_cp, __T_c, __T_b, __T_alpha, __T_rhs, __T_iters, __T_tol, __T_args, __T_kwargs, __T_zlo_frac} <: AbstractSequentialTailViewConstraintCarries the two sides of a sequential entropic value-at-risk view, its surrogate row, its stopping rule, and the settings of the search for the dual variable.
ep_add_evar_view! makes one of these for each view that uses SequentialTailView, and reads its first surrogate row with ep_sequential_start. ep_refine_tail_view then reads the row again at each posterior that entropy_pooling finds. Each read runs ep_evar once for each asset of the primal side, with args, kwargs and zlo_frac. Cajas [2] states the dual formulation of the dual side, and Cajas [1] states the formula of the entropic value at risk that the primal side reads. The sequential formulation, the surrogate row and the later reads are the library's own.
Fields
xd: The loss series (-returns) of each asset on the dual side of the view. When the view reads as a lower bound, these are the assets with a positive coefficient. Each takes the exact dual block of its measure.
cd: The coefficient that the view gives the risk measure of each asset on the dual side. Each coefficient is positive.
xp: The loss series (-returns) of each asset on the primal side of the view. When the view reads as a lower bound, these are the assets with a negative coefficient. Each takes a linear upper bound that its primal representation gives.
cp: The coefficient that the view gives the risk measure of each asset on the primal side. Each coefficient is negative.
c: The coefficients of the surrogate row, one for each observation. They are the coefficient-weighted sum of the linear upper bounds of the primal side, read at the last posterior.
b: The constant of the surrogate row.
alpha: The significance level of the view.
rhs: The target value of the view.
iters: Largest number of re-solves after the first solve. Each re-solve reads the multipliers of the primal representation at the last posterior, which tightens the surrogate row. Zero keeps the first posterior, on which the view holds but the row is slack.
tol: Relative gap between the surrogate row and the risk measures it bounds at which the re-solves stop. The gap is relative to the larger of the absolute target of the view and the largest absolute loss of the primal side.
args: Additional positional arguments passed to the optimisation function. They go to the search ofep_evarthat each read runs.
kwargs: Additional keyword arguments passed to the optimisation function. They go to the same search asargs.
zlo_frac: Lower end of the bracket of the dual variable, as a fraction of the upper end, ornothingto take the span thatep_evarstates. The upper end is a proof, so it is fixed and only the lower end is a parameter.
Constructors
SequentialEntropicValueatRiskViewConstraint(xd, cd, xp, cp, c, b, alpha, rhs, iters, tol, args, kwargs, zlo_frac)SequentialEntropicValueatRiskViewConstraint(; xd, cd, xp, cp, c, b, alpha, rhs, iters, tol, args, kwargs, zlo_frac)Arguments and keywords correspond to the fields above.
Related
References
PortfolioOptimisers.SequentialRelativisticValueatRiskViewConstraint — Type
struct SequentialRelativisticValueatRiskViewConstraint{__T_xd, __T_cd, __T_xp, __T_cp, __T_c, __T_b, __T_alpha, __T_kappa, __T_rhs, __T_iters, __T_tol, __T_args, __T_kwargs, __T_bracket} <: AbstractSequentialTailViewConstraintCarries the two sides of a sequential relativistic value-at-risk view, its surrogate row, its stopping rule, and the settings of the search for the primal pair.
ep_add_rlvar_view! makes one of these for each view that uses SequentialTailView, and reads its first surrogate row with ep_sequential_start. ep_refine_tail_view then reads the row again at each posterior that entropy_pooling finds. Each read runs ep_rlvar once for each asset of the primal side, with args, kwargs and bracket. Cajas [2] states the dual and the primal formulations. The sequential formulation, the surrogate row and the later reads are the library's own.
Fields
xd: The loss series (-returns) of each asset on the dual side of the view. When the view reads as a lower bound, these are the assets with a positive coefficient. Each takes the exact dual block of its measure.
cd: The coefficient that the view gives the risk measure of each asset on the dual side. Each coefficient is positive.
xp: The loss series (-returns) of each asset on the primal side of the view. When the view reads as a lower bound, these are the assets with a negative coefficient. Each takes a linear upper bound that its primal representation gives.
cp: The coefficient that the view gives the risk measure of each asset on the primal side. Each coefficient is negative.
c: The coefficients of the surrogate row, one for each observation. They are the coefficient-weighted sum of the linear upper bounds of the primal side, read at the last posterior.
b: The constant of the surrogate row.
alpha: The significance level of the view.
kappa: The deformation parameter of the view.
rhs: The target value of the view.
iters: Largest number of re-solves after the first solve. Each re-solve reads the multipliers of the primal representation at the last posterior, which tightens the surrogate row. Zero keeps the first posterior, on which the view holds but the row is slack.
tol: Relative gap between the surrogate row and the risk measures it bounds at which the re-solves stop. The gap is relative to the larger of the absolute target of the view and the largest absolute loss of the primal side.
args: Additional positional arguments passed to the optimisation function. They go to the searches ofep_rlvarthat each read runs.
kwargs: Additional keyword arguments passed to the optimisation function. They go to the same searches asargs.
bracket: The spans of the two scalar searches of this estimator, ornothingfor the default spans ofRelativisticValueatRiskViewBracket.
Constructors
SequentialRelativisticValueatRiskViewConstraint(xd, cd, xp, cp, c, b, alpha, kappa, rhs, iters, tol, args, kwargs, bracket)SequentialRelativisticValueatRiskViewConstraint(; xd, cd, xp, cp, c, b, alpha, kappa, rhs, iters, tol, args, kwargs, bracket)Arguments and keywords correspond to the fields above.
Related
References
- [2] D. Cajas. Entropy Pooling with Relativistic Value at Risk Views. Available at SSRN 7329718 (2026). Section 2, Equations 4 and 5.
PortfolioOptimisers.ep_tail_dual_block! — Function
ep_tail_dual_block!(model::JuMP.Model, pw, tv::AbstractEntropyPoolingTailView, x::VecNum,
sc1::Number)Add the dual block of one asset's risk measure to an entropy pooling JuMP model, and return the expression that attains the measure.
The dual representation of each measure is the maximum of $\boldsymbol{\nu}^{\intercal} \boldsymbol{x}$ over a set of weights that depends on the posterior probabilities. ep_tail_dual_block! adds that set to the model and returns the linear expression. The caller bounds the expression alone, or in a coefficient-weighted sum over several assets. The tail view constraint tv names the measure and holds its level. The fixed tail view constraint of a measure and its sequential tail view constraint use the same method.
The conditional value-at-risk block is Equation 6 of [1]. The entropic block is Equation 1 of [2], and the relativistic block is Equations 4 and 7 of [2]. Cajas [2] prints the bound of its Equation 7 as 0 <= nu_j <= 0. The library reads it as the bound of Equation 4, 0 <= nu_j <= 1.
JuMP formulation
Variables
pw: $\boldsymbol{p}$: $T \times 1$ posterior probabilities of the observations, summing to one. They are the unknown of the entropy pooling problem. The caller gives it, and every entry below reads it.nu: $\boldsymbol{\nu}$: $T \times 1$ vector of weights that attains the risk measure, the variable of its dual representation. The conditional value-at-risk method gives it a lower bound of zero, and the two other methods bound it to $[0, 1]$.tau,varsigma: $\boldsymbol{\tau}$ and $\boldsymbol{\varsigma}$, two $T \times 1$ vectors with a lower bound of zero. The relativistic value-at-risk method makes them. The cones and the budget already imply both bounds. With the bounds stated, the solver reportsOPTIMALwhere it otherwise reportsSLOW_PROGRESS.
Expressions
- The method returns $\sum_{j=1}^{T} \nu_{j} x_{j}$, which has no name.
Constraints
No row has a name. The conditional value-at-risk method, for LinearConditionalValueatRiskViewConstraint and SequentialConditionalValueatRiskViewConstraint, registers two:
- $s_{c1} \left(\nu_{j} - \dfrac{p_{j}}{\alpha}\right) \leq 0$, $\forall\, j = 1,\ldots,T$.
- $s_{c1} \left(\sum_{j=1}^{T} \nu_{j} - 1\right) = 0$.
The entropic value-at-risk method, for ConicEntropicValueatRiskViewConstraint and SequentialEntropicValueatRiskViewConstraint, registers two:
- $s_{c1} \left(\sum_{j=1}^{T} \nu_{j} - 1\right) = 0$.
- $\left(s_{c1} \ln\left(\dfrac{1}{\alpha}\right),\, s_{c1} \boldsymbol{p},\, s_{c1} \boldsymbol{\nu}\right) \in \mathcal{K}_{\mathrm{re}}(2T+1)$.
The relativistic value-at-risk method, for ConicRelativisticValueatRiskViewConstraint and SequentialRelativisticValueatRiskViewConstraint, registers four:
- $s_{c1} \left(\sum_{j=1}^{T} \nu_{j} - 1\right) = 0$.
- $s_{c1} \left(\sum_{j=1}^{T} \dfrac{\tau_{j} - \varsigma_{j}}{2\kappa} - \ln_{\kappa}\left(\dfrac{1}{\alpha T}\right)\right) \leq 0$.
- $\left(s_{c1} \tau_{j},\, s_{c1} T p_{j},\, s_{c1} \nu_{j}\right) \in \mathcal{K}_{\mathrm{pow}}\left(\dfrac{1}{1+\kappa}\right)$, $\forall\, j = 1,\ldots,T$.
- $\left(s_{c1} \nu_{j},\, s_{c1} T p_{j},\, s_{c1} \varsigma_{j}\right) \in \mathcal{K}_{\mathrm{pow}}(1-\kappa)$, $\forall\, j = 1,\ldots,T$.
Where:
- $s_{c1}$: Constraint scale of the entropy pooling optimiser. It multiplies both sides of a row, so a positive value leaves the feasible set unchanged.
- $\boldsymbol{p}$: $T \times 1$ posterior probabilities of the observations, summing to one. They are the unknown of the entropy pooling problem.
- $\boldsymbol{\nu}$: $T \times 1$ vector of weights that attains the risk measure, the variable of its dual representation.
- $\boldsymbol{x}$: $T \times 1$ loss series of one asset, the negated returns, whose $j$-th entry is $x_{j}$.
- $\alpha$: Significance level (left tail probability), $\alpha \in (0, 1)$.
- $\kappa$: Kaniadakis deformation parameter, $\kappa \in (0, 1)$.
- $T$: Number of observations.
- $\ln_{\kappa}(u) = \dfrac{u^{\kappa} - u^{-\kappa}}{2 \kappa}$: Kaniadakis logarithm.
- $\boldsymbol{\tau}$, $\boldsymbol{\varsigma}$: $T \times 1$ vectors that hold the Kaniadakis entropy budget of $\boldsymbol{\nu}$.
- $\mathcal{K}_{\mathrm{re}}(1 + 2T) = \{(u,\, \boldsymbol{v},\, \boldsymbol{s}) : u \geq \sum_{j=1}^{T} s_{j} \ln(s_{j} / v_{j})\}$: The relative entropy cone.
- $\mathcal{K}_{\mathrm{pow}}(\pi) = \{(a, b, c) : a^{\pi} b^{1-\pi} \geq |c|,\, a \geq 0,\, b \geq 0\}$: The power cone.
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 block is exact. The set that it adds is the dual description of the measure, so the largest value of the returned expression is the measure of the asset under pw.
Arguments
model: The entropy pooling JuMP model.pw: The vector of posterior probability variables.tv: The tail view constraint. It names the measure and holds its level. For the relativistic method, it also holds the deformation parameter.x: The loss series of the asset.sc1: The constraint scale factor.
Returns
expr::JuMP.AffExpr: The expression $\sum_{j=1}^{T} \nu_{j} x_{j}$.
Related
add_ep_tail_view!LinearConditionalValueatRiskViewConstraintConicEntropicValueatRiskViewConstraintConicRelativisticValueatRiskViewConstraintAbstractSequentialTailViewConstraint
References
PortfolioOptimisers.ep_var_multiplier — Function
ep_var_multiplier(x::VecNum, w::VecNum, alpha::Number)Find the largest minimiser of the primal of the conditional value at risk of a loss series under observation probabilities.
Mathematical definition
The conditional value at risk is the minimum over $\eta$ of $\eta + \dfrac{1}{\alpha} \sum_{j=1}^{T} w_{j} (x_{j} - \eta)^{+}$. This function of $\eta$ is convex and piecewise linear, and its kinks are at the losses. Its largest minimiser is the loss at which the tail mass first reaches $\alpha$:
\[\eta^{\star} = x_{(s)}\,, \quad s = \min\left\{k : \sum_{i=1}^{k} w_{(i)} \geq \alpha\right\}\,,\]
with the losses sorted in descending order, $x_{(1)} \geq x_{(2)} \geq \ldots$.
When the tail mass of a loss is exactly $\alpha$, the minimisers form an interval. ValueatRisk takes the smallest point of the interval, so in this case the two values are adjacent losses. Every minimiser gives the same conditional value at risk, and a bound read at any of them is tight at w.
Where:
- $\boldsymbol{x}$: $T \times 1$ loss series of one asset, the negated returns, whose $j$-th entry is $x_{j}$.
- $\boldsymbol{w}$: $T \times 1$ observation probabilities, which sum to one. In a view, they are the posterior probabilities that the model solves for.
- $\alpha$: Significance level (left tail probability), $\alpha \in (0, 1)$.
- $T$: Number of observations.
Arguments
x: The loss series (-returns).w: The observation probabilities. The function normalises them to sum to one.alpha: The significance level.
Returns
eta::Number: The largest minimiser, one of the losses ofx.
Related
PortfolioOptimisers.ep_tail_surrogate_row — Function
ep_tail_surrogate_row(tv::AbstractSequentialTailViewConstraint, x::VecNum, w::VecNum)Read the linear upper bound of one asset's risk measure at a posterior.
Each sequential formulation bounds the measure of an asset on its primal side by an affine function of the posterior probabilities, $r_{0} + \boldsymbol{r}^{\intercal} \boldsymbol{p}$. The bound is tight at the probabilities w at which the function reads it. So the value $r_{0} + \boldsymbol{r}^{\intercal} \boldsymbol{w}$ is the measure of the asset under w.
Neither [1] nor [2] states the row. The library builds it as the tangent of the primal programme of the measure. This programme is Equation 7 of [1] for the entropic value at risk, and Equation 5 of [2] for the relativistic value at risk. The conditional value-at-risk row reads the minimisation of the conditional value at risk over its threshold, which neither work states.
Mathematical definition
The conditional value-at-risk method reads the primal at the value at risk $\eta$ of ep_var_multiplier:
\[r_{0} = \eta\,, \quad r_{j} = \dfrac{(x_{j} - \eta)^{+}}{\alpha}\,.\]
The entropic value-at-risk method reads the dual variable $z$ and the value of ep_evar, and takes the tangent of the concave primal at w:
\[r_{0} = \mathrm{EVaR}_{\alpha}(X) - z\,, \quad r_{j} = \dfrac{z e^{x_{j}/z}}{\sum_{k=1}^{T} w_{k} e^{x_{k}/z}}\,.\]
The relativistic value-at-risk method reads the pair $(t, z)$ of ep_rlvar, at which the primal is linear in the probabilities:
\[r_{0} = t + z \ln_{\kappa}\left(\dfrac{1}{\alpha T}\right)\,, \quad r_{j} = T \varphi_{\kappa}(t - x_{j},\, z)\,.\]
Where:
- $\boldsymbol{x}$: $T \times 1$ loss series of one asset, the negated returns, whose $j$-th entry is $x_{j}$.
- $\boldsymbol{w}$: $T \times 1$ observation probabilities, which sum to one. In a view, they are the posterior probabilities that the model solves for.
- $\alpha$: Significance level (left tail probability), $\alpha \in (0, 1)$.
- $\kappa$: Kaniadakis deformation parameter, $\kappa \in (0, 1)$.
- $T$: Number of observations.
- $\ln_{\kappa}(u) = \dfrac{u^{\kappa} - u^{-\kappa}}{2 \kappa}$: Kaniadakis logarithm.
- $\varphi_{\kappa}(u, z)$: Smallest sum of the two tail variables that the pair of power cones of one observation allows.
- $\mathrm{EVaR}_{\alpha}(X)$: Entropic value at risk of the loss series $\boldsymbol{x}$ at level $\alpha$.
- $\eta$: The value at risk of the loss series under $\boldsymbol{w}$.
- $z$: The dual variable that attains the measure under $\boldsymbol{w}$.
- $t$: The shift that attains the relativistic value at risk under $\boldsymbol{w}$.
Arguments
tv: The sequential tail view constraint. It names the measure, and holds its level and the settings of its search.x: The loss series of the asset (-returns).w: The observation probabilities at which the function reads the bound, which sum to one.
Returns
r::VecNum: The coefficients of the bound, one for each observation.r0::Number: The constant of the bound.
Related
References
PortfolioOptimisers.ep_refine_tail_view — Method
ep_refine_tail_view(tv::AbstractSequentialTailViewConstraint, w::VecNum)Read the surrogate row of a sequential tail view again at a posterior, and tell whether the old row was already tight there.
Algorithm
- Return
tvandtruewhen the primal side is empty. The view is then convex, its dual blocks are exact, and no row needs a new read. - Clamp
wat zero from below, and normalise it to sum to one. A conic solver returns a posterior whose smallest entries are a rounding error below zero, and the searches behind the rows refuse a negative probability. - For each asset of the primal side, read its bound at
wwithep_tail_surrogate_row. Add the coefficient-weighted bounds into a new rowc,b. The value of the new row atwis the coefficient-weighted sum of the measures atw. - Calculate the gap between the old row of
tvand the new row atw. The old row bounds the same sum from the same side, so the gap is the slack that the last solve left. - Return
tvwith the new row. Also returntrueif the gap is at mosttoltimes the larger of the absolute target and the largest absolute loss of the primal side.
Arguments
tv: The sequential tail view constraint.w: The posterior probabilities of the last solve.
Returns
tv::AbstractSequentialTailViewConstraint: The tail view constraint with its row read again atw.tight::Bool:trueif the row thattvheld before the call was tight atw.
Related
PortfolioOptimisers.ep_evar — Function
ep_evar(x::VecNum, w::VecNum, alpha::Number; args::Tuple = (),
kwargs::NamedTuple = (;), zlo_frac::Option{<:Number} = nothing) -> EvarDualMinimumCompute the sample entropic value at risk of a loss series and the dual variable that attains it.
ep_evar minimises the convex scalar objective of the sample EVaR with Optim.jl. The entropy pooling views need the value and the minimiser. The value compares a view with its prior, and the minimiser is the centre of the grid of GridTailView. Cajas [1] states the formula and puts the centre of the grid at the minimiser z. It does not state how to find that minimiser, so the bracket and the search are the library's own.
Mathematical definition
\[\mathrm{EVaR}_{\alpha}(X) = \min_{z > 0} \; z \ln\left(\dfrac{\sum_{j=1}^{T} w_{j} \exp(x_{j}/z)}{\alpha}\right)\,.\]
Algorithm
- Normalise the observation probabilities in the logarithmic domain. The result is
lw. - Bracket the dual variable. The upper end
hiis(maximum(x) - dot(w, x)) / log(inv(alpha)). Whenhiis not positive,epsof its type replaces it. The lower end ishi * zlo_frac. - Minimise the objective over the bracket with
Optim.jl. Each evaluation usesLogExpFunctions.logsumexp, so a smallzdoes not overflow. - Return the minimum as
evar, and the minimiser asz.
Arguments
x: The loss series (-returns).w: The observation probabilities. The function normalises them to sum to one.alpha: The significance level.args: Additional positional arguments passed to the optimisation function. An emptyargsgivesOptim.Brent(), whichOptim.optimizeselects for a bracketed scalar minimisation.kwargs: Additional keyword arguments passed to the optimisation function.zlo_frac: The lower end of the bracket of the dual variable, as a fraction of the upper end.nothinggivessqrt(eps(T))for the element typeT. The caller cannot state this value, because the type comes from the data. Above the upper end,(maximum(x) - dot(w, x)) / log(inv(alpha)), the objective is larger thanmaximum(x), which is an upper bound of the EVaR. This is a proof, so the upper end is fixed and only the lower end is a parameter.
Validation
0 < zlo_frac < 1.- The search converges. It is a bracketed scalar minimisation of a convex function, so it fails only when
argsorkwargsstop it early.
Returns
res::EvarDualMinimum: The value and the dual variable that attains it.
Related
References
- [1] D. Cajas. Entropy Pooling with CVaR and EVaR Views. Available at SSRN 7120258 (2026). Section 2.3, Equation 7.
PortfolioOptimisers.ep_evar_grid_row — Function
ep_evar_grid_row(x::VecNum, ebar::Number, z::Number)Build one scaled row of the grid formulation of an entropic value-at-risk view.
ep_evar_grid_row returns the coefficients exp((x - ebar) / z) divided by their largest entry, and the reciprocal of that entry. The caller multiplies the right hand side by the reciprocal. This scale keeps each coefficient in (0, 1] at a small z too. At a small z the scaled bound alpha * isc is much smaller than one, so add_ep_tail_view! also divides an upper-bound row by its bound. A lower-bound row keeps the norm scale of ep_add_grid_tail_view!.
Algorithm
- Exponentiate the shifted loss series. The result is
c, the coefficientsexp((x - ebar) / z)before the scale. - Read the largest entry of
cintosc. - Return
cdivided bysc, andisc, the reciprocal ofsc.
Arguments
x: The loss series (-returns).ebar: The target entropic value at risk.z: The dual variable of the grid point.
Returns
c::VecNum: The scaled coefficients.isc::Number: The scale factor of the right hand side.
Related
PortfolioOptimisers.ep_rlvar_tail — Function
ep_rlvar_tail(u::Number, z::Number, kappa::Number)Compute the smallest tail penalty that the pair of power cones of one observation allows.
The primal programme of the relativistic value at risk has two power cones and two non-negative variables per observation. This function minimises the sum of the two variables in closed form. With this closed form, a point of the primal programme gives a row that is linear in the posterior probabilities. Cajas [2] states the cones but not the closed form, which is the library's own.
Mathematical definition
\[\begin{align} \varphi_{\kappa}(u, z) &= \dfrac{\kappa}{1+\kappa} \left(\dfrac{2\kappa}{(1+\kappa) z}\right)^{\frac{1}{\kappa}} \left(\dfrac{\sigma - u}{2}\right)^{\frac{1+\kappa}{\kappa}} + \kappa (1-\kappa)^{\frac{1-\kappa}{\kappa}} \left(\dfrac{z}{2\kappa}\right)^{\frac{1}{\kappa}} \left(\dfrac{\sigma + u}{2}\right)^{-\frac{1-\kappa}{\kappa}}\,,\\ \sigma &= \sqrt{u^{2} + \dfrac{(1 - \kappa^{2}) z^{2}}{\kappa^{2}}}\,. \end{align}\]
Where:
- $\varphi_{\kappa}(u, z)$: Smallest sum of the two tail variables that the pair of power cones of one observation allows.
- $u$: Shifted loss of one observation, $t - x_{j}$.
- $z > 0$: Dual variable of the primal programme.
- $\kappa$: Kaniadakis deformation parameter, $\kappa \in (0, 1)$.
- $\sigma$: Square root of the discriminant of the stationarity condition of $\varphi_{\kappa}$, a quadratic whose positive root $(u + \sigma) / 2$ is the minimiser.
Arguments
u: The shifted loss of the observation,t - xfor a lossx.z: The dual variable of the primal programme.kappa: The deformation parameter, in(0, 1).
Returns
phi::Number: The smallest sum of the two tail variables of the observation.
Related
References
- [2] D. Cajas. Entropy Pooling with Relativistic Value at Risk Views. Available at SSRN 7329718 (2026). Section 2, Equation 5.
PortfolioOptimisers.ep_rlvar_shift — Function
ep_rlvar_shift(x::VecNum, w::VecNum, kappa::Number, lnk::Number, z::Number;
args::Tuple = (), kwargs::NamedTuple = (;),
bracket::Option{<:RelativisticValueatRiskViewBracket} = nothing) ->
RlvarShiftMinimumMinimise the primal objective of the relativistic value at risk over its shift variable, at a fixed dual variable.
The objective is the primal programme of [2]. Cajas [2] does not state how to search for the minimum, so the bracket of the shift is the library's own.
Mathematical definition
\[\begin{align} \underset{t}{\min} &\; t + z \ln_{\kappa}\left(\dfrac{1}{\alpha T}\right) + T \sum_{j=1}^{T} w_{j} \varphi_{\kappa}(t - x_{j},\, z)\,. \end{align}\]
Where:
- $t$: Shift variable of the primal programme.
- $z > 0$: Dual variable of the primal programme.
- $\ln_{\kappa}(u) = \dfrac{u^{\kappa} - u^{-\kappa}}{2 \kappa}$: Kaniadakis logarithm.
- $\alpha$: Significance level (left tail probability), $\alpha \in (0, 1)$.
- $T$: Number of observations.
- $\boldsymbol{w}$: $T \times 1$ observation probabilities, which sum to one. In a view, they are the posterior probabilities that the model solves for.
- $\varphi_{\kappa}(u, z)$: Smallest sum of the two tail variables that the pair of power cones of one observation allows.
- $\boldsymbol{x}$: $T \times 1$ loss series of one asset, the negated returns, whose $j$-th entry is $x_{j}$.
- $\kappa$: Kaniadakis deformation parameter, $\kappa \in (0, 1)$.
Arguments
x: The loss series (-returns).w: The observation probabilities, which sum to one.kappa: The deformation parameter, in(0, 1).lnk: The Kaniadakis logarithm ofinv(alpha * T), fromkappa_log.z: The dual variable of the primal programme.args: Additional positional arguments passed to the optimisation function. An emptyargsgivesOptim.Brent(), whichOptim.optimizeselects for a bracketed scalar minimisation.kwargs: Additional keyword arguments passed to the optimisation function.bracket: The spans of the searches of a relativistic value-at-risk view, ornothingfor the default spans ofRelativisticValueatRiskViewBracket. This function reads onlytspan. The span is a margin and not a proof, so make it wider if the minimiser is at an end of the bracket.ep_rlvarreads the other two fields.
Validation
- The search converges. It is a bracketed scalar minimisation of a convex function, so it fails only when
argsorkwargsstop it early. A minimiser at an end of the bracket does not make the search fail, becauseOptimreports that end as converged.
Returns
res::RlvarShiftMinimum: The smallest value of the objective, and the shift that attains it.
Algorithm
- Bracket the shift by the loss range, widened on each side by
tspantimes the span of the losses. The minimiser is near the largest loss, so the bracket holds it with a wide margin. - Minimise the objective over the bracket with
Optim.jl.
Related
References
- [2] D. Cajas. Entropy Pooling with Relativistic Value at Risk Views. Available at SSRN 7329718 (2026). Section 2, Equation 5.
PortfolioOptimisers.ep_rlvar — Function
ep_rlvar(x::VecNum, w::VecNum, alpha::Number, kappa::Number; args::Tuple = (),
kwargs::NamedTuple = (;),
bracket::Option{<:RelativisticValueatRiskViewBracket} = nothing) ->
RlvarPrimalMinimumCompute the sample relativistic value at risk of a loss series and the primal point that attains it.
ep_rlvar minimises the primal objective of the sample RLVaR over its two variables. ep_rlvar_tail already minimises out the power cones of each observation. The entropy pooling views need the value and the minimiser. The value compares a view with its prior, and the minimiser is the centre of the grid of GridTailView. The objective is the primal programme of [2]. Cajas [2] does not state how to search for the minimum, so the two searches and their brackets are the library's own.
Mathematical definition
\[\begin{align} \mathrm{RLVaR}_{\alpha,\kappa}(X) &= \underset{t,\, z > 0}{\min} \; t + z \ln_{\kappa}\left(\dfrac{1}{\alpha T}\right) + T \sum_{j=1}^{T} w_{j} \varphi_{\kappa}(t - x_{j},\, z)\,. \end{align}\]
Where:
- $\mathrm{RLVaR}_{\alpha,\kappa}(X)$: Relativistic value at risk of the loss series $\boldsymbol{x}$ at level $\alpha$ and deformation $\kappa$.
- $t$: Shift variable of the primal programme.
- $z > 0$: Dual variable of the primal programme.
- $\ln_{\kappa}(u) = \dfrac{u^{\kappa} - u^{-\kappa}}{2 \kappa}$: Kaniadakis logarithm.
- $\alpha$: Significance level (left tail probability), $\alpha \in (0, 1)$.
- $T$: Number of observations.
- $\boldsymbol{w}$: $T \times 1$ observation probabilities, which sum to one. In a view, they are the posterior probabilities that the model solves for.
- $\varphi_{\kappa}(u, z)$: Smallest sum of the two tail variables that the pair of power cones of one observation allows.
- $\boldsymbol{x}$: $T \times 1$ loss series of one asset, the negated returns, whose $j$-th entry is $x_{j}$.
- $\kappa$: Kaniadakis deformation parameter, $\kappa \in (0, 1)$.
Arguments
x: The loss series (-returns).w: The observation probabilities. The function normalises them to sum to one.alpha: The significance level.kappa: The deformation parameter, in(0, 1).args: Additional positional arguments passed to the optimisation function. They go to both searches. An emptyargsgivesOptim.Brent(), whichOptim.optimizeselects for a bracketed scalar minimisation.kwargs: Additional keyword arguments passed to the optimisation function. They go to both searches.bracket: The spans of the searches, ornothingfor the default spans ofRelativisticValueatRiskViewBracket. This function readslog_zloandlog_zhi. They are the ends of the bracket of the logarithm of the dual variable, as offsets from the logarithm of the loss range. They are a margin and not a proof, so widen one if the minimiser is at an end of the bracket.ep_rlvar_shiftreadstspan.
Validation
- Both searches converge. Each is a bracketed scalar minimisation of a unimodal function, so a search fails only when
argsorkwargsstop it early. A minimiser at an end of a bracket does not make a search fail, becauseOptimreports that end as converged.
Returns
res::RlvarPrimalMinimum: The value and the primal pair that attains it.
Algorithm
- Minimise over the logarithm of the dual variable with
Optim.jl. The bracket goes fromexp(log_zlo)toexp(log_zhi)times the loss range, which is about2e-9to about2e4for the default bracket. The objective is convex in the pair, so the partial minimum over the shift is convex in the dual variable. The logarithm is increasing, so the function of the outer minimisation is unimodal, but it is not convex in general. - Minimise over the shift at each candidate dual variable with
ep_rlvar_shift. - Do the inner minimisation again at the dual variable of the minimum, so that the returned shift is the shift that attains the value.
Related
RlvarPrimalMinimumep_rlvar_tailep_rlvar_shiftConicRelativisticValueatRiskViewGridTailViewRelativisticValueatRiskRelativisticValueatRiskView
References
- [2] D. Cajas. Entropy Pooling with Relativistic Value at Risk Views. Available at SSRN 7329718 (2026). Section 2, Equation 5.
PortfolioOptimisers.ep_rlvar_grid_row — Function
ep_rlvar_grid_row(x::VecNum, vbar::Number, t::Number, z::Number, alpha::Number,
kappa::Number)Build one scaled row of the grid formulation of a relativistic value-at-risk view.
ep_rlvar_grid_row returns the coefficients T * phi(t - x, z) divided by their largest entry, and the target of the row divided by the same entry. This scale keeps each finite coefficient in (0, 1], at a small z too. At a small z the scaled target is much smaller than one, so add_ep_tail_view! also divides an upper-bound row by its target. A lower-bound row keeps the norm scale of ep_add_grid_tail_view!. Cajas [2] states the primal programme and no grid of its points. The row is the library's own, and it uses the primal programme as the grid rows of the entropic value at risk in [1] use its primal.
Arguments
x: The loss series (-returns).vbar: The target relativistic value at risk.t: The shift variable of the grid point.z: The dual variable of the grid point.alpha: The significance level.kappa: The deformation parameter, in(0, 1).
Returns
c::VecNum: The scaled coefficients.b::Number: The scaled target of the row.
Related
GridTailViewGridRelativisticValueatRiskViewConstraintadd_ep_tail_view!ep_add_grid_tail_view!ep_tail_views!
References
PortfolioOptimisers.ep_row_tilt — Function
ep_row_tilt(w::VecNum, c::VecNum, b::Number; iters::Integer = 200)Tilt a probability vector so that one linear row holds with equality, at the smallest relative entropy.
The row of a grid point is linear in the posterior probabilities. So the posterior that makes the row tight, at the smallest relative entropy from the prior, is an exponential tilt of the prior along the coefficients of the row. This tilt is the entropy pooling posterior of that one row, and it needs no solver. The tilt is the closed form of [157] for one equality constraint. Its use as the anchor of a grid is the library's own.
Mathematical definition
\[\begin{align} q_{j}(\theta) &= \dfrac{w_{j} e^{-\theta c_{j}}}{\sum_{i=1}^{T} w_{i} e^{-\theta c_{i}}}\,,\\ \sum_{j=1}^{T} q_{j}(\theta) c_{j} &= b\,. \end{align}\]
The value of the row under the tilt decreases strictly as $\theta$ increases, from $\max_{j} c_{j}$ to $\min_{j} c_{j}$ over the observations with $w_{j} > 0$. So the tilt exists if and only if $b$ is strictly inside that range. A tilt cannot put mass on an observation of zero prior probability, so the coefficient of such an observation sets no bound.
Arguments
w: The prior probabilities, which sum to one.c: The coefficients of the row.b: The value that the row must take.iters::Integer = 200: The largest number of bisection steps. The bisection also stops when the midpoint does not change. ForFloat64this happens near step 64, so the limit applies only to a number type of higher precision.
Validation
iters >= 1.
Returns
q::Option{VecNum}: The tilted probabilities. The function returnsnothingwhen no tilt attainsb, becausebis outside the range ofcover the support ofw. It also returnsnothingwhen the tilted row is not finite.
Algorithm
- Return
nothingwhenbis outside the open range ofcover the observations withw > 0. - Bracket the root. Double the tilt away from zero until the value of the row crosses
b. - Bisect the bracket until the midpoint does not change, or for
iterssteps if that comes first. - Return
nothingwhen the sum of the tilted weights is zero or not a number. Otherwise return the normalised weights.
Related
References
- [157] A. Meucci. Fully flexible views: theory and practice. Risk 21, 97–102 (2008). Appendix A.3, Equation 90.
PortfolioOptimisers.ep_evar_anchor — Function
ep_evar_anchor(x::VecNum, w::VecNum, alpha::Number, rhs::Number, z::Number;
iters::Integer = 50, tol::Number = 1e-10, tilt_iters::Integer = 200,
args::Tuple = (), kwargs::NamedTuple = (;),
zlo_frac::Option{<:Number} = nothing) -> Option{<:EvarAnchor}Find the dual variable of the entropic value at risk that a posterior attains when it meets an upper-bound view.
A grid point states the view as one row. A posterior that makes the row tight reaches the target only if that grid point is the point that the posterior attains. ep_evar_anchor finds the dual variable that meets both conditions, and the grid of GridTailView has this dual variable as its centre. The function calls no solver. Cajas [1] puts the centre of the grid at the dual variable of the prior. The anchor at the dual variable of the posterior is the library's own.
Arguments
x: The loss series (-returns).w: The prior probabilities, which sum to one.alpha: The significance level.rhs: The target entropic value at risk.z: The dual variable at the start of the iteration.iters::Integer = 50: The largest number of steps of the iteration.tol::Number = 1e-10: The relative distance from the target at which the iteration stops.tilt_iters::Integer = 200: The largest number of bisection steps of the tilt of one row, inep_row_tilt.args: Additional positional arguments passed to the optimisation function.kwargs: Additional keyword arguments passed to the optimisation function.zlo_frac: The lower end of the bracket of the dual variable, as a fraction of the upper end, which goes toep_evar.
Returns
res::Option{<:EvarAnchor}: The dual variable and the posterior that attains it, ornothingwhen the iteration does not reach the target.
Algorithm
- Build the row of the current dual variable with
ep_evar_grid_row. Returnnothingwhen the row is not finite. - Tilt the prior with
ep_row_tilt, so that the row is tight. Returnnothingwhen no probability vector makes the row tight. - Compute the dual variable again with
ep_evar, as the minimiser at the tilted probabilities. - Stop when the entropic value at risk of the tilted probabilities is within
tolof the target. Return the dual variable and those probabilities. - Return
nothingifiterssteps do not reach the target.
Related
References
- [1] D. Cajas. Entropy Pooling with CVaR and EVaR Views. Available at SSRN 7120258 (2026). Section 2.3, Equations 10 and 11, and footnote 9.
PortfolioOptimisers.ep_evar_grid — Function
ep_evar_grid(x::VecNum, w::VecNum, alpha::Number, op::Symbol, rhs::Number,
zstar::Number, pct::Number, K::Integer; iters::Integer = 50,
tol::Number = 1e-10, tilt_iters::Integer = 200, args::Tuple = (),
kwargs::NamedTuple = (;), zlo_frac::Option{<:Number} = nothing)Build the grid of dual variables on which an entropic value-at-risk view is written.
Cajas [1] builds a grid of an odd number K of equidistant points. It moves the dual variable of the prior up and down by a percentage, and pct is that percentage. The anchor is the library's own. For a view with an upper-bound half, the centre of the grid is the dual variable that ep_evar_anchor finds. For a lower-bound view, and for a view whose anchor does not converge, the centre is the dual variable of the prior. The grid of GridTailView also translates its shift, but an EVaR grid does not need to. The shift of the primal programme of EVaR has a closed form in the target and the dual variable, and the row exp((x - rhs) / z) of ep_evar_grid_row already contains it.
Arguments
x: The loss series (-returns).w: The prior probabilities, which sum to one.alpha: The significance level.op: The comparison operator of the view.rhs: The target entropic value at risk.zstar: The dual variable that attains the prior EVaR of the asset.pct: The half-width of the grid, as a fraction of the dual variable at its centre.K: The number of grid points.iters::Integer = 50: The largest number of steps of the anchor.tol::Number = 1e-10: The relative distance from the target at which the anchor stops.tilt_iters::Integer = 200: The largest number of bisection steps of the tilt of one row, inep_row_tilt.args: Additional positional arguments passed to the optimisation function.kwargs: Additional keyword arguments passed to the optimisation function.zlo_frac: The lower end of the bracket of the dual variable, as a fraction of the upper end, which goes toep_evar.
Returns
z::VecNum: The dual variable of each grid point.
Algorithm
- Use the dual variable of the prior as the centre.
- If the view has an upper-bound half, use the dual variable of
ep_evar_anchorinstead. Keep the dual variable of the prior if the anchor does not converge. - Span the dual variable from
zc * (1 - pct)tozc * (1 + pct)inKpoints.Kis odd, so the centre is a point of the grid, and a grid of one point is the centre alone.
Related
References
- [1] D. Cajas. Entropy Pooling with CVaR and EVaR Views. Available at SSRN 7120258 (2026). Section 2.3, Equations 9 to 11, and footnote 9.
PortfolioOptimisers.ep_rlvar_anchor — Function
ep_rlvar_anchor(x::VecNum, w::VecNum, alpha::Number, kappa::Number, rhs::Number,
t::Number, z::Number; iters::Integer = 50, tol::Number = 1e-10,
tilt_iters::Integer = 200, args::Tuple = (),
kwargs::NamedTuple = (;),
bracket::Option{<:RelativisticValueatRiskViewBracket} = nothing) ->
Option{<:RlvarAnchor}Find the primal point of the relativistic value at risk that a posterior attains when it meets an upper-bound view.
A grid point states the view as one row. A posterior that makes the row tight reaches the target only if that grid point is the point that the posterior attains. ep_rlvar_anchor finds the pair that meets both conditions, and the grid of GridTailView has this pair as its centre. The function calls no solver. Cajas [2] states no grid and no anchor, so both are the library's own, and both use the primal programme.
Arguments
x: The loss series (-returns).w: The prior probabilities, which sum to one.alpha: The significance level.kappa: The deformation parameter, in(0, 1).rhs: The target relativistic value at risk.t: The shift variable at the start of the iteration.z: The dual variable at the start of the iteration.iters::Integer = 50: The largest number of steps of the iteration.tol::Number = 1e-10: The relative distance from the target at which the iteration stops.tilt_iters::Integer = 200: The largest number of bisection steps of the tilt of one row, inep_row_tilt.args: Additional positional arguments passed to the optimisation function.kwargs: Additional keyword arguments passed to the optimisation function.bracket: The spans of the searches, which go toep_rlvarandep_rlvar_shift.
Returns
res::Option{<:RlvarAnchor}: The pair and the posterior that attains it, ornothingwhen the iteration does not reach the target.
Algorithm
- Build the row of the current pair with
ep_rlvar_grid_row. Returnnothingwhen the row is not finite. - Tilt the prior with
ep_row_tilt, so that the row is tight. Returnnothingwhen no probability vector makes the row tight. - Compute the pair again with
ep_rlvar, as the minimiser at the tilted probabilities. - Stop when the relativistic value at risk of the tilted probabilities is within
tolof the target. Return the pair and those probabilities. - Return
nothingifiterssteps do not reach the target.
Related
References
- [2] D. Cajas. Entropy Pooling with Relativistic Value at Risk Views. Available at SSRN 7329718 (2026). Section 2, Equation 5.
PortfolioOptimisers.ep_rlvar_grid — Function
ep_rlvar_grid(x::VecNum, w::VecNum, alpha::Number, kappa::Number, op::Symbol,
rhs::Number, zstar::Number, pv::Number, pct::Number, K::Integer;
iters::Integer = 50, tol::Number = 1e-10, tilt_iters::Integer = 200,
args::Tuple = (), kwargs::NamedTuple = (;),
bracket::Option{<:RelativisticValueatRiskViewBracket} = nothing)Build the grid of primal points a relativistic value-at-risk view is written on.
Cajas [2] states the primal programme and no grid of its points. The grid, its translation and its anchor are the library's own, and they use the primal programme.
For a view with an upper-bound half, the centre of the grid is the pair that ep_rlvar_anchor finds. Each shift then minimises the objective at the posterior of that pair. For a lower-bound view, and for a view whose anchor does not converge, the centre is the dual variable of the prior. Each shift then minimises the objective under the prior probabilities, minus the distance from the prior value to the target. The relativistic value at risk and the shift that attains it are both translation-equivariant, so a posterior that moves the value to the target acts, to first order, like a translation of each loss by that distance.
Arguments
x: The loss series (-returns).w: The prior probabilities, which sum to one.alpha: The significance level.kappa: The deformation parameter, in(0, 1).op: The comparison operator of the view.rhs: The target relativistic value at risk.zstar: The dual variable that attains the prior RLVaR of the asset.pv: The prior RLVaR of the asset.pct: The half-width of the grid, as a fraction of the dual variable at its centre.K: The number of grid points.iters::Integer = 50: The largest number of steps of the anchor.tol::Number = 1e-10: The relative distance from the target at which the anchor stops.tilt_iters::Integer = 200: The largest number of bisection steps of the tilt of one row, inep_row_tilt.args: Additional positional arguments passed to the optimisation function.kwargs: Additional keyword arguments passed to the optimisation function.bracket: The spans of the searches, which go toep_rlvarandep_rlvar_shift.
Returns
t::VecNum: The shift variable of each grid point.z::VecNum: The dual variable of each grid point.
Algorithm
- Use the pair of the prior as the centre. Use the distance from the prior value to the target as the translation of each shift.
- If the view has an upper-bound half, use the pair and the posterior of
ep_rlvar_anchorinstead, with no translation. Keep the pair of the prior if the anchor does not converge. - Span the dual variable from
zc * (1 - pct)tozc * (1 + pct)inKpoints.Kis odd, so the centre is a point of the grid, and a grid of one point is the centre alone. - Minimise the objective over the shift at each point with
ep_rlvar_shift, and subtract the translation.
Related
References
- [2] D. Cajas. Entropy Pooling with Relativistic Value at Risk Views. Available at SSRN 7329718 (2026). Section 2, Equation 5.
PortfolioOptimisers.ep_sequential_start — Method
ep_sequential_start(tv::AbstractSequentialTailViewConstraint, w::VecNum)Read the first surrogate row of a sequential tail view at probabilities under which the row can meet the view.
A linear upper bound is tight where the function reads it. But the value of the row cannot fall below the smallest value of the row over the simplex. If the target is further below the prior than that, the first solve has no feasible point.
This happens with the relativistic value at risk. At the pair of the prior, its bound has a floor at the shift plus the deformed logarithm, and only the tail term above the floor can change. ep_sequential_start moves the multipliers toward the target with a chain of exponential tilts before a solver runs. The anchors of GridTailView use the same method to find the centres of their grids. The function calls no solver.
Algorithm
- Normalise
wto sum to one, and read the row atwwithep_refine_tail_view. Returntvwhen its primal side is empty, because the view is then convex and the row is empty. - Calculate
need, the value that the row must reach. It is the target, minus the constant of the row, minus the coefficient-weighted sum of the measures of the dual side under the current probabilities.ep_tail_surrogate_rowgives each measure. - Return
tvwhen the largest coefficient of the row is at leastneed. A probability vector then meets the row, and the solve can start. - Otherwise, tilt the probabilities with
ep_row_tilt, so that the row goes nine tenths of the way from its current value to its largest coefficient. Read the row again at the tilted probabilities, and go back to step 2. - When the row is constant on the support of the probabilities, no tilt along the row exists. For a CVaR row this happens when the worst primal loss holds at least
alpha. Then tilt in the same way alongl, the coefficient-weighted sum of the primal losses, and whenlis constant too, along the coefficient-weighted losses of each primal asset in turn. The coefficients of the primal side are negative, so each such tilt moves mass away from the worst primal losses. - Do at most
iterssteps. When no tilt exists, returntvwith its last row.
Arguments
tv: The sequential tail view constraint, with any row.w: The prior probability weights.
Returns
tv::AbstractSequentialTailViewConstraint: The tail view constraint with its first row.
Related
PortfolioOptimisers.add_ep_tail_view! — Function
add_ep_tail_view!(model::JuMP.Model, pw, tv::AbstractEntropyPoolingTailView,
sc1::Number)Add the variables and constraints of one tail view to an entropy pooling JuMP model.
Every conditional, entropic and relativistic value-at-risk view goes into the model through add_ep_tail_view!. Each formulation has its own method, which dispatches on the tail view constraint that ep_tail_views! made. The three dual tail view constraints share one method, and the three sequential tail view constraints share another. Both methods write one dual block for each asset with ep_tail_dual_block!, and they differ in the row that bounds the sum. Cajas [1] and Cajas [2] state the dual, the integer and the entropic grid formulations. The sequential formulation and the grid formulation of the relativistic value at risk are the library's own.
JuMP formulation
This section covers the five methods and every entry that each method registers. No entry has a name. One model holds one block for each view, so a name collides at the second view of a family. Nothing reads these entries back by name.
Variables
pw: $\boldsymbol{p}$: $T \times 1$ posterior probabilities of the observations, summing to one. They are the unknown of the entropy pooling problem. The caller gives it, and every entry below reads it.nu,tau,varsigma:ep_tail_dual_block!makes them once for each asset of a dual tail view constraint, and once for each asset of the dual side of a sequential tail view constraint. Its# JuMP formulationsection names them.y,q: $\boldsymbol{y}$ and $\boldsymbol{q}$, two $\bar{s} \times 1$ vectors that theIntegerConditionalValueatRiskViewConstraintmethod makes once for each asset.yis binary, andqhas a lower bound of zero.y: $\boldsymbol{y}$, a binary $K \times 1$ vector that theGridEntropicValueatRiskViewConstraintandGridRelativisticValueatRiskViewConstraintmethods make. It selects the grid point at which the posterior meets the view.
Expressions
- $\varepsilon$: The left hand side of the view, which each method builds once and which has no name. For the dual tail view constraints, it is the coefficient-weighted sum of the expressions that
ep_tail_dual_block!returns for each asset. For the integer tail view constraint, it is the coefficient-weighted sum of the tail sums of each asset. For the sequential tail view constraints, it is the coefficient-weighted sum of the expressions of the dual side, plus the surrogate row $b + \boldsymbol{c}^{\intercal} \boldsymbol{p}$.
Constraints
The method of the three dual tail view constraints, LinearConditionalValueatRiskViewConstraint, ConicEntropicValueatRiskViewConstraint and ConicRelativisticValueatRiskViewConstraint, registers one block of ep_tail_dual_block! for each asset that the view names, and one row:
- $s_{c1} \left(\bar{c} - \sum_{i} \gamma_{i} \sum_{j=1}^{T} \nu_{i,\,j} x_{i,\,j}\right) \leq 0$.
The method of the three sequential tail view constraints, SequentialConditionalValueatRiskViewConstraint, SequentialEntropicValueatRiskViewConstraint and SequentialRelativisticValueatRiskViewConstraint, registers one block of ep_tail_dual_block! for each asset of the dual side, and one row over both sides. When the largest absolute coefficient of the surrogate row is larger than one, the method divides the row by it. So the coefficients of the surrogate row stay in $[-1, 1]$, at a small dual variable of a relativistic value at risk too:
- $s_{c1} \left(\bar{c} - \sum_{i \in \mathcal{P}} \gamma_{i} \sum_{j=1}^{T} \nu_{i,\,j} x_{i,\,j} - b - \sum_{j=1}^{T} c_{j} p_{j}\right) \Big/ \max\left(1, \lVert \boldsymbol{c} \rVert_{\infty}\right) \leq 0$.
The IntegerConditionalValueatRiskViewConstraint method registers five rows for each asset that the view names, over the window of the $\bar{s}$ largest losses of that asset:
- $s_{c1} \left(q_{j} - y_{j}\right) \leq 0$, $\forall\, j = 1,\ldots,\bar{s}$.
- $s_{c1} \left(q_{j} - p_{[j]}\right) \leq 0$, $\forall\, j = 1,\ldots,\bar{s}$.
- $s_{c1} \left(p_{[j]} - (1 - y_{j-1}) - q_{j}\right) \leq 0$, $\forall\, j = 2,\ldots,\bar{s}$.
- $s_{c1} \left(y_{j} - y_{j+1}\right) \leq 0$, $\forall\, j = 1,\ldots,\bar{s}-1$.
- $s_{c1} \left(\sum_{j=1}^{\bar{s}} q_{j} - \alpha\right) = 0$.
The method also registers one row on $\varepsilon = \sum_{i} \dfrac{\gamma_{i}}{\alpha} \sum_{j=1}^{\bar{s}} q_{i,\,j} x_{i,\,[j]}$. The operator of the view selects one of these three rows:
- $s_{c1} \left(\varepsilon - \bar{c}\right) = 0$ under
:eq. - $s_{c1} \left(\bar{c} - \varepsilon\right) \leq 0$ under
:geq. - $s_{c1} \left(\varepsilon - \bar{c}\right) \leq 0$ under
:leq.
The GridEntropicValueatRiskViewConstraint and GridRelativisticValueatRiskViewConstraint methods each register the rows below. Each method divides the row of each grid point by its bound:
- $s_{c1} \left(\sum_{k=1}^{K} y_{k} - 1\right) = 0$.
- $s_{c1} \left(\sum_{j=1}^{T} \dfrac{c_{k,\,j}}{b_{k}} p_{j} - 1 - M M_{k} (1 - y_{k})\right) \leq 0$, $\forall\, k = 1,\ldots,K$, with $M_{k} = \max_{j} c_{k,\,j} / b_{k} - 1$.
Where:
- $s_{c1}$: Constraint scale of the entropy pooling optimiser. It multiplies both sides of a row, so a positive value leaves the feasible set unchanged.
- $\boldsymbol{p}$: $T \times 1$ posterior probabilities of the observations, summing to one. They are the unknown of the entropy pooling problem.
- $\alpha$: Significance level (left tail probability), $\alpha \in (0, 1)$.
- $T$: Number of observations.
- $\bar{c}$: Target conditional value at risk of the view.
- $x_{i,\,j}$: The loss of asset $i$ at observation $j$, which is the negated return.
- $\boldsymbol{\nu}_{i}$: The $T \times 1$ vector of weights that attains the measure of asset $i$, from its block of
ep_tail_dual_block!. - $\bar{c}$: The target of the view, for each of the three measures. A sequential tail view constraint holds the view as a lower bound, so its target has the sign of that orientation.
- $\bar{s}$: The length of the window of the largest losses of one asset, from
ep_sbar. - $x_{[j]}$, $p_{[j]}$: The loss and the posterior probability of the observation at position $j$ of that window, which is in ascending order.
- $\gamma_{i}$: The coefficient that the view gives asset $i$.
- $\mathcal{P}$: The assets on the dual side of a sequential tail view constraint.
- $b$, $\boldsymbol{c}$: The surrogate row that a sequential tail view constraint holds, from
ep_tail_surrogate_row. - $\boldsymbol{y}$: A binary vector. In the integer conditional value-at-risk method, it marks the tail of the window of one asset. In the two grid methods, it selects one grid point.
- $\boldsymbol{q}$: The $\bar{s} \times 1$ vector that holds the tail mass of each observation of the window. The tail mass is $p_{[j]}$ above the lowest marked observation, a part of $p_{[j]}$ at that observation, and zero below it.
- $\varepsilon$: The left hand side of an integer conditional value-at-risk view, which is the coefficient-weighted sum of the posterior CVaRs of the assets.
- $K$: The number of grid points that the tail view constraint holds.
- $c_{k,\,j}$: The scaled coefficient of observation $j$ at grid point $k$, from
ep_evar_grid_roworep_rlvar_grid_row. - $b_{k}$: The scaled bound of grid point $k$, from the same two functions. For the entropic value at risk, it is $\alpha$ times the reciprocal that
ep_evar_grid_rowreturns. For the relativistic value at risk, it is the target thatep_rlvar_grid_rowreturns. - $M_{k}$: The smallest big-M constant that releases the row of grid point $k$.
- $M$: The big-M multiplier that the grid tail view constraint holds.
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 two grid methods and the sequential method bound the statistic. The dual method is exact. The integer method is exact for each posterior whose tail of mass $\alpha$ is inside the window of the $\bar{s}$ largest losses. When $\bar{s} = T$, this holds for every posterior.
The sequential method is a restriction of the view, and each re-solve makes it tighter.
Direction. The surrogate row bounds each measure of the primal side from above, and each of these measures has a negative coefficient. So the value of the row is at or below the left hand side of the view. A posterior that meets the row meets the view.
Quantity. The coefficient-weighted sum of the posterior measures that the view names, which is a statistic of
pw.Tightness. The row is tight at the posterior at which the function read it.
entropy_poolingreads the row again at each posterior withep_refine_tail_view, and solves again. It stops when the slack is within thetolof the tail view constraint, or afteritersre-solves. At the fixed point the posterior meets the view to that tolerance. Before the fixed point, the posterior meets the view with slack.
The two grid methods are also a restriction of the view.
Direction. Every grid point is a feasible point of the primal programme of the statistic, so its row bounds the statistic from above. The block asks one grid point to hold, so the posterior statistic is at or below the target. The encoding can only be tighter than the view, so a posterior that meets the block meets the view.
Quantity. The posterior entropic value at risk under the
GridEntropicValueatRiskViewConstraintmethod, and the posterior relativistic value at risk under theGridRelativisticValueatRiskViewConstraintmethod. Both are statistics ofpw.Tightness. The bound is tight when the grid holds the point that the posterior attains.
ep_evar_anchorandep_rlvar_anchorput the centre of the grid at that point. When the anchor does not converge, the grid uses the point of the prior as its centre, and the posterior statistic can be strictly below the target. In that case, increasepctorK.
Each method divides each grid row by its bound, so that the right hand side is one. At a small dual variable, the bound $b_{k}$ is far below the feasibility tolerance of a solver. At that scale the whole row is inside the tolerance, and the solver accepts any posterior on it. The selector can then select that grid point when the posterior does not meet the view.
$M M_{k}$ releases the rows of the grid points that the selector does not select. $\boldsymbol{p}$ sums to one, so the left hand side of row $k$ is never larger than $\max_{j} c_{k,\,j} / b_{k}$, and $M_{k}$ is the smallest constant that releases the row. An $M$ below one can remove a posterior that the view accepts, so $M \geq 1$. An $M$ above one gives the released rows a margin for a posterior whose sum is one only to the tolerance of the solver. But it also increases the slack that the integrality tolerance opens on the selected row, so the default is $M = 1$.
The lower-bound half of a grid view is a relaxation, and this function does not receive it. The view needs the primal objective to be at least the target at every dual variable, and the rows ask for this only at the $K$ grid points. So the posterior statistic, which is the minimum over all dual variables, can be below the target. ep_add_evar_view! and ep_add_rlvar_view! add those rows to the entropy pooling constraint dictionary, not to the model.
Arguments
model: The entropy pooling JuMP model.pw: The vector of posterior probability variables.tv: The tail view constraint.sc1: The constraint scale factor.
Returns
nothing: The function mutatesmodelin-place.
Related
AbstractEntropyPoolingTailViewep_tail_dual_block!LinearConditionalValueatRiskViewConstraintIntegerConditionalValueatRiskViewConstraintConicEntropicValueatRiskViewConstraintGridEntropicValueatRiskViewConstraintConicRelativisticValueatRiskViewConstraintGridRelativisticValueatRiskViewConstraintAbstractSequentialTailViewConstraintentropy_poolingEntropyPoolingPrior
References
References
- [1]
- D. Cajas. Entropy Pooling with CVaR and EVaR Views. Available at SSRN 7120258 (2026).
- [2]
- D. Cajas. Entropy Pooling with Relativistic Value at Risk Views. Available at SSRN 7329718 (2026).
- [157]
- A. Meucci. Fully flexible views: theory and practice. Risk 21, 97–102 (2008).