package osdp

  1. Overview
  2. Docs

Interface towards the C library of Mosek for SDP.

Mosek SDP is a semidefinite programming optimization procedure. You may be interested in the slightly higher level interface Sdp.

See Sdp for definitions of SDP with primal and dual.

type matrix = (int * int * float) list

Matrices. Sparse representation as triplet (i, j, x) meaning that the coefficient at line i >= 0 and column j >= 0 has value x. All forgotten coefficients are assumed to be 0.0. Since matrices are symmetric, only the lower triangular part (j <= i) must be given. No duplicates are allowed.

type block_diag_matrix = (int * matrix) list

Block diagonal matrices (sparse representation, forgetting null blocks). For instance, [(1, m1), (3, m2)] will be transformed into [m1; 0; m2]. No duplicates are allowed. There is no requirement for indices to be sorted.

type options = {
  1. verbose : int;
    (*

    verbosity level, non negative integer, 0 (default) means no output

    *)
}

Options for calling MOSEK.

val default : options

Default values above.

val solve : ?options:options -> block_diag_matrix -> (block_diag_matrix * float) list -> SdpRet.t * (float * float) * ((int * float array array) list * float array * (int * float array array) list)

solve obj constraints solves the SDP problem: max{ tr(obj X) | tr(A_1 X) = a_1,..., tr(A_m X) = a_m, X psd } with [(A_1, a_1);...; (A_m, a_m)] the constraints list. It returns both the primal and dual objective values and a witness for X (primal) and y and Z (dual, see Sdp). In case of success (or partial success), the block diagonal matrices returned for X and Z contain exactly the indices, sorted by increasing order, that appear in the objective or one of the constraints. Size of each diagonal block in X or Z is the maximum size appearing for that block in the objective or one of the constraints. In case of success (or partial success), the array returned for y has the same size and same order than the input list of constraints.

val solve_ext : ?options:options -> ((int * float) list * block_diag_matrix) -> ((int * float) list * block_diag_matrix * float * float) list -> (int * float * float) list -> SdpRet.t * (float * float) * ((int * float) list * (int * float array array) list * float array * (int * float array array) list)

solve obj constraints solves the SDP problem: max{ c^T x + tr(obj X) | b_1^- <= a_1^T x + tr(A_1 X) <= a_1^+,..., b_m^- <= a_m x + tr(A_m X) <= b_m^+, d_1^- <= x_1 <= d_1^+,..., d_n^- <= x_n <= d_n^+, X psd } with [(a_1, A_1, b_1^-, b_1^+);...; (a_m, A_m, b_m^-, b_m^+)] the constraints list and [(d_1^-, d_1^+),..., (d_n^-, d_n^+)] the bounds list (missing bounds are considered as (neg_infinity, infinity), bounds about variables x_i not appearing in the objective or constraints may be ignored). It returns both the primal and dual objective values and a witness for (x, X) (primal) and (y, Z) (dual, see Sdp). In case of success (or partial success), the vector (resp. block diagonal matrix) returned for x (resp. X) contains exactly the indices, sorted by increasing order, that appear in the linear (resp. matrix) part of the objective or one of the constraints. Size of each diagonal block in X or Z is the maximum size appearing for that block in the objective or one of the constraints. In case of success (or partial success), the array returned for y has the same size and same order than the input list of constraints.

OCaml

Innovation. Community. Security.