Functional optimization: maximize a double integral where the functional appears twice Please help me solve the following optimization problem. Suppose that you have to choose a function $U: [0,1]\mapsto [0,1],$ which must be nondecreasing ($U'\geq 0$) to maximize the following integral:   
\begin{align}
L[U] & =\int_0^1\int_y^1  (x-y) f(x)f(y)(1-G[U(y)-U(x)])  dx dy\nonumber \\
  & \quad + \int_0^1\int_0^y  (y-x) f(x)f(y)G[U(y)-U(x)] dx dy,
\end{align}
where the $f$ is a probability density function and $G$ is a cumulative density function. Both are known, generic, with no particular assumptions. Just assume  $[0,1]$ is in their support.
The problem is that $U$ appears twice inside the integral, so I can't (or I don't know how to) solve this with calculus of variations or optimal control.
Does anyone know how to solve this? Or if this can be solved at all (under what assumptions)? Or maybe a reference? Please point me in the right direction.
 A: You need to differentiate with respect to each occurrence of $U$ and add up all the contributions. For the first term, differentiating the inner integral with respect to $U(y)$ yields
$$
\int_y^1(y-x)f(x)f(y)g[U(y)-U(x)]\,\mathrm dx\;.
$$
To differentiate with respect to the other occurrence, first swap the order of integration and interchange $x$ and $y$,
\begin{align}
&\int_0^1\int_y^1(x-y)f(x)f(y)(1-G[U(y)-U(x)])\,\mathrm dx\,\mathrm dy\\
=&\int_0^1\int_0^x(x-y)f(x)f(y)(1-G[U(y)-U(x)])\,\mathrm dy\,\mathrm dx\\
=&\int_0^1\int_0^y(y-x)f(y)f(x)(1-G[U(x)-U(y)])\,\mathrm dx\,\mathrm dy\;,
\end{align}
and then differentiate the inner integral with respect to $U(y)$:
$$
\int_0^y(y-x)f(x)f(y)g[U(x)-U(y)]\,\mathrm dx\;.
$$
Since $U$ is nondecreasing, the two contributions can be combined into
$$
\int_0^1(y-x)f(x)f(y)g\left[-\left|U(y)-U(x)\right|\right]\,\mathrm dx\;.
$$
Proceeding the same way for the second terms yields a contribution
$$
\int_0^1(y-x)f(x)f(y)g\left[\left|U(y)-U(x)\right|\right]\,\mathrm dx\;.
$$
Thus the condition for stationarity of $L[U]$ is
$$
\int_0^1(y-x)f(x)f(y)\left(g\left[\left|U(y)-U(x)\right|\right]+g\left[-\left|U(y)-U(x)\right|\right]\right)\,\mathrm dx=0
$$
for all $y\in[0,1]$.
