Allocation Set programme

set_allocation_set_constraints! adds the constraints of a ProgrammeAllocationSet to a JuMP model, in the order a JuMP optimiser adds them. The model is the projection of a raw step onto the set of allowed weights. A follow-the-leader rule adds the same constraints to the optimisation it solves again at each period, through a private function that registers them under other names, so the rule keeps its own constraints and gains those of the set. When the projection does not solve, the rule keeps the weights it had after the price moves of the period, so it trades nothing in that period.

PortfolioOptimisers.set_allocation_set_constraints! — Function
set_allocation_set_constraints!(model::JuMP.Model, set::BoundedAllocationSet, w::AbstractVector, X, pr = nothing)
set_allocation_set_constraints!(model::JuMP.Model, set::BoundedAllocationSet, cbr::Nothing)
set_allocation_set_constraints!(model::JuMP.Model, set::ProgrammeAllocationSet, w::AbstractVector, X, pr = allocation_set_prior(set, X))
set_allocation_set_constraints!(model::JuMP.Model, set::ProgrammeAllocationSet, cbr::ResolvedConstraintBlock)

Adds the constraints of a resolved Allocation Set to the bare projection model.

The model must already hold w, k, the two scales and the observation count. On both kinds of set the function adds the weight bounds and the budget of one. On a ProgrammeAllocationSet the projection is the owner of the model, and the set is the owner of its block. The projection writes the budget of one, and the block builder set_block_constraints! adds every kind of the block, which a JuMP optimiser adds through the same builder. The bounds builder set_allocation_risk_return_bounds! adds the risk ceilings and the return floor of the set between the two phases of the block.

The projection programme of project calls the three-argument form. It resolves the block of the set through the shared entry of a bare head, resolve_projection_entry, and gives the set viewed at the Investable Mask and the Result of its block. The four-argument and the five-argument forms are the direct call. They resolve the step themselves, on a model that already holds the width of w, so they cannot drop an asset. A direct call refuses an asset that the prior cannot price, with assert_set_prior_priced, and a distance reader of the set that refuses an asset raises its DistanceReaderRefusalError. A JuMP head does not call this function. The leader re-solve of FollowTheLeader passes the set as a second block of the entry of the head, and assemble_jump_model! adds the block with the same builders under the namespace blk_2_.

Algorithm

  1. In the direct call on a programme set, the default of pr fits the set's prior on X with allocation_set_prior.
  2. In the direct call on a programme set, resolve the step with resolve_allocation_set_step, which gives the set after factory(set, w) and the Result cbr of its block, and call the three-argument form.
  3. On a bounded set, add the weight bounds and the budget of one with set_allocation_set_bounds!, and return set.wb with no block Result.
  4. On a programme set, add the budget of one with set_budget_constraints!. Add the block, the ceilings and the floor with add_allocation_set_block! under the empty prefix. Return the bounds of the step and cbr.

Arguments

  • model::JuMP.Model: The JuMP optimisation model.
  • set: The Allocation Set, resolved once per fold. In the three-argument form, the set after factory(set, w), viewed at the Investable Mask of the step.
  • w: The Price-Adjusted Allocation the step trades from. It is the reference of the turnover ceilings and of a tracking benchmark that is not fixed.
  • X: The rows the head holds through the period, a ReturnsResult, or nothing.
  • pr: The prior result that the slots which read the rows are built on, allocation_set_prior of the set on X, or nothing when the set reads no rows.
  • cbr: The ResolvedConstraintBlock of the set at the step, or nothing for a bounded set.

Validation

  • A slot that reads the rows, with X === nothing. The default of pr throws an ArgumentError, because a projection gets the rows only inside an Online Update.
  • In the direct call, a prior whose Investable Mask leaves out an asset the model trades. assert_set_prior_priced throws an ArgumentError.

Returns

  • (wb, cbr)::Tuple: The weight bounds of the step that the model holds, and the ResolvedConstraintBlock of the set, or nothing for a bounded set. The projection programme of project reads the floor of wb under a barrier geometry.

Related

source
PortfolioOptimisers.project — Method
project(proj::AbstractProjectionGeometry, e::Tuple, q::AbstractVector,
        w::AbstractVector, X::Option{<:ReturnsResult})

Builds and solves the projection programme of one step at the Investable Mask imsk, from the entry e = (imsk, set, cbr) that the shared entry resolved for the step.

resolve_projection_entry gives the entry. The method takes the three values as one Tuple, so a bounded set always comes with no block Result and a programme set with its own block Result. The entry already dropped every asset that a distance reader of the set refuses, so the model is built once, at the final mask. The refused asset takes a zero weight at the step, as an asset that the prior cannot price does. The Investable Mask of the Recursion Result does not change, because it is the active mask of the last row.

Algorithm

  1. Reduce the geometry and q to the mask with investable_geometry_view.
  2. Make a bare model with the set's two scales and the row count of X, zero when there are no rows. Register k = 1, and the vector w of weight variables.
  3. Add the set's constraints with the three-argument form of set_allocation_set_constraints!. This gives the weight bounds wb of the step.
  4. Refuse a floor of wb that the geometry does not admit, with assert_geometry_admits_bounds.
  5. Add the set's custom objective terms with the block builder set_block_objective_terms!, with the geometry as the objective and the set as the owner. The terms read cbr.
  6. Set the objective with set_projection_objective!.
  7. Solve on projection_solver with solve_projection_programme!. When the solve gives an allocation, take its answer on the mask with programme_answer, and return it with a zero at every asset outside the mask. Otherwise record the Held Step with the solver trials, and return a copy of w.

JuMP formulation

Variables

  • w: created, with the base name w, one variable for each asset in the mask. It is registered in the Model State under the key w.

Expressions

  • k: the constant one.

Where:

  • $\boldsymbol{w}$: Portfolio weights vector $N \times 1$.
  • $k$: Variable that scales the budget in the homogenised problem.

Arguments

  • proj: The geometry.
  • e: The entry of the step, (imsk, set, cbr): the Investable Mask of the step, or nothing when every asset is investable; the set after factory(set, w), viewed at the mask; and the Result of the block of a programme set, or nothing for a bounded set.
  • q: The raw step.
  • w: The Price-Adjusted Allocation the step trades from.
  • X: The rows of the step, or nothing.

Validation

Returns

  • w'::Vector: The projected allocation, or w copied on a Held Step.

Related

source