Entropy maximization

% Joëlle Skaf - 04/24/08
%
% Consider the linear inequality constrained entroy maximization problem
%           maximize    -sum_{i=1}^n x_i*log(x_i)
%           subject to  sum(x) = 1
%                       Fx <= g
% where the variable is x \in \reals^{n}

% Input data
randn('state', 0);
rand('state', 0);
n = 20;
m = 10;
p = 5;

tmp = rand(n,1);
A = randn(m,n);
b = A*tmp;
F = randn(p,n);
g = F*tmp + rand(p,1);

% Entropy maximization
cvx_begin
    variable x(n)
    maximize sum(entr(x))
    A*x == b
    F*x <= g
cvx_end

% Results
display('The optimal solution is:' );
disp(x);
 
Successive approximation method to be employed.
   sedumi will be called several times to refine the solution.
   Original size: 65 variables, 35 equality constraints
   20 exponentials add 160 variables, 100 equality constraints
-----------------------------------------------------------------
          Errors   
Act Centering    Conic    Status
-----------------------------------
20  1.496e+00  1.965e-01  Solved
20  7.829e-02  5.043e-04  Solved
20  8.273e-03  5.224e-06  Solved
20  1.036e-03  1.936e-07  Solved
20  1.297e-04  1.576e-07  Solved
20  1.629e-05  1.567e-07S Solved
20  1.673e-04S 3.731e-08  Solved
20  9.919e-05  8.009e-09  Solved
20  1.243e-05  7.994e-09S Solved
20  4.871e-05S 3.930e-10  Solved
-----------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +5.70335
The optimal solution is:
    0.3445
    0.3181
    0.7539
    0.8020
    0.6418
    0.3517
    0.1981
    0.2578
    0.6373
    0.3357
    0.7109
    0.8998
    0.6085
    0.6444
    0.3061
    0.4522
    0.8886
    0.7801
    0.3106
    0.6131