JuMP model optimisation: private API

PortfolioOptimisers.SlvKeys — Type
const SlvKeys = Union{AbstractString, JuMP.MOI.AbstractModelAttribute,
                      JuMP.MOI.AbstractOptimizerAttribute}

Groups the three kinds of key that JuMP.set_attribute accepts for an attribute of a model.

The kinds are the name of a raw solver attribute as a string, a MOI.AbstractModelAttribute, and a MOI.AbstractOptimizerAttribute such as MOI.Silent() or MOI.TimeLimitSec(). Solver refuses a key of settings that is not in this group.

Related

source
PortfolioOptimisers.checked_kernel_solver — Function
checked_kernel_solver(slv::Solver, kernel::Symbol) -> Solver
checked_kernel_solver(slv::VecSlv, kernel::Symbol) -> VecSlv
checked_kernel_solver(slv::Nothing, kernel::Symbol) -> Union{}

Check that a kernel that solves a programme to evaluate a risk measure has a solver, and return that solver.

ERM, RRM and PRM, and their twins of the Worst-Case Distribution, solve a conic programme with the slv of the measure. An optimiser gives the measure its own solver through factory, but a direct evaluation does not, so slv can reach the kernel as nothing. Without this check, the call raises a MethodError that names no field.

The kernel refuses nothing also when it can answer with no model, such as PRM when power_norm_is_worst_loss holds. That condition depends on the returns, so without the refusal one measure answers on one series and fails on a different series.

The kernel binds the result to slv, as it binds the result of checked_observation_weights to w. The type of the result has no Nothing arm, so the code after the check sees a solver.

Algorithm

The method that Julia selects is the algorithm.

  1. slv is a Solver: return slv.
  2. slv is a vector of solvers: check that it is not empty, and return slv.
  3. slv is nothing: throw.

Arguments

  • slv: Solver or vector of solvers.
  • kernel: The name of the kernel, for the message.

Validation

  • slv is not nothing. Raises an IsNothingError that names the field slv and shows a Solver.
  • slv is not an empty vector. Raises an IsEmptyError.

Returns

  • slv::Slv_VecSlv: The solver or the vector of solvers, unchanged.

Related

source
PortfolioOptimisers.set_solver_attributes — Function
set_solver_attributes(model::JuMP.Model, ::Nothing)

Set no solver attribute.

optimise_JuMP_model! calls set_solver_attributes(model, nothing) for a Solver whose settings is nothing, and this method takes that call. A settings of any other type, or another arity, is a MethodError.

Arguments

  • model: The JuMP model. It is not changed.
  • ::Nothing: No solver attribute.

Returns

  • nothing.

Examples

julia> PortfolioOptimisers.set_solver_attributes(PortfolioOptimisers.JuMP.Model(), nothing)

Related

source
set_solver_attributes(model::JuMP.Model, settings::Dict_VecPair)

Set each solver attribute of settings on model, in the iteration order of settings.

An attribute that the solver refuses raises the error of JuMP.set_attribute, and the attributes before it stay set.

Arguments

  • model: The JuMP model, with a solver attached.
  • settings: The pairs of a solver attribute and its value.

Returns

  • nothing.

Related

source
set_solver_attributes(model::JuMP.Model, settings::Pair)

Set one solver attribute on model.

An attribute that the solver refuses raises the error of JuMP.set_attribute.

Arguments

  • model: The JuMP model, with a solver attached.
  • settings: The pair of a solver attribute and its value.

Returns

  • nothing.

Related

source