JuMP Model Optimisation

PortfolioOptimisers.SolverType
struct Solver{T1, T2, T3, T4, T5} <: AbstractEstimator
    name::T1
    solver::T2
    settings::T3
    check_sol::T4
    add_bridges::T5
end

Container for configuring a JuMP solver and its settings.

The Solver struct encapsulates all information needed to set up and run a JuMP optimisation, including the solver backend, solver-specific settings, solution checks, and bridge options.

Fields

Constructor

Solver(; name::Union{Symbol, <:AbstractString} = "", solver = nothing,
       settings::Union{Nothing, <:AbstractDict, <:Pair, <:AbstractVector{<:Pair}} = nothing,
       check_sol::NamedTuple = (;), add_bridges::Bool = true)

Keyword arguments correspond to the fields above.

Validation

  • If settings is a dictionary or vector, !isempty(settings).

Examples

julia> Solver()
Solver
         name | String: ""
       solver | nothing
     settings | nothing
    check_sol | @NamedTuple{}: NamedTuple()
  add_bridges | Bool: true

Related

source
PortfolioOptimisers.JuMPResultType
struct JuMPResult{T1, T2} <: AbstractJuMPResult
    trials::T1
    success::T2
end

Result type for JuMP model optimisation.

The JuMPResult struct records the outcome of a JuMP optimisation, including trial errors and success status.

Fields

  • trials: Dictionary of solver attempts and errors.
  • success: Boolean indicating whether optimisation succeeded.

Constructor

JuMPResult(; trials::AbstractDict, success::Bool)

Keyword arguments correspond to the fields above.

Examples

julia> JuMPResult(; trials = Dict(:HiGHS => Dict(:optimize! => "error")), success = true)
JuMPResult
   trials | Dict{Symbol, Dict{Symbol, String}}: Dict(:HiGHS => Dict(:optimize! => "error"))
  success | Bool: true

Related

source
PortfolioOptimisers.AbstractJuMPResultType
abstract type AbstractJuMPResult <: AbstractResult end

Abstract supertype for all JuMP-based optimisation result types in PortfolioOptimisers.jl.

All concrete types representing the result of a JuMP model optimisation should subtype AbstractJuMPResult. This enables a consistent interface for handling solver results throughout the package.

Related

source
PortfolioOptimisers.set_solver_attributesFunction
set_solver_attributes(args...)

Set solver attributes for a JuMP model.

This is a generic fallback that does nothing if no model or settings are provided.

Arguments

  • args...: Arguments (ignored).

Returns

  • nothing
source
set_solver_attributes(model::JuMP.Model,
                      settings::Union{<:AbstractDict, <:AbstractVector{<:Pair}})

Set multiple solver attributes on a JuMP model.

Iterates over the provided settings and applies each as a solver attribute.

Arguments

  • model: JuMP model.
  • settings: Dictionary or vector of pairs of solver settings.

Returns

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

Set a single solver attribute on a JuMP model.

Arguments

  • model: JuMP model.
  • settings: Pair of attribute name and value.

Returns

  • nothing
source
PortfolioOptimisers.optimise_JuMP_model!Function
optimise_JuMP_model!(model::JuMP.Model, slv::Union{<:Solver, <:AbstractVector{<:Solver}})

Attempt to optimise a JuMP model using one or more configured solvers.

Tries each solver in order, applying settings and checking for solution feasibility. Returns a JuMPResult with trial errors and success status.

Arguments

  • model: JuMP model to optimise.
  • slv: Single Solver or vector of Solver objects.

Returns

  • JuMPResult: Result object containing trial errors and success flag.

Details

  • For each solver, sets the optimizer and attributes, runs JuMP.optimize!, and checks solution feasibility.
  • If a solver fails, records the error and tries the next.
  • Stops at the first successful solution.
source