Can CVX handle the function log_det( I + inv(X) )

Hi everyone!

I want to solve an optimization that minimize log_det( I + inv(X) ) under the semidefinite constraint and some linear constraints to X. For the background of this problem, see this reference.

As mentioned in this reference, though log_det( I + inv(X) ) is a convex function of X, numerically solving the problem is not easy.

I tried to express the function in CVX as log_det( I + inv(X) ) and log_det( X + I ) - log_det( X ). However, CVX cannot accept these expressions.

I want to know whether CVX is able to handle the function. If not, is there any other softwares that can handle the function?

1 Like

The scalar case can be handled per the last entry in section 5.2.10 of the Mosek Modeling Cookook https://docs.mosek.com/modeling-cookbook/expo.html#modeling-with-the-exponential-cone .

I don’t know whether the matrix case can be handled in CVX. Perhaps @Michal_Adamaszek does? I showed how to use functions in CVXQUAD to handle some logdet perspective functions http://ask.cvxr.com/t/perspective-of-log-det-function-and-cvx-formulations-of-related-log-det-problems-using-quantum-relative-entropy-from-cvxquad/4033/3e , but this problem is different than those.

The trick in the scalar case linked by @Mark_L_Stone is to rewrite the argument to the log-function as a harmonic mean, so the inversion can be used to flip the sign of the log-function, i.e.:
t >= log(1 + 1/x) = log(1 / (x / (x+1)) ) = log(1 / (1-1/(x+1)) )
so that it can be rewritten:
-t <= log( 1 - 1/(x+1) )
and then you just substitute out 1/(x+1) for a dummy variable using a quadratic cone.

This generalize to the matrix case step-by-step as follows:
t >= log(det( I + inv(X) )) = log(det( inv(X*inv(X+I)) ) = log(det( inv(I - inv(X+I)) ))
so that it can be rewritten:
-t <= log(det( I - inv(X+I) ))
but I am missing a matrix-equivalent for substituting out inv(X+I).

1 Like

I believe
t \geq \log(\det( I + {\rm inv}(X) ))

is equivalent to
-t \leq \log(\det( I - {\rm inv}(X+I) ))

is equivalent to
-t \leq \log(\det( I - U ))
U \succeq {\rm inv}(X + I)

is equivalent to
-t \leq \log(\det( I - U ))
\left[\begin{array}{cc}X+I & I\\I & U\end{array}\right] \succeq 0

The first step follows from the scalar to matrix generalization above which you can prove more rigidly. The second step follows by applying \log(\det( I - U )) \leq \log(\det( I - V )) on I \succeq U \succeq V to our case with V = {\rm inv}(X + I). The last step is the Schur complement lemma.

3 Likes

Thanks @hfriberg. I implemented your idea in CVX and it worked.
The equivalent optimization problem is

\begin{align} \mathrm{max} \ & \ \log \det ( I - U ) \\ \mathrm{s.t.} \ & \ X \succeq 0 \ \text{and some linear constrains to} \ X \\ & \ I - U \succeq 0 , \\ & \ \left[ \begin{array}{cc} X + I & I \\ I & U \end{array} \right] \succeq 0 \end{align}

Here, I add I - U \succeq 0 to ensure continuity of the function.
At first I also considered to apply Schur complement and introduce a variable V \succeq X ^ {-1}, but the optimization became minimizing a log_det function, will is concave. The first equivalence in the trick converts the target to be maximing a log_det function. That’s really ingenious :grinning:

The I - U \succeq 0 part is redundant in cvx and may lower performance. Arguments to log_det are implicitly constrained this way already, as you’ll find in the cvx reference:

When used inside a CVX specification, log_det constrains its argument to be symmetric (if real) or Hermitian (if complex) and positive definite.

1 Like

OK, I got it. Thanks for your help.

1 Like

hello, this matrix([X+I, I;I, U]) maybe not correct, i think that X+I and U should change positions.

1 Like

That’s equivalent. …

1 Like

Hello @hfriberg @Mark_L_Stone , I am having a similar problem, where my objective is to minimize -log(det(I-W inv(X) W'), W and X are both variables. The problem is convex both in W and X, as -logdet() is convex and nondecreasing, and inv(X) and XAX' are both convex functions in X. Is there a way to convert it into a standard SDP?

1 Like

Edit: I misread the - as +. Presuming X > 0, the objective is convex for the scalar case, due to quad_over_lin

If X is a matrix, but W is a row vector (so that I is just the scalar 1), then
minimize(-log(1-matrix_frac(W',X))) can be used. or more simply minimize(matrix_frac(W',X)) to get the same argmin, But i don’t see how to generalize this for W being a matrix having more than 1 row.

Also see my next post.

1 Like

@Mark_L_Stone The objective is -logdet(1-W^2/X) with a minus sign. Since -logdet(-x) is convex and nondecreasing, and both 1/x and w^2 are convex, the objective is convex in both x and w. Thanks!

1 Like

Sorry, I misread the - as +.

By Schur’s formula, and presuming X should be constrained to psd (which my formulation will do),
det([I W;W' X]) = det(X)*det(I - W*inv(X)*W')

However, this leads to
-log_det(I - W*inv(X)*W') = -log_det([I W;W' X]) + log_det(X)
which will not work.

I have not yet reached a conclusion as to whether the objective is convex when X is a matrix and W is not a row vector (see my previous (edited) post for formulation when W is a row vector).

If the objective is convex, I’ll leave a possible reformulation for someone else to provide.

1 Like

I think I got it. It’s very much inspired by the response from @hfriberg. If we introduce a slack variable U, then the problem is equivalent to min (-\log\det(I-U)), U-W*inv(X)*W >=0. The objective now is accepted by cvx, and the constraint is a SDP constraint by Schur complement.

1 Like