% sdpsol source maxVe_poly -- find the maximum volume ellipsoid
%   { Cy+d | ||y|| <=1 }
% in the polyhedron
%   { x | Ax <= b, A=[a_1,...a_L]^T, b=[b1,...,b_L] }
%
% maxdet problem:
%   maximize    log det C
%   subject to  [(b_i-a_i^T*d)*I  C*a_i
%                a_i^T*C          b_i-a_i^T*d] >=0, i=1,...,L
%               C > 0
%
% WARNING: cannot be run using the stand-alone sdpsol from UNIX, since
%          A, b are not defined

L=rows(A);
n=cols(A);
variable C(n,n) symmetric;
variable d(n,1);

for i=1:L;
  [(b(i,1)-A(i,:)*d)*eye(n),  C*A(i,:)';
   A(i,:)*C,                  b(i,1)-A(i,:)*d] > 0;
end;
C > 0;

maximize obj = logdet(C);
