I want to solve min (c’)*x - logdet(A*x) where x>=0, subject to A*x>=0 , A*x<=eye(n) in cvx.

c=trace(A)+lamda, A=S^(-1/2)*B*S^(-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)=YB(:,:,i)*Y;

end

Y=s^(-1/2);

for i=1:n

A(:,:,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(cx-det_rootn(b))

end

c=Am+lamda;

b=sum(Ax,3);

minimize(c

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.

I was wondering if you could please help me.