Internals
These symbols are not part of the public API, their behavior may change without warning between releases.
CoolPDLP.BatchedNumber — Type
BatchedNumber{T}Equivalent to Union{T, AbstractVector{T}} for a number type T. Represents a quantity which is scalar without batching, and holds one value per instance otherwise.
Combine such quantities with BangBang.broadcast!!(f, dest, args...), which writes into dest when batched and returns a fresh number otherwise, so the result must always be used.
CoolPDLP.ConstraintMatrix — Type
ConstraintMatrixFields
A::SparseArrays.AbstractSparseMatrix{T, Ti} where {T<:Number, Ti<:Integer}At::SparseArrays.AbstractSparseMatrix{T, Ti} where {T<:Number, Ti<:Integer}
CoolPDLP.ConvergenceStats — Type
ConvergenceStatsFields
err::CoolPDLP.KKTErrors: current KKT errorstarting_time::Float64: time at which the algorithm started, in secondstime_elapsed::Float64: time elapsed since the algorithm started, in secondskkt_passes::Int64: number of multiplications by both the KKT matrix and its transposetermination_status::CoolPDLP.TerminationStatus: termination stats (should beSTILL_RUNNINGuntil the algorithm actually terminates)error_history::Array{Tuple{Int64, CoolPDLP.KKTErrors{T}}, 1} where T<:(Union{AbstractVector{T}, T} where T<:Number)
CoolPDLP.ConversionParameters — Type
ConversionParameters{T,Ti,M}Type parameters
T: floating point type to convert values toTi: integer type to convert indices toM: matrix constructor to use on the constraints
Fields
backend::KernelAbstractions.Backend: CPU or GPU backend used for computations
CoolPDLP.GenericParameters — Type
GenericParametersFields
show_progress::Bool: whether to show a progress barcheck_every::Int64: frequency of restart or termination checksrecord_error_history::Bool: whether or not to record error evolution
CoolPDLP.PDHGState — Type
PDHGStateFields
sol::PrimalDualSolution: current solutionsol_last::PrimalDualSolution: last solutionstep_sizes::CoolPDLP.StepSizes{S} where {T<:Number, S<:Union{AbstractVector{T}, T}}: step sizesscratch::CoolPDLP.Scratch: scratch spacestats::CoolPDLP.ConvergenceStats{S} where {T<:Number, S<:Union{AbstractVector{T}, T}}: convergence stats
CoolPDLP.PDLPState — Type
PDLPStateFields
sol::PrimalDualSolution: current solutionsol_last::PrimalDualSolution: last solutionsol_avg::PrimalDualSolution: current average solutionsol_avg_last::PrimalDualSolution: last average solutionsol_restart::PrimalDualSolution: solution from last restartstep_sizes::CoolPDLP.StepSizes{S} where {T<:Number, S<:Union{AbstractVector{T}, T}}: step sizesscratch::CoolPDLP.Scratch: scratch spaceiteration::CoolPDLP.IterationCounter: iteration counterrestart_stats::CoolPDLP.RestartStats{S} where {T<:Number, S<:Union{AbstractVector{T}, T}}: restart statsstats::CoolPDLP.ConvergenceStats{S} where {T<:Number, S<:Union{AbstractVector{T}, T}}: convergence stats
CoolPDLP.Preconditioner — Type
PreconditionerFields
D1::LinearAlgebra.Diagonal{T, V} where {T<:Number, V<:DenseVector{T}}: left preconditionerD2::LinearAlgebra.Diagonal{T, V} where {T<:Number, V<:DenseVector{T}}: right preconditioner
CoolPDLP.PreconditioningParameters — Type
PreconditioningParametersFields
chambolle_pock_alpha::Any: norm parameter in the Chambolle-pock preconditionerruiz_iter::Int64: iteration parameter in the Ruiz preconditioner
CoolPDLP.RestartParameters — Type
RestartParametersFields
sufficient_decay::Number: restart criterion: sufficient decay in normalized duality gapnecessary_decay::Number: restart criterion: necessary decayartificial_decay::Number: restart criterion: long inner loopbatch_aggregation::Any: how the per-instance absolute errors are reduced to the single restart decision shared by the batch
CoolPDLP.RestartStats — Type
RestartStatsFields
restart_from_avg::Union{Bool, AbstractVector{Bool}}: whether to restart from the average solution, column by columnerr_current::CoolPDLP.KKTErrors: KKT errors of the current solutionerr_avg::CoolPDLP.KKTErrors: KKT errors of the current average solutionerr_last::CoolPDLP.KKTErrors: KKT errors of the last solutionerr_avg_last::CoolPDLP.KKTErrors: KKT errors of the last average solutionerr_restart::CoolPDLP.KKTErrors: KKT errors of the solution at the last restartabs_candidate::Union{AbstractVector{T}, T} where T<:Number: absolute error of the restart candidateabs_candidate_last::Union{AbstractVector{T}, T} where T<:Number: absolute error of the previous restart candidateabs_restart::Union{AbstractVector{T}, T} where T<:Number: absolute error at the last restart
CoolPDLP.StepSizeParameters — Type
StepSizeParametersFields
invnorm_scaling::Number: scaling of the inverse spectral norm ofAwhen defining the non-adaptive step sizeprimal_weight_damping::Number: primal weight update dampingzero_tol::Number: tolerance in absolute comparisons to zero
CoolPDLP.StepSizes — Type
StepSizesFields
η::Union{AbstractVector{T}, T} where T<:Number: step sizeη_sum::Union{AbstractVector{T}, T} where T<:Number: cumulated step size since last restartω::Union{AbstractVector{T}, T} where T<:Number: primal weight
CoolPDLP.Symmetrized — Type
SymmetrizedRepresent a symmetric matrix Kᵀ * K lazily.
CoolPDLP.TerminationParameters — Type
TerminationParametersFields
termination_reltol::Number: tolerance on KKT relative errors to decide terminationmax_kkt_passes::Int64: maximum number of multiplications by both the KKT matrixKand its transposeKᵀtime_limit::Float64: time limit in seconds
CoolPDLP.TerminationStatus — Type
TerminationStatusEnum for the various ways that an algorithm can terminate.
Possible values:
OPTIMALTIME_LIMITITERATION_LIMITSTILL_RUNNING
CoolPDLP.absolute!! — Method
absolute!!(dest, err, ω)Compute the absolute KKT error for primal weight ω, column by column, into dest.
CoolPDLP.batch_sizes — Method
batch_sizes(c, lv, uv, lc, uc)Return the number of instances carried by each field of a MILP which can be batched, 1 meaning shared by the whole batch.
CoolPDLP.batched_all — Method
batched_all(f, args...)Reduce the per-instance conditions f(args...) to a single decision for the whole batch.
CoolPDLP.batched_expand — Method
batched_expand(x, val)Return val itself if the array x is not batched, or one copy of val per instance otherwise.
CoolPDLP.batched_mean — Method
batched_mean(val)Average a per-instance quantity over all the instances, yielding a single number.
CoolPDLP.batched_select! — Method
batched_select!(sol, cond, sol_other)Overwrite the columns of sol for which cond holds with those of sol_other.
CoolPDLP.batched_similar — Method
batched_similar(val)Return an uninitialized per-instance quantity with the same shape as val.
CoolPDLP.batched_zeros — Method
batched_zeros(x, n, nbinstances, Val(batched))Allocate a zeroed vector of length n with the same array type as x, or a matrix holding one such column per instance when batched is true.
Batching is passed as a Val because the number of instances is only known at run time, while the shape of the result must be inferrable.
CoolPDLP.best_error!! — Method
best_error!!(abs_err, err1, err2, scratch, sol1, sol2, milp, ω)Fill err1 and err2 with the KKT errors of sol1 and sol2, then keep the smaller of their absolute errors, column by column, in abs_err.
Return abs_err together with both absolute errors, which live in the scratch space and stay valid only until the next call.
CoolPDLP.check_mul_dims — Method
check_mul_dims(c, A, b)Throw a DimensionMismatch unless c, A and b have compatible sizes for mul!(c, A, b, α, β), i.e. size(c, 1) == size(A, 1) and size(b, 1) == size(A, 2). A need not be an AbstractMatrix, only support size, which covers matrix-free operators like Symmetrized.
CoolPDLP.coldot — Method
coldot(a, b)Return the scalar product of a and b, or one scalar product per column if either is batched.
CoolPDLP.colnorm!! — Method
colnorm!!(dest, x)Compute the Euclidean norm of x, or one norm per column if x is batched, into dest.
Unlike colnorm, the batched (AbstractMatrix) method computes sqrt(sum(abs2, ...)) directly instead of LinearAlgebra.norm's scaled, overflow-safe algorithm: it needs to stay a single allocation-free, GPU-broadcastable reduction, since it runs every iteration on the hot path (see primal_weight_update!! and kkt_errors!). This means colnorm!! can over/underflow on badly scaled columns where colnorm would not; that tradeoff is intentional here, since the values it norms are primal-dual residuals that are not expected to approach the extremes of the floating-point range in practice.
CoolPDLP.colnorm — Method
colnorm(x)Return the Euclidean norm of x, or one norm per column if x is batched.
CoolPDLP.colsum!! — Method
colsum!!(dest, x)Compute the sum of x, or one sum per column if x is batched, into dest.
CoolPDLP.combine — Method
combine(l, u)Return the largest finite absolute value between the two bounds, or zero if neither is finite.
CoolPDLP.common_backend — Method
common_backend(args...)Return the common GPU backend of several arguments, if it exists, and throw an error otherwise.
CoolPDLP.instance_num — Method
instance_num(val, i)Extract the value of val for the i-th instance of the batch.
CoolPDLP.kkt_errors! — Method
kkt_errors!(err, scratch, sol, milp)Fill err with the KKT errors of sol, one value per column of the batch.
CoolPDLP.primal_weight_update!! — Method
primal_weight_update!!(scratch, step_sizes, sol_cand, sol_restart, params)Compute the new primal weight, column by column, into step_sizes.ω.
CoolPDLP.progress_value — Method
progress_value(rel)Format a relative error for the progress display: the value itself for a single instance, the maximum and mean over the instances for a batch.
The two summaries are printed in fixed width so that they line up across the progress rows.
CoolPDLP.proj_multiplier — Method
proj_multiplier(λ, l, u)Project λ onto the feasible space of the (double) Lagrange multiplier λ⁺ - λ⁻ associated with the constraint l ≤ x ≤ u, where l and/or u might be infinite.
CoolPDLP.relative!! — Method
relative!!(dest, err)Compute the largest relative KKT error, column by column, into dest.
CoolPDLP.safeprod_left — Method
safeprod_left(left, right)Compute left * right, except that right is forced to zero whenever left is infinite.
This is used to evaluate terms like l * y⁺ in the dual objective, where l is a (possibly infinite) constraint/variable bound and y⁺ its associated Lagrange multiplier. The PDHG update and proj_multiplier guarantee that the multiplier paired with an infinite bound is mathematically zero, but not necessarily exactly zero in floating point (e.g. a free row's multiplier is computed as a σ/inv(σ) round-trip that can leave a tiny nonzero residual). Checking iszero(right) instead of always zeroing out would let such residuals turn into ±Inf (and, once several rows are summed, Inf - Inf = NaN) even though nothing is actually wrong with the solution.
CoolPDLP.select_errors!! — Method
select_errors!!(dest, cond, err_true, err_false)Fill dest, column by column, with the errors of err_true where cond holds and those of err_false elsewhere.
CoolPDLP.set_eltype — Method
set_eltype(T, milp)Change the element type of floating-point containers inside milp to T.
CoolPDLP.set_indtype — Method
set_indtype(Ti, milp)Change the element type of integer containers inside milp to Ti.
CoolPDLP.set_matrix_type — Method
set_matrix_type(::Type{M}, milp)Convert the sparse matrices inside milp using constructor M.
CoolPDLP.should_restart — Method
should_restart(stats, iteration, params)Decide whether the whole batch restarts, based on an aggregate of the per-column fixed-point residuals.
Since every instance of the batch restarts at the same time, the three usual criteria (sufficient decay, necessary decay without local progress, long inner loop) are applied to params.batch_aggregation (the mean by default) of the per-column absolute KKT errors instead of requiring each column to agree.
CoolPDLP.sort_rows_columns — Method
sort_rows_columns(milp)Return a new MILP where the constraint matrix has been permuted by order of increasing column and row density.
CoolPDLP.spectral_norm — Method
spectral_norm(K, Kᵀ)Compute the spectral norm of K with the power method from IterativeSolvers.jl.
CoolPDLP.termination_status!! — Method
termination_status!!(dest, stats, params)Decide how the algorithm terminates, using dest as scratch space for the relative errors.