API Reference
Solver
The main entry point for solving conic optimization problems.
ConicIP.conicIP — Function
conicIP(Q, c, A, b, conedims, G, d; solve3x3gen = solve3x3gensparse, optTol = 1e-5, DTB = 0.01, verbose = true, maxRefinementSteps = 3, maxIters = 100, cache_nestodd = false, refinementThreshold = optTol/1e7)
Interior point solver for the system
minimize ½yᵀQy - cᵀy
s.t Ay >= b
Gy = dc, b, d are vectors (or any AbstractVector)
cone_dims is an array of tuples (Cone Type, Dimension)
e.g. [("R",2),("Q",4)] means
(y₁, y₂) in R+
(y₃, y₄, y₅, y₆) in QSDP Cones are NOT supported and purely experimental at this point.
The parameter solve3x3gen allows the passing of a custom solver for the KKT System, as follows
julia> L = solve3x3gen(F,F⁻ᵀ,Q,A,G)
Then this
julia> (a,b,c) = L(y,w,v)
solves the system
┌ ┐ ┌ ┐ ┌ ┐
│ Q G' -A' │ │ a │ = │ y │
│ G │ │ b │ │ w │
│ A FᵀF │ │ c │ │ v │
└ ┘ └ ┘ └ ┘We can also wrap a 2x2 solver using pivot3gen(solve2x2gen) The 2x2 solves the system
julia> L = solve2x2gen(F,F⁻ᵀ,Q,A,G)
Then this
julia> (a,b) = L(y,w)
solves the system
┌ ┐ ┌ ┐ ┌ ┐
│ Q + Aᵀinv(FᵀF)A G' │ │ a │ = │ y │
│ G │ │ b │ │ w │
└ ┘ └ ┘ └ ┘ConicIP.preprocess_conicIP — Function
ConicIP with preprocessing to ensure the following rank constraints
Primal equailty constraints : Gx = d Rank condition : rank(G) = size(G,1)
Dual equality constraints : [ Q A' G'] = c Rank condition : rank([Q A' G']) = size(Q,1)
Solution
The solver returns a Solution struct containing primal/dual variables, status, and convergence information.
ConicIP.Solution — Type
SolutionReturn type of conicIP and preprocess_conicIP.
Fields
y::Vector{Float64}– primal variablesw::Vector{Float64}– dual variables for equality constraints (Gy = d)v::Vector{Float64}– dual variables for inequality constraints (Ay ≥_K b)status::Symbol–:Optimal,:Infeasible,:Unbounded,:Abandoned, or:ErrorIter::Integer– number of interior-point iterationsMu::Real– final complementarity gap parameterprFeas::Real– primal feasibility residualduFeas::Real– dual feasibility residualmuFeas::Real– complementarity residualpobj::Real– primal objective valuedobj::Real– dual objective value
Key fields:
| Field | Type | Description |
|---|---|---|
y | Matrix | Primal variables |
w | Matrix | Dual variables for equality constraints (Gy = d) |
v | Matrix | Dual variables for inequality constraints (Ay ≥ b) |
status | Symbol | Termination status (see below) |
pobj | Real | Primal objective value |
dobj | Real | Dual objective value |
prFeas | Real | Primal feasibility residual |
duFeas | Real | Dual feasibility residual |
muFeas | Real | Complementarity residual |
Iter | Integer | Number of iterations |
Mu | Real | Final barrier parameter |
Status values:
| Status | Meaning |
|---|---|
:Optimal | Converged to an optimal solution |
:Infeasible | Problem is primal infeasible (dual certificate found) |
:Unbounded | Problem is dual infeasible / primal unbounded |
:Abandoned | Solver stalled (step size too small or numerical issues) |
:Error | Solver encountered an error |
See Troubleshooting Solver Output in the Mathematical Background for guidance on non-optimal statuses.
JuMP / MathOptInterface
ConicIP.Optimizer — Type
Optimizer(; verbose=false, optTol=1e-6, maxIters=100)MathOptInterface optimizer wrapping the ConicIP interior-point solver. Use as a JuMP solver via Model(ConicIP.Optimizer).
Keyword Arguments
verbose::Bool– print solver iterations (default:false)optTol::Float64– optimality tolerance (default:1e-6)maxIters::Int– maximum iterations (default:100)
Supported Constraints
- Vector:
Zeros,Nonnegatives,Nonpositives,SecondOrderCone,PositiveSemidefiniteConeTriangle - Scalar:
EqualTo,GreaterThan,LessThan
KKT Solver Functions
Three built-in KKT solvers are provided. See the KKT Solvers guide for detailed usage and custom solver development.
ConicIP.kktsolver_qr — Function
Solves the 3x3 system
┌ ┐ ┌ ┐ ┌ ┐
│ Q G' -A' │ │ y' │ = │ y │
│ G │ │ w' │ │ w │
│ A FᵀF │ │ v' │ │ v │
└ ┘ └ ┘ └ ┘by the double QR method described in CVXOPT http://www.seas.ucla.edu/~vandenbe/publications/coneprog.pdf section 10.2
ConicIP.kktsolver_sparse — Function
Solves the 3x3 system
┌ ┐ ┌ ┐ ┌ ┐
│ Q G' -A' │ │ y' │ = │ y │
│ G │ │ w' │ │ w │
│ A FᵀF │ │ v' │ │ v │
└ ┘ └ ┘ └ ┘By lifting the large diagonal plus rank 3 blocks of FᵀF
Intelligently chooses between solve3x3gensparselift and solve3x3gensparsedense by approximating the number of non-zeros in both and choosing the form with more sparsity. The former is better for large second order cones, while the latter is better if the constraints are the product of many small cones.
ConicIP.kktsolver_2x2 — Function
Solves the 2x2 system
┌ ┐ ┌ ┐ ┌ ┐
│ Q + A'F⁻¹F⁻ᵀA G' │ │ y' │ = │ y │
│ G │ │ w' │ │ w │
└ ┘ └ ┘ └ ┘ConicIP.pivot — Function
pivot(kktsolver_2x2)Wrap a 2-by-2 KKT solver into a 3-by-3 solver by pivoting on the third component. The inner solver handles the Schur complement system; pivot reconstructs the full solution.
See also conicIP for the KKT solver interface specification.
Block Diagonal Matrices
The Nesterov-Todd scaling matrix is represented as a block diagonal matrix where each block corresponds to a cone in the cone specification.
ConicIP.Block — Type
Block(size::Int)
Block(Blk::Vector)Block diagonal matrix type. Each diagonal block can be a different matrix type (Diagonal, SymWoodbury, VecCongurance, or dense Matrix).
Used internally to represent the Nesterov-Todd scaling matrix, where each block corresponds to a cone in the cone specification.
Supports arithmetic (*, +, -, inv, adjoint, ^), conversion to sparse and Matrix, and block-wise function application via broadcastf.
Indexing
B[i]returns thei-th diagonal blockB[i] = Msets thei-th diagonal block
ConicIP.block_idx — Function
block_idx(A::Block)Return a vector of UnitRange{Int} giving the row/column index ranges for each diagonal block of A.
ConicIP.broadcastf — Function
broadcastf(op, A::Block)
broadcastf(op, A::Block, B::Block)
broadcastf(op, A::Block, x::Union{Vector,Matrix})Apply function op block-wise to the diagonal blocks of A (and optionally B or the corresponding segments of x).
Utilities
ConicIP.Id — Function
Id(n)Create an n-by-n identity matrix as Diagonal(ones(n)).
ConicIP.VecCongurance — Type
VecCongurance(R)Linear operator representing a congruence transform in vectorized form. The action W * x computes vecm(R' * mat(x) * R).
Used internally as the Nesterov-Todd scaling matrix for semidefinite cones.
ConicIP.mat — Function
mat(x)Convert a vectorized symmetric matrix (scaled lower-triangular form) back to a full symmetric matrix. Inverse of vecm.
ConicIP.vecm — Function
vecm(Z)Vectorize a symmetric matrix Z into scaled lower-triangular form. Off-diagonal entries are scaled by √2 so that dot(vecm(X), vecm(Y)) == tr(X*Y). Inverse of mat.
ConicIP.imcols — Function
imcols(A, b; ϵ = 1e-10)
Removes redundant inequalities in a system of equations
Ax = b
and checks if the equations are consistent.
Internal
These functions are implementation details and not part of the public API.
ConicIP.inv_adjoint! — Function
inv_adjoint!(dest::Block, src::Block)Compute adjoint(inv(src)) block-wise, reusing the dest Block shell. Avoids allocating two intermediate Blocks for inv(F)'.
ConicIP.pivotgen — Function
Wrapper around solve2xegen to solve 3x3 systems by pivoting on the third component.
ConicIP.placeholder — Function
Creates a matrix with the same sparsity structure as F
ConicIP.identical_sparse_structure — Function
Checks if two sparse matrices have the same sparse structure
ConicIP.count_lift — Function
Estimates for the number of nonzeros of lift(F)
ConicIP.count_dense — Function
Estimates the number of nonzeros of F