I want to solve min (c’)x - logdet(Ax) where x>=0, subject to Ax>=0 , Ax<=eye(n) in cvx.
c=trace(A)+lamda, A=S^(-1/2)BS^(-1/2)
x is avector and S is positive definite matrix. B={Bi} a tensor i=1:k and Bi are positive definite.
My code is:
clear
clc
n=30;
lamda=0.01;
p=rand(5,5)100;
s=p
p’; %positive definite
q=rand(5,5,n)*100;
for i=1:n
B(:,:,i)=q(:,:,i)q(:,:,i)’; %positive definite
end
Y=s^(-1/2);
for i=1:n
A(:,:,i)=Y
B(:,:,i)*Y;
end
for i=1:n
Am(i)=trace(A(:,:,i));
end
cvx_begin
variable x(n);
for i=1:size(A,3)
Ax(:,:,i)=x(i)A(:,:,i);
end
c=Am+lamda;
b=sum(Ax,3);
minimize(c
x-det_rootn(b))
subject to
x >= 0;
b >= zeros(5);
b <= eye(5);
cvx_end
I could not get correct answer. some values of x are negative, and sometimes cvx_status is Failed and cvx_optval is Nan. Also I replaced log_det with det_rootn.
Follow the instructions in my answer at Failed status and optimal value NAN in convex problem to install CVXQUAD and its `exponential.m` replacement for CVX’s version. I think that if you use the det_rootn version of your program, then no further modifications will be necessary to your problem in order for CVXQUAD’s Pade approximation to be invoked instead of CVX’s less reliable successive approximation method.