Near optimal centering
PortfolioOptimisers.NearOptimalCenteringAlgorithm Type
abstract type NearOptimalCenteringAlgorithm <: OptimisationAlgorithmAbstract supertype for Near Optimal Centering algorithm variants.
Related Types
sourcePortfolioOptimisers.ConstrainedNearOptimalCentering Type
struct ConstrainedNearOptimalCentering <: NearOptimalCenteringAlgorithmConstrained Near Optimal Centering algorithm.
Applies Near Optimal Centering within the feasible region defined by the portfolio constraints.
Related Types
sourcePortfolioOptimisers.UnconstrainedNearOptimalCentering Type
struct UnconstrainedNearOptimalCentering <: NearOptimalCenteringAlgorithmUnconstrained Near Optimal Centering algorithm.
Applies Near Optimal Centering ignoring feasibility constraints (weights may temporarily violate bounds).
Related Types
sourcePortfolioOptimisers.NearOptimalCenteringResult Type
struct NearOptimalCenteringResult{__T_oe, __T_pa, __T_w_min_retcode, __T_w_opt_retcode, __T_w_max_retcode, __T_noc_retcode, __T_retcode, __T_sol, __T_model, __T_fb} <: NonFiniteAllocationOptimisationResultResult type for Near Optimal Centering portfolio optimisation.
Fields
oe: Type of the optimisation estimator that produced this result.pa: Processed optimisation attributes.w_min_retcode: Return code for the minimum-risk sub-problem.w_opt_retcode: Return code for the optimal-objective sub-problem.w_max_retcode: Return code for the maximum-risk sub-problem.noc_retcode: Return code for the Near Optimal Centering problem.retcode: Overall return code.sol: Optimisation solution.model: The JuMP model.fb: Fallback result.
Related
sourcePortfolioOptimisers.NearOptimalSetup Type
struct NearOptimalSetup{__T_w_opt, __T_rk_opt, __T_rt_opt, __T_rt_min, __T_rt_max, __T_w_min, __T_w_max, __T_r, __T_opt, __T_w_min_retcode, __T_w_opt_retcode, __T_w_max_retcode} <: AbstractResultIntermediate result type storing the setup data for Near Optimal Centering.
Holds pre-computed portfolio weights, risk and return targets, and sub-problem return codes needed to formulate and solve the NOC optimisation problem.
Fields
w_opt: Optimal (central) portfolio weights.rk_opt: Optimal risk target for the NOC problem.rt_opt: Optimal return target for the NOC problem.rt_min: Minimum return from the minimum-risk portfolio.rt_max: Maximum return from the maximum-return portfolio.w_min: Minimum-risk portfolio weights.w_max: Maximum-risk (maximum-return) portfolio weights.r: Risk measure or vector of risk measures.opt: Processed JuMP optimiser configuration.w_min_retcode: Return code for the minimum-risk sub-problem.w_opt_retcode: Return code for the optimal-objective sub-problem.w_max_retcode: Return code for the maximum-risk sub-problem.
Related
sourcePortfolioOptimisers.NearOptimalCentering Type
struct NearOptimalCentering{__T_opt, __T_r, __T_obj, __T_bins, __T_w_min, __T_w_min_ini, __T_w_opt, __T_w_opt_ini, __T_w_max, __T_w_max_ini, __T_ucs_flag, __T_alg, __T_fb} <: RiskJuMPOptimisationEstimatorNear Optimal Centering (NOC) portfolio optimiser.
NearOptimalCentering finds a portfolio that is centrally located within the region of near-optimal solutions. It first solves the minimum-risk, maximum-risk, and user-specified optimal-objective sub-problems, then maximises the minimum distance to the efficient frontier boundaries, yielding a portfolio that is robust to small perturbations in risk-return space.
Fields
opt: JuMP optimiser configuration.r: Risk measure or vector of risk measures.obj: Portfolio objective function for the central (optimal) point.bins: Number of equally-spaced risk bins for the frontier approximation.w_min: Pre-computed minimum-risk portfolio weights (ornothing).w_min_ini: Initial weights for the minimum-risk sub-problem.w_opt: Pre-computed optimal portfolio weights (ornothing).w_opt_ini: Initial weights for the optimal sub-problem.w_max: Pre-computed maximum-risk portfolio weights (ornothing).w_max_ini: Initial weights for the maximum-risk sub-problem.ucs_flag: Iftrue, uncertainty set constraints are used.alg: Near Optimal Centering algorithm variant.fb: Fallback optimiser.
Constructors
NearOptimalCentering(;
opt::JuMPOptimiser = JuMPOptimiser(),
r::RM_VecRM = Variance(),
obj::Option{<:ObjectiveFunction} = nothing,
bins::Option{<:Number} = nothing,
w_min::Option{<:VecNum} = nothing,
w_min_ini::Option{<:VecNum} = nothing,
w_opt::Option{<:VecNum_VecVecNum} = nothing,
w_opt_ini::Option{<:VecNum_VecVecNum} = nothing,
w_max::Option{<:VecNum} = nothing,
w_max_ini::Option{<:VecNum} = nothing,
ucs_flag::Bool = false,
alg::NearOptimalCenteringAlgorithm = ConstrainedNearOptimalCentering(),
fb::Option{<:OptE_Opt} = nothing
) -> NearOptimalCenteringKeywords correspond to the struct's fields.
Related
PortfolioOptimisers.near_optimal_centering_risks Function
near_optimal_centering_risks(scalariser, r, pr, fees, slv, w_min, w_opt, w_max)Compute the scaled risk values for the minimum, optimal, and maximum portfolios.
Used internally by Near Optimal Centering to evaluate the risk at the three anchor portfolios (minimum-risk, optimal, maximum-risk) using the given risk measure(s) and scalarisation strategy.
Arguments
scalariser: Risk scalarisation strategy (e.g.SumScalariser,LogSumExpScalariser).r: Risk measure or vector of risk measures.pr: Prior result containing asset data.fees: Optional fees configuration.slv: Solver or vector of solvers.w_min: Minimum-risk portfolio weights.w_opt: Optimal portfolio weights (vector or vector of vectors).w_max: Maximum-risk portfolio weights.
Returns
(risk_min, risk_opt, risk_max): Tuple of risk values at the three anchor portfolios.
Related
sourcePortfolioOptimisers.near_optimal_centering_setup Function
near_optimal_centering_setup(noc::NearOptimalCentering, rd::ReturnsResult; dims::Int = 1)Compute all prerequisite data for Near Optimal Centering.
Solves the minimum-risk, optimal-objective, and maximum-risk sub-problems (unless pre-computed weights are provided), then computes the risk and return targets for the NOC problem.
Arguments
noc::NearOptimalCentering: NOC estimator configuration.rd::ReturnsResult: Returns data.dims::Int: Observation dimension (default1).
Returns
NearOptimalSetupcontaining all setup data needed for the NOC optimisation.
Related
sourcePortfolioOptimisers.set_near_optimal_centering_constraints! Function
set_near_optimal_centering_constraints!(model::JuMP.Model, wb::WeightBounds)Add Near Optimal Centering logarithmic barrier constraints to the JuMP model.
Introduces log variables for portfolio weights, upper bound distances, risk, and return, then adds exponential cone constraints implementing the analytic centre formulation.
Arguments
model::JuMP.Model: JuMP optimisation model.wb::WeightBounds: Weight bounds configuration.
Returns
- Objective expression for the NOC barrier function.
Related
sourcePortfolioOptimisers.set_near_optimal_objective_function! Function
set_near_optimal_objective_function!(alg, model, opt)Set the Near Optimal Centering objective function in the JuMP model.
Formulates the NOC objective based on the algorithm variant. For UnconstrainedNearOptimalCentering, uses only the barrier function. For ConstrainedNearOptimalCentering, also adds objective penalties and custom objective terms.
Arguments
alg: NOC algorithm variant (UnconstrainedNearOptimalCenteringorConstrainedNearOptimalCentering).model::JuMP.Model: JuMP optimisation model.opt::BaseJuMPOptimisationEstimator: JuMP optimiser configuration.
Returns
nothing.
Related
sourcePortfolioOptimisers.solve_noc! Function
solve_noc!(noc, model, rk_opt, rt_opt, opt, args...)Solve the Near Optimal Centering problem given the model, risk, and return targets.
Sets model parameters for the risk and return targets, configures the NOC objective, and solves the JuMP model. Multiple overloads handle different algorithm variants and frontier sweep modes.
Arguments
noc::NearOptimalCentering: NOC estimator configuration.model::JuMP.Model: JuMP optimisation model.rk_opt: Risk target(s) for the NOC problem.rt_opt: Return target(s) for the NOC problem.opt::BaseJuMPOptimisationEstimator: JuMP optimiser configuration.args...: Additional arguments (frontier bounds, flags, etc.).
Returns
(retcode, sol)or(retcodes, sols)depending on the overload.
Related
sourcePortfolioOptimisers.compute_ret_lbs Method
compute_ret_lbs(lbs, args...)Compute the return lower bounds for the efficient frontier sweep.
Dispatches based on the type of lbs: if a pre-computed vector of lower bounds is provided, returns it directly. If a Frontier specification is given, solves the minimum and maximum return sub-problems and constructs a range of bounds.
Arguments
lbs: Pre-computed return bounds vector (VecNum) orFrontierconfiguration.args...: Additional arguments (model, optimiser, prior, etc.) needed whenlbsis aFrontier.
Returns
- Vector or range of return lower bounds for frontier sweep.
Related
sourcePortfolioOptimisers.compute_ret_lbs Method
compute_ret_lbs(lbs::Frontier, model::JuMP.Model, mr::MeanRisk, ret::JuMPReturnsEstimator, pr::AbstractPriorResult, fees::Option{<:Fees})Compute return lower bounds for a MeanRisk efficient frontier sweep by solving minimum and maximum return sub-problems.
Solves the minimum-risk and maximum-return portfolios, then constructs a uniformly spaced range of lbs.N return targets spanning the two extremes.
Arguments
lbs::Frontier: Frontier configuration specifying the number of points.model::JuMP.Model: JuMP optimisation model.mr::MeanRisk: MeanRisk estimator configuration.ret::JuMPReturnsEstimator: Returns estimator.pr::AbstractPriorResult: Prior result with asset moments.fees::Option{<:Fees}: Optional fees configuration.
Returns
- Range of return lower bounds for the frontier sweep.
Related
sourcePortfolioOptimisers.compute_ret_lbs Method
compute_ret_lbs(lbs::Frontier, rt_min::Number, rt_max::Number)Compute return lower bounds for a NearOptimalCentering frontier sweep from pre-computed minimum and maximum return values.
Constructs a uniformly spaced range of lbs.N return targets between rt_min and rt_max.
Arguments
lbs::Frontier: Frontier configuration specifying the number of points.rt_min::Number: Minimum portfolio return (from the minimum-risk portfolio).rt_max::Number: Maximum portfolio return (from the maximum-return portfolio).
Returns
- Range of
lbs.Nequally spaced return lower bounds.
Related
sourcePortfolioOptimisers.compute_risk_ubs Method
compute_risk_ubs(model, opt, ...)Compute or rebuild risk upper bounds for the efficient frontier sweep.
Extracts the risk frontier from the model and rebuilds any frontier bounds that have not yet been computed as numeric vectors.
Arguments
model::JuMP.Model: JuMP optimisation model containing the risk frontier.opt: Optimiser configuration.Additional arguments (prior, fees, weights, etc.).
Returns
- Updated risk frontier vector of pairs.
Related
sourcePortfolioOptimisers.compute_risk_ubs Method
compute_risk_ubs(model::JuMP.Model, noc::NearOptimalCentering{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:ConstrainedNearOptimalCentering}, pr::AbstractPriorResult, fees::Option{<:Fees}, w_min::VecNum, w_max::VecNum)Compute risk upper bounds for a constrained NearOptimalCentering frontier sweep.
Identifies risk frontier entries that are not yet resolved (i.e. not concrete weight vectors) and rebuilds them using the minimum and maximum portfolio weights.
Arguments
model::JuMP.Model: JuMP optimisation model containingrisk_frontier.noc::NearOptimalCentering{..., <:ConstrainedNearOptimalCentering}: Constrained Near Optimal Centering optimiser.pr::AbstractPriorResult: Prior result with asset moments.fees::Option{<:Fees}: Optional fees configuration.w_min::VecNum: Minimum-risk portfolio weights.w_max::VecNum: Maximum-risk (maximum-return) portfolio weights.
Returns
- Updated risk frontier vector of
(keys, vals)pairs.
Related
sourcePortfolioOptimisers.optimise Function
optimise(noc::NearOptimalCentering{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:Any,
<:Any, <:Any, <:Any, <:Any, <:Any, Nothing
},
rd::ReturnsResult = ReturnsResult(); dims::Int = 1,
str_names::Bool = false, save::Bool = true, kwargs...) -> NearOptimalCenteringResultArguments
noc: The near optimal centering optimiser to use.rd: The returns result to use. Ifisa(hec.opt.pe, AbstractPriorResult),rdis not necessary if doing a standalone optimisation, but may be required/desired by fallbacks and/or clusterisation.dims: The dimension along which observations advance in time.str_names: Whether to use string names for the assets in the optimisation.save: Whether to save the JuMP model in the optimisation result.kwargs: Additional keyword arguments passed to the optimisation function.