API reference

CoolPDLP.AlgorithmType
Algorithm

Fields

  • conversion::CoolPDLP.ConversionParameters

  • preconditioning::CoolPDLP.PreconditioningParameters{T} where T<:Number

  • step_size::CoolPDLP.StepSizeParameters

  • restart::CoolPDLP.RestartParameters

  • generic::CoolPDLP.GenericParameters

  • termination::CoolPDLP.TerminationParameters

source
CoolPDLP.AlgorithmMethod
Algorithm{:ALGNAME}(
    # conversion
    _T::Type{T} = Float64,
    ::Type{Ti} = Int,
    ::Type{M} = SparseMatrixCSC;
    backend::B = CPU(),
    # preconditioning
    chambolle_pock_alpha = 1.0,
    ruiz_iter = 10,
    # step sizes
    invnorm_scaling = 0.9,
    primal_weight_damping = 0.5,
    zero_tol = 1.0e-8,
    # restart
    sufficient_decay = 0.2,
    necessary_decay = 0.8,
    artificial_decay = 0.36,
    restart_batch_aggregation = batched_mean,
    # generic
    show_progress = false,
    check_every = 100,
    record_error_history = true,
    # termination
    termination_reltol = 1.0e-4,
    max_kkt_passes = 10^5,
    time_limit = 100.0,
)

Constructor for algorithm configs.

source
CoolPDLP.GPUSparseMatrixCOOType
GPUSparseMatrixCOO

Fields

  • m::Int64

  • n::Int64

  • rowval::DenseVector{Ti} where Ti<:Integer

  • colval::DenseVector{Ti} where Ti<:Integer

  • nzval::DenseVector{T} where T<:Number

source
CoolPDLP.GPUSparseMatrixCSRType
GPUSparseMatrixCSR

Fields

  • m::Int64

  • n::Int64

  • rowptr::DenseVector{Ti} where Ti<:Integer

  • colval::DenseVector{Ti} where Ti<:Integer

  • nzval::DenseVector{T} where T<:Number

source
CoolPDLP.GPUSparseMatrixELLType
GPUSparseMatrixELL

Every row is padded to the length of the longest row, so a single unusually dense row makes this format allocate m × d dense storage, where d is the maximum number of nonzeros in a row. Prefer GPUSparseMatrixCSR or GPUSparseMatrixCOO when row lengths vary widely.

Fields

  • m::Int64

  • n::Int64

  • colval::DenseMatrix{Ti} where Ti<:Integer

  • nzval::DenseMatrix{T} where T<:Number

source
CoolPDLP.KKTErrorsType
KKTErrors

Mutable so that kkt_errors! can refill it without allocating.

Fields

  • primal::Union{AbstractVector{T}, T} where T<:Number: primal feasibility error

  • primal_scale::Union{AbstractVector{T}, T} where T<:Number: characteristic scale of the primal constraint RHS

  • dual::Union{AbstractVector{T}, T} where T<:Number: dual feasibility error

  • dual_scale::Union{AbstractVector{T}, T} where T<:Number: characteristic scale of the dual constraint RHS

  • gap::Union{AbstractVector{T}, T} where T<:Number: primal-dual gap

  • gap_scale::Union{AbstractVector{T}, T} where T<:Number: characteristic scale of the gap

source
CoolPDLP.MILPType
MILP

Represent a Mixed Integer Linear Program in "cuPDLPx form":

min cᵀx   s.t.   lv ≤ x ≤ uv
                 lc ≤ A * x ≤ uc

A MILP can also hold a whole batch of such programs sharing the constraint matrix A: any of c, lv, uv, lc and uc may then be a matrix with one column per instance, while the others stay vectors shared by the whole batch. All batched fields must agree on the number of instances; see isbatched and nbinstances.

Constructor

MILP(;
    c, lv, uv, A, lc, uc,
    At=sametype_transpose(A),
    [D1, D2, int_var, var_names, dataset, name, path]
)

Fields

  • c::AbstractVecOrMat{T} where T<:Number: objective vector

  • lv::AbstractVecOrMat{T} where T<:Number: variable lower bound

  • uv::AbstractVecOrMat{T} where T<:Number: variable upper bound

  • A::AbstractMatrix{T} where T<:Number: constraint matrix

  • At::AbstractMatrix{T} where T<:Number: transposed constraint matrix

  • lc::AbstractVecOrMat{T} where T<:Number: constraint lower bound

  • uc::AbstractVecOrMat{T} where T<:Number: constraint upper bound

  • D1::LinearAlgebra.Diagonal{T, V} where {T<:Number, V<:AbstractVector{T}}: left preconditioner

  • D2::LinearAlgebra.Diagonal{T, V} where {T<:Number, V<:AbstractVector{T}}: right preconditioner

  • int_var::DenseVector{Bool}: which variables must be integers

  • var_names::Vector{String}: variable names

  • dataset::String: source dataset

  • name::String: instance name (last part of the path)

  • path::String: file path the MILP was read from

source
CoolPDLP.OptimizerType
Optimizer

Solver type compatible with JuMP, which calls an algorithm from CoolPDLP under the hood.

Its options are the same as the keyword arguments of Algorithm.

source
CoolPDLP.initializeFunction
initialize(milp, sol, algo)

Initialize the appropriate state for solving milp starting from sol with the algorithm defined by algo.

source
CoolPDLP.instanceFunction
instance(x, i)

Return the i-th instance of the batch held by x, sharing its memory whenever possible.

source
CoolPDLP.is_feasibleMethod
is_feasible(x, milp[; cons_tol=1e-6, int_tol=1e-5, verbose=true])

Check whether solution vector x is feasible for milp, returning one verdict per column if x holds a batch of solutions.

Keyword arguments

  • cons_tol: tolerance for constraint satisfaction
  • int_tol: tolerance for integrality requirements
  • verbose: whether to display warnings
source
CoolPDLP.isbatchedMethod
isbatched(milp)

Return whether milp holds a batch of instances rather than a single one.

Unlike nbinstances, this only depends on the type of milp, so it is a constant as far as inference is concerned and the shape of the arrays attached to milp follows from it.

source
CoolPDLP.nbconsMethod
nbcons(milp)

Return the number of constraints in milp, not including variable bounds or integrality requirements.

source
CoolPDLP.nbcons_eqMethod
nbcons_eq(milp)

Return the number of equality constraints in milp.

Throw an ArgumentError if the constraint bounds of milp are batched, since the number may then differ from one instance to the next.

source
CoolPDLP.nbcons_ineqMethod
nbcons_ineq(milp)

Return the number of inequality constraints in milp, not including variable bounds.

source
CoolPDLP.preprocessMethod
preprocess(milp_init, sol_init, algo)

Apply preconditioning, type conversion and device transfer to milp_init and sol_init for the algorithm defined by algo.

Return a tuple (milp, sol).

source
CoolPDLP.sametype_transposeMethod
sametype_transpose(A::AbstractMatrix)

Return a matrix of the same type of A containing transpose(A) (as opposed to a Transpose{...} wrapper).

The default implementation is just convert(typeof(A), transpose(A)) but it may need to be overloaded for certain matrix types.

source
CoolPDLP.solve!Function
solve!(state, milp, algo)

Modify state in-place to solve the continuous relaxation of milp using the algorithm defined by algo.

source
CoolPDLP.solveMethod
solve(milp, sol, algo)
solve(milp, algo)

Solve the continuous relaxation of milp starting from solution sol using the algorithm defined by algo.

Return a couple (sol, stats) where sol is the last solution and stats contains convergence information.

source