JuMP model optimisation: private API
PortfolioOptimisers.Dict_VecPair — Type
const Dict_VecPair = Union{AbstractDict, AbstractVector{<:Pair}}Groups a dictionary and a vector of pairs, the two collections of solver attributes that set_solver_attributes applies.
Both collections iterate as pairs of a key and a value. The key names a solver attribute, and the value is the value to set.
Related
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
PortfolioOptimisers.SlvSettings — Type
const SlvSettings = Union{Pair, Dict_VecPair}Groups the two forms that the settings of a Solver accepts.
The forms are one pair of a solver attribute and its value, and a Dict_VecPair of such pairs.
Related
PortfolioOptimisers.VecSlv — Type
const VecSlv = AbstractVector{<:Solver}Groups the vectors of Solvers.
optimise_JuMP_model! tries the solvers of such a vector in order, until one of them gives an accepted solution.
Related
PortfolioOptimisers.Slv_VecSlv — Type
const Slv_VecSlv = Union{Solver, VecSlv}Groups one Solver and a vector of them, the two forms in which an estimator takes its solvers.
A single Solver iterates as a vector of one solver. So optimise_JuMP_model! takes both forms through one loop.
Related
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.
slvis aSolver: returnslv.slvis a vector of solvers: check that it is not empty, and returnslv.slvisnothing: throw.
Arguments
slv: Solver or vector of solvers.kernel: The name of the kernel, for the message.
Validation
slvis notnothing. Raises anIsNothingErrorthat names the fieldslvand shows aSolver.slvis not an empty vector. Raises anIsEmptyError.
Returns
slv::Slv_VecSlv: The solver or the vector of solvers, unchanged.
Related
PortfolioOptimisers.AbstractJuMPResult — Type
abstract type AbstractJuMPResult <: AbstractResultAbstract supertype of the records that a solve of a JuMP model returns.
A subtype records what happened when optimise_JuMP_model! tried the solvers on a model. It holds no solution values. After a solve that succeeds, the caller reads them from the model.
Related
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
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
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