Julia API Reference
Solver and main API
Clarabel.Solver
— TypeSolver{T <: AbstractFloat}()
Initializes an empty Clarabel solver that can be filled with problem data using:
setup!(solver, P, q, A, b, cones, [settings]).
Clarabel.setup!
— Functionsetup!(solver, P, q, A, b, cones, [settings])
Populates a Solver
with a cost function defined by P
and q
, and one or more conic constraints defined by A
, b
and a description of a conic constraint composed of cones whose types and dimensions are specified by cones.
The solver will be configured to solve the following optimization problem:
min 1/2 x'Px + q'x
s.t. Ax + s = b, s ∈ K
All data matrices must be sparse. The matrix P
is assumed to be symmetric and positive semidefinite, and only the upper triangular part is used.
The cone K
is a composite cone. To define the cone the user should provide a vector of cone specifications along with the appropriate dimensional information. For example, to generate a cone in the nonnegative orthant followed by a second order cone, use:
cones = [Clarabel.NonnegativeConeT(dim_1),
Clarabel.SecondOrderConeT(dim_2)]
If the argument 'cones' is constructed incrementally, the should should initialize it as an empty array of the supertype for all allowable cones, e.g.
cones = Clarabel.SupportedCone[]
push!(cones,Clarabel.NonnegativeConeT(dim_1))
...
The optional argument settings
can be used to pass custom solver settings:
settings = Clarabel.Settings(verbose = true)
setup!(model, P, q, A, b, cones, settings)
To solve the problem, you must make a subsequent call to solve!
Clarabel.solve!
— Functionsolve!(solver)
Computes the solution to the problem in a Clarabel.Solver
previously defined in setup!
.
Supported Cone Types
Clarabel.SupportedCone
— TypeSupportedCone
An abstract type use by the Clarabel API used when passing cone specifications to the solver setup!
. The currently supported concrete types are:
ZeroConeT
: The zero cone. Used to define equalities.NonnegativeConeT
: The nonnegative orthant.SecondOrderConeT
: The second order / Lorentz / ice-cream cone.PSDTriangleConeT
: The positive semidefinite cone (triangular format).ExponentialConeT
: The exponential cone (in R^3)PowerConeT
: The power cone with power α (in R^3)
Solver Status
Clarabel.SolverStatus
— TypeSolverStatus
An Enum of of possible conditions set by solve!
.
If no call has been made to solve!
, then the SolverStatus
is:
UNSOLVED
: The algorithm has not started.
Otherwise:
SOLVED
: Solver terminated with a solution.PRIMAL_INFEASIBLE
: Problem is primal infeasible. Solution returned is a certificate of primal infeasibility.DUAL_INFEASIBLE
: Problem is dual infeasible. Solution returned is a certificate of dual infeasibility.ALMOST_SOLVED
: Solver terminated with a solution (reduced accuracy).ALMOST_PRIMAL_INFEASIBLE
: Problem is primal infeasible. Solution returned is a certificate of primal infeasibility (reduced accuracy).ALMOST_DUAL_INFEASIBLE
: Problem is dual infeasible. Solution returned is a certificate of dual infeasibility (reduced accuracy).MAX_ITERATIONS
: Iteration limit reached before solution or infeasibility certificate found.MAX_TIME
: Time limit reached before solution or infeasibility certificate found.NUMERICAL_ERROR
: Solver terminated with a numerical error.INSUFFICIENT_PROGRESS
: Solver terminated due to lack of progress.