Entropy Maximization

Here is a constrained entropy maximization problem:

\begin{array}{ll} \mbox{maximize} & -\sum_{i=1}^n x_i \log x_i \\ \mbox{subject to} & \mathbf{1}' x = 1 \\ & Ax \leq b \end{array}

where $x \in \mathbf{R}^n$ is our optimization variable and $A \in \mathbf{R}^{m \times n}, b \in \mathbf{R}^{m}$.

To solve this, we can simply use the entropy operation Convex.jl provides.


In [6]:
using Convex, SCS

n = 25;
m = 15;
A = randn(m, n); 
b = rand(m, 1); 

x = Variable(n);
problem = maximize(entropy(x), sum(x) == 1, A * x <= b)
solve!(problem, SCSSolver(verbose=0))

println(problem.optval)
println(x.value)


3.2188073846026657
[0.039596694193772826
 0.040060435043293534
 0.04019878866073644
 0.03983978331717988
 0.03937174306719803
 0.040288113034394835
 0.04068296295587558
 0.040348699741541545
 0.03977943218842446
 0.03920155057856007
 0.03967456574632815
 0.03965070447384114
 0.04005546388236403
 0.040085272144984585
 0.04063891088176249
 0.040633416079841944
 0.04053676010233853
 0.0401124273142282
 0.04065132469849484
 0.03909258717640152
 0.04005131432373106
 0.03929182732897887
 0.04009644317279356
 0.04046763019265253
 0.03959301166868323]