Cones

SDP

ConicSolve.SDPType
SDP

Represents a Semidefinite Program (SDP).
i.e. An optimization of the form

\[\begin{aligned} \text{minimize}\qquad & c^Tx \\ \text{subject to}\qquad & Ax = b \\ & x \succeq 0 \end{aligned}\]


NOTE: Linear Matrix Inequalities not supported yet.

ConicSolve.get_X1Method
get_X1(sdp, x)

Returns the values of X1 in the SDP matrix

\[X = \begin{bmatrix} X_2 & X_1^T \\ X_1 & X_4 \end{bmatrix}\]

ConicSolve.get_traceMethod
get_trace(sdp)

Used to express the trace of the decision variable $X$ in the objective function.

Output

The vector c to pass as argument to ConeQP.

ConicSolve.set_objectiveMethod
set_objective(sdp, c)

Set the objective function of the SDP, which is the function $\langle c, x \rangle$

ConicSolve.set_off_diag_constraintMethod
set_off_diag_constraint(sdp, data, mask)

Set the off diagonal entries in the SDP matrix. i.e. [Y data; data' Z] The mask is a boolean matrix that corresponds to which elements of the data matrix to keep.

Output

The precomputed matrices A, G and the vector b to pass as arguments to ConeQP.

ConicSolve.set_valuesMethod
set_values(sdp, mask)

Set linear equalities of the SDP constraints where values of the SDP matrix $X$ are determined by $X_1$ and the mask.

if mask[i, j]
    X_1[i, j] = X_1[i, j]
end

SOS

ConicSolve.SOSType
SOS

Represents a Sum of Squares Optimization (SOS) Program.
The univariate polynomial $p(x) = a_nx^n + a_{n-1}x^{n-1} + ... + a_{1}x^1 + a_0$ is represented in quadratic form as: $p(x) = v^TQv$ where:

\[v = \begin{bmatrix} x^n \\ x^{n-1} \\ ... \\ x^{1} \\ 1 \end{bmatrix}\]

Multivariate polynomials and other monomial basis are not supported at this stage.

ConicSolve.set_objectiveMethod
set_objective(sos, c)

Set the objective function of the SOS, which is the function $\langle c, x \rangle$

ConicSolve.sos_to_qpMethod
sos_to_qp(sos)

Get the Cone QP object representing the SOS optimization problem

Solver

ConicSolve.qr_chol_solveFunction
qr_chol_solve(device, kktsystem, b_x, b_y, b_z, check)

Calculates the vectors $x$ and $y$ (if linear equality constraints present) by solving the KKT system of linear equations where the KKT matrix is given by kktsystem, $K$ and b_x (i.e. $b_x$), b_z (i.e. $W^{-T}b_z$) are vectors and b_y (i.e. $b_y$, if linear equality constraints present).

Parameters

  • device: CPU or GPU
  • kktsystem: KKTSystem object
  • b_x: The x component of the vector b
  • b_y: The y component of the vector b
  • b_z: The z component of the vector b
  • check: true or false depending on whether matrix decompositions are valid

Output

The KKT solution vector [x; y; 0].

ConicSolve.KKTSystemType
KKTSystem

The KKT System solved by the KKT solver. In the absence of linear equalities, the system solved is:

\[K = \begin{bmatrix} P & G^T \\ G & -W^TW \\ \end{bmatrix}\]

In the presence of linear equalities, the system solved is:

\[K = \begin{bmatrix} P & A^T & G^T \\ A & 0 & 0 \\ G & 0 & -W^TW \\ \end{bmatrix}\]

ConicSolve.SolverType
Solver

Represents an Interior Point Method solver for solving Conic Quadratic Programs. All parameters are optional except program.

Parameters:

  • cb_after_iteration: Callback function of the form: function cb(solver::Solver) end
  • cb_before_iteration: Callback function of the form: function cb(solver::Solver) end
  • device: CPU or GPU
  • program: The Cone QP to solve
  • kktsolver: The object to represent the KKT solver used to solve the KKT system. The kktsolve argument will construct the appropriate KKTSolver object. Possible values for kktsolve are conjgrad, minres and qrchol. qrchol is the default.
  • limit_obj: The minimum/maximum objective value the solver will terminate
  • limit_soln: The 2-norm difference between the current and previous estimates
  • max_iterations: The maximum number of iterations before the solver terminates
  • num_threads: The number of threads used on the CPU to perform certain BLAS and parallelized operations
  • time_limit_sec: The maximum number of seconds elapsed before the solver terminates after the current iteration
  • tol_gap_abs: The absolute gap tolerance
  • tol_gap_rel: The relative gap tolerance
  • tol_optimality: The absolute tolerance for satisfying the optimality conditions
  • η: Optimization parameter typically set to zero or σ, default is 0.0. Set η as nothing to set to σ.
  • γ: Mehrotra correction parameter set to γ ∈ [0, 1], default is 1.0
ConicSolve.get_objectiveMethod
get_objective(P, c, x)

Get the current objective value to the conic quadratic program $x^TPx + c^Tx$

ConicSolve.is_optimalMethod
is_optimal(solver, gap_atol, gap_rtol, tol)

The stopping criterion used to determine convergence. Convergence is based on the following criteria:

  • residuals close to zero (within tol)
  • solution is primal-dual feasible
  • duality gap close to zero (within tol)
  • minimal change in primal objective value

Helper Methods

ConicSolve.apply_cart_on_fMethod
apply_cart_on_f(f, args...)

Output

Returns an array of f(x...) passing each value x of the cartesian product args... i.e. example input

a = [0, 1]
b = [3, 2]
vals = apply_cart_on_f(f, a, b)

yields vals = [f(0, 3), f(0, 2), f(1, 3), f(1, 2)]

ConicSolve.get_block_matrixMethod
get_block_matrix(X, x_l, y_l, x_u, y_u)

Get block matrix defined by the row and column range.
x_l <= i <= x_u
y_l <= j <= y_u

ConicSolve.get_diagonal_idxMethod
get_diagonal_idx(n)

Get vectorized diagonal indices. For example, the following entries returned: idx = [1, 5, 8, 10] correspond to the matrix of n=4: [1 2 3 4; 2 5 6 7; 4 7 9 10]

ConicSolve.get_maskMethod
get_mask(cond, data)

Creates a mask given a predicate function, cond against the data matrix.

ConicSolve.get_off_diagonal_idxMethod
get_off_diagonal_idx(n)

Get vectorized lower triangular off diagonal indices. For example, the following entries returned: idx = [2, 3, 4, 6, 7, 9] correspond to the matrix of n=4: [1 2 3 4; 2 5 6 7; 3 6 8 9; 4 7 9 10]

ConicSolve.lower_triangular_from_2d_idxMethod
lower_triangular_from_2d_idx(n, idx)

Converts 2d index values of a square matrix of size n x n.

Output

Return the index values of a vectorized lower triangular matrix.

ConicSolve.matMethod
mat(u)

Performs the inverse operation of vec(U), i.e. mat(vec(U)) = U

Output

Returns a matrix representation of the vector u.

\[\begin{bmatrix} u_{1} & u_{2}/\sqrt{2} & u_{3}/\sqrt{2} & \dots & u_{n}/\sqrt{2} \\ u_{2}/\sqrt{2} & u_{p+1} & u_{23}/\sqrt{2} & \dots & u_{2p-1}/\sqrt{2} \\ \vdots & \vdots & \vdots & & \vdots \\ u_{p}/\sqrt{2} & u_{2p-1}/\sqrt{2} & u_{d3}/\sqrt{2} & \dots & u_{p(p+1)/2} \end{bmatrix}\]

ConicSolve.svecMethod
svec(U)

Output

Returns a vectorized representation of the square matrix U as $(U_{11}, \sqrt{2}U_{21}, ..., \sqrt{2}U_{p1}, U_{22}, \sqrt{2}U_{32}, ..., \sqrt{2}U_{p2}, ..., U_{p-1,p-1}, \sqrt{2}U_{p,p-1}, U_{pp})$