Module poptools.opt
Classes
class SemidefiniteProgram (a: poptools.linalg._blockmat.BlockMatArray,
b: numpy.ndarray,
c: poptools.linalg._blockmat.BlockMatArray)-
Stores the data associated with a semidefinite program and provides various operations on it.
Arguments:
a
: array of block matrices of shape (m, n, n),b
: vector of shape (m,), andc
: single block matrix of shape (1, n, n) with same block structure asa
The primal SDP reads as follows:
maximize < c, x > over x symmetric, PSD matrix of size n x n subject to < a[i], x > = b[i] for i = 1, ..., m
where < ., . > denotes the Frobenius inner product of square matrices.
The corresponding dual SDP reads is:
minimize b^T y over y vector of size m subject to z = c - sum(y[i] * a[i] for i = 1, ..., m) is PSD
Methods
def primal_objective(self, x: poptools.linalg._blockmat.BlockMatArray) ‑> numpy.ndarray
-
Computes the primal objective function value
< a[0], x >
for a given vectorized symmetric matrix x (in the samevsd
). def dual_objective(self, y: numpy.ndarray) ‑> numpy.ndarray
-
Computes the dual objective function value
b^T y
for a given vector y. def opA(self, x: poptools.linalg._blockmat.BlockMatArray) ‑> numpy.ndarray
-
Evaluates the constraint operator A, which maps a vectorized symmetric matrix
x
to anm
-vector.opA(X) = [< A[i], X > for i = 1, ..., m]
This will also work for a stack of vectorized symmetric matrices.
def adA(self, y: numpy.ndarray) ‑> poptools.linalg._blockmat.BlockMatArray
-
Evaluates the adjoint of the constraint operator A, which is defined as:
adA(y) = sum(y[i] * A[i] for i = 1, ..., m)
at a given
m
-vector y (or an array of vectors). The result is again a vectorized symmetric matrix compatible withvsd
. def primal_infeasibility(self, x: poptools.linalg._blockmat.BlockMatArray) ‑> float
-
Computes the (relative) primal infeasibility, which is defined as
|| opA(X) - b || / ( 1 + || b || )
def dual_infeasibility(self, y: numpy.ndarray, z: poptools.linalg._blockmat.BlockMatArray) ‑> numpy.ndarray
-
Computes the dual infeasibility, which is defined as the Frobenius norm of the residual of the dual constraint:
dinfeas(y, z) = || adA(y) - a[0] - z ||
where
adA(y)
is the evaluation of the adjoint of the constraint operator A at y. def relative_gap(self, x: poptools.linalg._blockmat.BlockMatArray, y: numpy.ndarray) ‑> numpy.ndarray