Section 8.5.3: Analytic center of a set of linear inequalities

% Boyd & Vandenberghe "Convex Optimization"
% Joëlle Skaf - 04/29/08
%
% The analytic center of a set of linear inequalities and equalities:
%           a_i^Tx <= b_i   i=1,...,m,
%           Fx = g,
% is the solution of the unconstrained minimization problem
%           minimize    -sum_{i=1}^m log(b_i-a_i^Tx).

% Input data
randn('state', 0);
rand('state', 0);
n = 10;
m = 50;
p = 5;
tmp = randn(n,1);
A = randn(m,n);
b = A*tmp + 10*rand(m,1);
F = randn(p,n);
g = F*tmp;

% Analytic center
cvx_begin
    variable x(n)
    minimize -sum(log(b-A*x))
    F*x == g
cvx_end

disp(['The analytic center of the set of linear inequalities and ' ...
      'equalities is: ']);
disp(x);
 
Successive approximation method to be employed.
   SDPT3 will be called several times to refine the solution.
   Original size: 155 variables, 60 equality constraints
   For improved efficiency, SDPT3 is solving the dual problem.
   Approximation size: 556 variables, 310 equality constraints
-----------------------------------------------------------------
 Target     Conic    Solver
Precision   Error    Status
---------------------------
1.221e-04  7.926e-01  Solved
1.221e-04  3.056e-03  Solved
1.221e-04  0.000e+00  Solved
1.490e-08  6.861e-07  Solved
1.490e-08  0.000e+00  Solved
-----------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): -64.8504
The analytic center of the set of linear inequalities and equalities is: 
   -0.3618
   -1.5333
    0.1387
    0.2491
   -1.1163
    1.3142
    1.2303
   -0.0511
    0.4031
    0.1248