JuMP Optimiser (a): private API
PortfolioOptimisers.ProcessedAttributes — Type
abstract type ProcessedAttributes <: AbstractResultAbstract supertype for processed optimiser attributes.
A subtype is the flat bundle of results one optimiser family produces once per optimise call and hands to its model-assembly pipeline. Every collection of processed optimiser attributes subtypes ProcessedAttributes.
Related
PortfolioOptimisers.assert_finite_nonnegative_real_or_vec — Function
assert_finite_nonnegative_real_or_vec(val::Number)
Assert that val is finite and positive; throw an ArgCheck error otherwise.
Accepts a scalar Number or a VecNum. The scalar overload requires isfinite(val) and val > 0. The vector overload is weaker: it requires at least one finite element, at least one strictly positive element, and no negative element, so a vector carrying zeros passes where the scalar 0 does not.
Arguments
val: Scalar or vector to validate.
Returns
nothing.
Examples
julia> PortfolioOptimisers.assert_finite_nonnegative_real_or_vec(1.0)julia> PortfolioOptimisers.assert_finite_nonnegative_real_or_vec([0.5, 1.0])Related
PortfolioOptimisers.jump_optimiser_td_defaults — Function
jump_optimiser_td_defaults(
) -> @NamedTuple{pe::EmpiricalPrior{PortfolioOptimisersCovariance{Covariance{SimpleExpectedReturns{Nothing, Nothing, Nothing}, GeneralCovariance{SimpleCovariance, Nothing, Nothing}, FullMoment, Nothing, Nothing, Nothing}, MatrixProcessing{Posdef{UnionAll, @NamedTuple{}}, Nothing, Nothing, Nothing, NTuple{4, Symbol}}, Nothing}, SimpleExpectedReturns{Nothing, Nothing, Nothing}, Nothing, Nothing, Nothing, Nothing}, wb::WeightBounds{Float64, Float64}, bgt::Float64, ret::ArithmeticReturn{JuMPReturnsSettings{Float64, Nothing, Bool, Bool, Bool}, Nothing, Nothing}, sca::SumScalariser}
Return the static defaults of the JuMPOptimiser fields that may hold a TimeDependent.
Shared by the constructor's test-substitution pass and time_dependent_field_defaults, so the fold-less value of a field is declared once. Fields whose static default is nothing are omitted.
Related
PortfolioOptimisers.investable_view — Function
investable_view(
optimiser::JuMPOptimisationEstimator,
rd::ReturnsResult,
_::AbstractPriorResult,
_::Nothing
) -> Tuple{JuMPOptimisationEstimator, ReturnsResult}
Reduce an optimisation estimator and its returns data to the assets an Investable Mask keeps.
processed_jump_optimiser_attributes reduces what the bundle carries — the prior result and every constraint result. It cannot reduce what the head carries: an initial weight vector, a risk measure holding per-asset data, a tracking estimator, a custom constraint. Those travel from the head into assemble_jump_model! unmediated by the bundle, so each head takes this view of itself and of rd before it assembles a model.
The nothing method is the whole all-investable path: it returns both arguments unchanged, so a universe with nothing to exclude allocates nothing and takes the route it took before the mask existed.
The returns matrix the view slices tracking against is rd.X, and pr.X when the caller stated a fitted prior instead of data. port_opt_view reads the prior's own matrix in that case and ignores what it is given, so either is correct and only one of them always exists.
The mask is handed to port_opt_view as the index vector findall(imsk) rather than as the mask itself. Every other caller of that verb passes an integer index, and a view specialised on one index type is a view whose inference is already exercised.
Arguments
optimiser::JuMPOptimisationEstimator: The optimiser head to view.rd: The returns result to use.pr: Prior result.imsk: The Investable Mask the optimisation reduced on:trueat every asset whose prior moments were finite. It isnothingwhen every asset was investable, and that sentinel is what skips both the reduction and the expansion.investable_maskderives it once from the full-universe prior result, and the result carries it, because the reduced prior can no longer yield it.
Returns
(optimiser, rd): Both restricted to the investable assets, or both unchanged.
Related