package osdp

  1. Overview
  2. Docs

Interface towards the C library CSDP.

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

See Sdp for definition 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

    *)
  2. max_iteration : int;
    (*

    maxIteration (default: 100)

    *)
}

Options for calling CSDP.

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 ?verbose obj constraints solves the SDP problem: max{ tr(obj X) | tr(A_1 X) = a_1,..., tr(A_n X) = a_n, X psd } with [(A_1, a_1);...; (A_n, a_n)] 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 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.