I have the following convex optimization problem: $$\begin{array}{ll} \text{maximize}_{{f,g}} & \displaystyle\int_{\mathbb{R}} g^u{f}^{1-u}\mathrm{d}\mu\\ \text{subject to} & \displaystyle\int_{\mathbb{R}} f \mathrm{d}\mu= 1,\quad \displaystyle\int_{\mathbb{R}} g\mathrm{d}\mu =1 \\ & f_L \leq {f} \leq f_U\\ & g_L \leq g \leq g_U\end{array}$$ where $u\in(0,1) $ and $$\int_{\mathbb{R}}f_L \mathrm{d}\mu< 1,\quad\int_{\mathbb{R}}g_L \mathrm{d}\mu< 1$$
$$\int_{\mathbb{R}}f_U \mathrm{d}\mu> 1,\quad\int_{\mathbb{R}}g_U \mathrm{d}\mu> 1$$ Here, $f$ and $g$ are distinct density functions, $f_L,f_U,g_L,g_U$ are some known positive functions on $\mathbb{R}$ and $\mu$ is Lebesgue measure.
I am looking for a code for this case:
$$f_L=0.8*f_{\mathcal{N}(-1,1)}$$ $$f_U=2*f_{\mathcal{N}(-1,1)}$$ $$g_L=0.8*f_{\mathcal{N}(1,1)}$$ $$g_U=2*f_{\mathcal{N}(1,1)}$$
and here its mathematica code:
fL[y_] := 0.8*PDF[NormalDistribution[-1, 1], y]
fU[y_] := 2*PDF[NormalDistribution[-1, 1], y]
gL[y_] := 0.8*PDF[NormalDistribution[1, 1], y]
gU[y_] := 2*PDF[NormalDistribution[1, 1], y]
I asked the same question for any programming language here. It seems Rahul has an answer, which he wants to keep for himself. That's why I decided to ask the same question here.
I am not interested in a symbolic solution. Discretization of the densities is all fine.
Here, you can also see a possible solution for the discrete case. I am also posting the working code for the discrete case here:
u = 0.5;
n = 20
a = Table[0.6*PDF[BinomialDistribution[20, 0.3], i], {i, n}];
b = Table[1.5*PDF[BinomialDistribution[20, 0.3], i], {i, n}];
c = Table[0.4*PDF[BinomialDistribution[20, 0.7], i], {i, n}];
d = Table[2*PDF[BinomialDistribution[20, 0.7], i], {i, n}];
X = Array[x, n];
Y = Array[y, n];
FindMaximum[{X^(1 - u).Y^u,
Flatten[{ Total[X] == 1 , Total[Y] == 1,
MapThread[#1 <= #2 <= #3 &, {a, X, b}],
MapThread[#1 <= #2 <= #3 &, {c, Y, d}]}]} , Flatten[Join[{X, Y}]]]
VariationalMethods
? $\endgroup$ – anderstood Aug 11 '17 at 16:17