% 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);
 
Calling Mosek 9.1.9: 155 variables, 60 equality constraints
   For improved efficiency, Mosek is solving the dual problem.
------------------------------------------------------------

MOSEK Version 9.1.9 (Build date: 2019-11-21 11:32:15)
Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com
Platform: MACOSX/64-X86

Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 60              
  Cones                  : 50              
  Scalar variables       : 155             
  Matrix variables       : 0               
  Integer variables      : 0               

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries                  : 1                 time                   : 0.00            
Lin. dep.  - tries                  : 1                 time                   : 0.00            
Lin. dep.  - number                 : 0               
Presolve terminated. Time: 0.00    
Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 60              
  Cones                  : 50              
  Scalar variables       : 155             
  Matrix variables       : 0               
  Integer variables      : 0               

Optimizer  - threads                : 8               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 10
Optimizer  - Cones                  : 51
Optimizer  - Scalar variables       : 156               conic                  : 156             
Optimizer  - Semi-definite variables: 0                 scalarized             : 0               
Factor     - setup time             : 0.00              dense det. time        : 0.00            
Factor     - ML order time          : 0.00              GP order time          : 0.00            
Factor     - nonzeros before factor : 55                after factor           : 55              
Factor     - dense dim.             : 0                 flops                  : 1.20e+04        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   3.2e+00  5.1e+00  2.0e+02  0.00e+00   1.570825061e+02   -4.025510008e+01  1.0e+00  0.00  
1   1.1e+00  1.8e+00  5.0e+01  2.26e-01   1.092238036e+02   2.053213161e+01   3.5e-01  0.01  
2   5.3e-01  8.4e-01  1.8e+01  5.74e-01   8.996806321e+01   4.137705238e+01   1.7e-01  0.01  
3   3.4e-01  5.4e-01  1.0e+01  7.24e-01   8.147598825e+01   4.781049976e+01   1.1e-01  0.01  
4   1.6e-01  2.6e-01  3.4e+00  7.87e-01   7.302056894e+01   5.613860580e+01   5.1e-02  0.01  
5   3.6e-02  5.8e-02  4.1e-01  8.40e-01   6.690306914e+01   6.275755062e+01   1.2e-02  0.01  
6   8.8e-03  1.4e-02  5.2e-02  9.18e-01   6.533811840e+01   6.429369690e+01   2.8e-03  0.01  
7   1.8e-03  2.8e-03  4.8e-03  9.81e-01   6.494959705e+01   6.473831929e+01   5.6e-04  0.01  
8   1.6e-04  2.6e-04  1.4e-04  9.88e-01   6.485957897e+01   6.484001898e+01   5.1e-05  0.01  
9   1.1e-05  1.7e-05  2.3e-06  9.98e-01   6.485101235e+01   6.484972020e+01   3.4e-06  0.01  
10  1.1e-06  1.7e-06  7.5e-08  1.00e+00   6.485047018e+01   6.485033859e+01   3.4e-07  0.01  
11  1.2e-07  1.8e-07  2.6e-09  1.00e+00   6.485041513e+01   6.485040111e+01   3.7e-08  0.01  
12  1.7e-08  2.8e-08  1.5e-10  9.94e-01   6.485040940e+01   6.485040728e+01   5.8e-09  0.01  
13  1.8e-08  2.5e-08  1.3e-10  1.00e+00   6.485040931e+01   6.485040739e+01   5.3e-09  0.01  
14  1.5e-09  1.9e-09  2.8e-12  1.00e+00   6.485040864e+01   6.485040849e+01   4.1e-10  0.01  
Optimizer terminated. Time: 0.02    


Interior-point solution summary
  Problem status  : PRIMAL_AND_DUAL_FEASIBLE
  Solution status : OPTIMAL
  Primal.  obj: 6.4850408639e+01    nrm: 2e+01    Viol.  con: 6e-09    var: 0e+00    cones: 6e-10  
  Dual.    obj: 6.4850408492e+01    nrm: 3e+00    Viol.  con: 0e+00    var: 4e-09    cones: 0e+00  
Optimizer summary
  Optimizer                 -                        time: 0.02    
    Interior-point          - iterations : 14        time: 0.02    
      Basis identification  -                        time: 0.00    
        Primal              - iterations : 0         time: 0.00    
        Dual                - iterations : 0         time: 0.00    
        Clean primal        - iterations : 0         time: 0.00    
        Clean dual          - iterations : 0         time: 0.00    
    Simplex                 -                        time: 0.00    
      Primal simplex        - iterations : 0         time: 0.00    
      Dual simplex          - iterations : 0         time: 0.00    
    Mixed integer           - relaxations: 0         time: 0.00    

------------------------------------------------------------
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