% Joëlle Skaf - 04/29/08
%
% The weighted analytic center of a set of linear inequalities:
%           a_i^Tx <= b_i   i=1,...,m,
% is the solution of the unconstrained minimization problem
%           minimize    -sum_{i=1}^m w_i*log(b_i-a_i^Tx),
% where w_i>0

% Input data
randn('state', 0);
rand('state', 0);
n = 10;
m = 50;
tmp = randn(n,1);
A = randn(m,n);
b = A*tmp + 2*rand(m,1);
w = rand(m,1);

% Analytic center
cvx_begin
    variable x(n)
    minimize -sum(w.*log(b-A*x))
cvx_end

disp('The weighted analytic center of the set of linear inequalities is: ');
disp(x);
 
Successive approximation method to be employed.
   For improved efficiency, SDPT3 is solving the dual problem.
   SDPT3 will be called several times to refine the solution.
   Original size: 150 variables, 60 equality constraints
   50 exponentials add 400 variables, 250 equality constraints
-----------------------------------------------------------------
 Cones  |             Errors              |
Mov/Act | Centering  Exp cone   Poly cone | Status
--------+---------------------------------+---------
 50/ 50 | 4.642e+00  1.215e+00  0.000e+00 | Solved
 50/ 50 | 9.246e-01  5.647e-02  0.000e+00 | Solved
 47/ 50 | 7.922e-02  4.134e-04  0.000e+00 | Solved
 35/ 44 | 8.288e-03  4.540e-06  0.000e+00 | Solved
 11/ 30 | 9.917e-04  6.459e-08  0.000e+00 | Solved
  0/  5 | 1.158e-04  4.969e-10  0.000e+00 | Solved
-----------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +5.99254
 
The weighted analytic center of the set of linear inequalities is: 
   -0.5100
   -1.4794
    0.3397
    0.1944
   -1.0444
    1.1956
    1.3927
   -0.2815
    0.2862
    0.3779