API reference
CoolPDLP.Algorithm — Type
AlgorithmFields
conversion::CoolPDLP.ConversionParameterspreconditioning::CoolPDLP.PreconditioningParameters{T} where T<:Numberstep_size::CoolPDLP.StepSizeParametersrestart::CoolPDLP.RestartParametersgeneric::CoolPDLP.GenericParameterstermination::CoolPDLP.TerminationParameters
CoolPDLP.Algorithm — Method
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.
CoolPDLP.GPUSparseMatrixCOO — Type
GPUSparseMatrixCOOFields
m::Int64n::Int64rowval::DenseVector{Ti} where Ti<:Integercolval::DenseVector{Ti} where Ti<:Integernzval::DenseVector{T} where T<:Number
CoolPDLP.GPUSparseMatrixCSR — Type
GPUSparseMatrixCSRFields
m::Int64n::Int64rowptr::DenseVector{Ti} where Ti<:Integercolval::DenseVector{Ti} where Ti<:Integernzval::DenseVector{T} where T<:Number
CoolPDLP.GPUSparseMatrixELL — Type
GPUSparseMatrixELLEvery 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::Int64n::Int64colval::DenseMatrix{Ti} where Ti<:Integernzval::DenseMatrix{T} where T<:Number
CoolPDLP.KKTErrors — Type
KKTErrorsMutable so that kkt_errors! can refill it without allocating.
Fields
primal::Union{AbstractVector{T}, T} where T<:Number: primal feasibility errorprimal_scale::Union{AbstractVector{T}, T} where T<:Number: characteristic scale of the primal constraint RHSdual::Union{AbstractVector{T}, T} where T<:Number: dual feasibility errordual_scale::Union{AbstractVector{T}, T} where T<:Number: characteristic scale of the dual constraint RHSgap::Union{AbstractVector{T}, T} where T<:Number: primal-dual gapgap_scale::Union{AbstractVector{T}, T} where T<:Number: characteristic scale of the gap
CoolPDLP.MILP — Type
MILPRepresent a Mixed Integer Linear Program in "cuPDLPx form":
min cᵀx s.t. lv ≤ x ≤ uv
lc ≤ A * x ≤ ucA 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 vectorlv::AbstractVecOrMat{T} where T<:Number: variable lower bounduv::AbstractVecOrMat{T} where T<:Number: variable upper boundA::AbstractMatrix{T} where T<:Number: constraint matrixAt::AbstractMatrix{T} where T<:Number: transposed constraint matrixlc::AbstractVecOrMat{T} where T<:Number: constraint lower bounduc::AbstractVecOrMat{T} where T<:Number: constraint upper boundD1::LinearAlgebra.Diagonal{T, V} where {T<:Number, V<:AbstractVector{T}}: left preconditionerD2::LinearAlgebra.Diagonal{T, V} where {T<:Number, V<:AbstractVector{T}}: right preconditionerint_var::DenseVector{Bool}: which variables must be integersvar_names::Vector{String}: variable namesdataset::String: source datasetname::String: instance name (last part of the path)path::String: file path the MILP was read from
CoolPDLP.MILP — Method
MILP(qps::QPSData; kwargs...)Construct a MILP from a QPSData object generated by QPSReader.jl.
CoolPDLP.Optimizer — Type
OptimizerSolver type compatible with JuMP, which calls an algorithm from CoolPDLP under the hood.
Its options are the same as the keyword arguments of Algorithm.
CoolPDLP.PrimalDualSolution — Type
PrimalDualSolutionFields
x::AbstractVecOrMat{T} where T<:Numbery::AbstractVecOrMat{T} where T<:Number
CoolPDLP.PrimalDualSolution — Method
PrimalDualSolution(milp)Build the zero solution of milp, with one column per instance if milp is batched.
CoolPDLP.PDHG — Method
PDHG(args...; kwargs...)Shortcut for Algorithm{:PDHG} with some defaults disabled.
CoolPDLP.PDLP — Method
PDLP(args...; kwargs...)Shortcut for Algorithm{:PDLP}.
CoolPDLP.initialize — Function
initialize(milp, sol, algo)Initialize the appropriate state for solving milp starting from sol with the algorithm defined by algo.
CoolPDLP.instance — Function
instance(x, i)Return the i-th instance of the batch held by x, sharing its memory whenever possible.
CoolPDLP.is_feasible — Method
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 satisfactionint_tol: tolerance for integrality requirementsverbose: whether to display warnings
CoolPDLP.isbatched — Method
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.
CoolPDLP.nbcons — Method
nbcons(milp)Return the number of constraints in milp, not including variable bounds or integrality requirements.
CoolPDLP.nbcons_eq — Method
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.
CoolPDLP.nbcons_ineq — Method
nbcons_ineq(milp)Return the number of inequality constraints in milp, not including variable bounds.
CoolPDLP.nbinstances — Function
nbinstances(x)Return the number of problem instances batched inside x.
CoolPDLP.nbvar — Method
nbvar(milp)Return the number of variables in milp.
CoolPDLP.nbvar_cont — Method
nbvar_cont(milp)Return the number of continuous variables in milp.
CoolPDLP.nbvar_int — Method
nbvar_int(milp)Return the number of integer variables in milp.
CoolPDLP.objective_value — Method
objective_value(x, milp)Compute the value of the linear objective of milp at solution vector x.
CoolPDLP.preprocess — Method
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).
CoolPDLP.relative — Method
relative(err)Compute the largest relative KKT error, column by column.
CoolPDLP.sametype_transpose — Method
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.
CoolPDLP.solve! — Function
solve!(state, milp, algo)Modify state in-place to solve the continuous relaxation of milp using the algorithm defined by algo.
CoolPDLP.solve — Method
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.