Near optimal centering (b): private API

PortfolioOptimisers.assemble_near_optimal_centering_model! — Method
assemble_near_optimal_centering_model!(alg, model, noc, setup, rd)

Run the model-assembly middle of the Near Optimal Centering variant alg.

The two variants share a head and a Result, and differ only in the middle and in the solve. This is the middle. ConstrainedNearOptimalCentering delegates to the shared assemble_jump_model!. UnconstrainedNearOptimalCentering runs the four steps of that sequence it needs — non-fixed fees, risk, scalarisation, return — and then the same assert_frontier_sweep_cap tail.

set_non_fixed_fees! runs before the risk build, as it does in assemble_jump_model!. It is what makes the model's return expression net of fees, and the barrier compares that expression against the noc_rt target, which near_optimal_centering_setup computes net of fees as well. A fixed fee still does not apply: it needs the cardinality binaries set_mip_constraints! produces, and that builder belongs to the middle this variant does not run.

UnconstrainedNearOptimalCentering lists every opt setting the resulting model reads and every setting it does not.

The unconstrained variant reads setup.opt, which near_optimal_centering_setup has already replaced with the no_bounds_optimiser copy. So opt.ret is the bound-free return estimator, and opt.pe, opt.fees and opt.sca are the processed values setup.attrs carries. The phylogeny argument is nothing because the variant applies no phylogeny constraints.

Arguments

Returns

  • nothing. Mutates model in place.

Related

source
PortfolioOptimisers.solve_near_optimal_centering! — Method
solve_near_optimal_centering!(alg, model, noc, setup)

Run the solve tail of the Near Optimal Centering variant alg.

Reads the arguments each solve_noc! overload needs off setup, so the two variants share one _optimise head. The constrained variant sweeps both frontier registries, so it passes the two Val flags that select the sweeping overload; the unconstrained variant registers no frontier bound and passes neither.

Arguments

Returns

  • (retcode, sol) or (retcodes, sols), as solve_noc! returns.

Related

source
PortfolioOptimisers.get_overall_retcode — Function
get_overall_retcode(w_min_retcode, w_opt_retcode, w_max_retcode, noc_retcode)

Compute the overall optimisation return code from individual sub-problem return codes.

Combines the return codes from the minimum, optimal, and maximum weight sub-problems with the near-optimal centering return code to determine the overall status.

Arguments

  • w_min_retcode: Return code from the minimum weight sub-problem.
  • w_opt_retcode: Return code from the optimal weight sub-problem.
  • w_max_retcode: Return code from the maximum weight sub-problem.
  • noc_retcode: Return code from the near-optimal centering sub-problem.

Returns

  • OptimisationSuccess() if every sub-problem succeeded; otherwise an OptimisationFailure whose res is a named tuple (; msg, w_min, w_opt, w_max, noc_opt) carrying the failure summary and the individual sub-problem return codes (including their solver trial diagnostics).

Related

source
PortfolioOptimisers.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, args...)

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 containing risk_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

source