Entropy Maximization

Here is a constrained entropy maximization problem:

\[\begin{array}{ll} \text{maximize} & -\sum_{i=1}^n x_i \log x_i \\ \text{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.

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, SCS.Optimizer; silent_solver = true)
problem.optval
3.148013973937255
evaluate(x)
25-element Vector{Float64}:
 0.020900739472579435
 0.026660763141844682
 0.030886704518753604
 0.058613968815721194
 0.054493987542873275
 0.026451292291790482
 0.03366416553553802
 0.06379587116392287
 0.07323720993183912
 0.023133648549778
 ⋮
 0.027715784985962697
 0.049566686769494855
 0.0415792975217902
 0.04260261086285848
 0.03239612206391842
 0.05250074653095457
 0.05960717670930832
 0.04838609955452682
 0.06074606505961268

This page was generated using Literate.jl.