I came across a portoflio optimization problem, where I need to solve for optimal investment and consumption processes, such that the expected utility of total consumption and terminal wealth is maximized. Namely

$max_{\pi,c}\;\mathbb{E}\bigg[\,U_{1}\big(\int_{0}^{T}c(t)\,dt\big) + U_{2}\big(V^{\pi,c}(T)\big)\;\bigg]$

where $\pi$ (investment) and $c$ (consumption) are two control processes subject to technical conditions, $V^{\pi,c}(t)$ is the investors wealth at time $t\in[0,T]$, and $U_{1}$ and $U_{2}$ are (deterministic, utility) functions.

Has somebody come across a similar problem? Can someone point me in the right direction towards a solution? Any comments, ideas, suggestions are highly appreciated! Thank you very much.

**P.S.:** Note the difference to the standard optimization problem of Merton, where one solves the related problem

$max_{\pi,c}\;\mathbb{E}\bigg[\,\int_{0}^{T}U_{1}\big(c(t)\big)\,dt + U_{2}\big(V^{\pi,c}(T)\big)\;\bigg]$

which can be solved using the (so-called) Martingale Method or the associated Hamilton-Jacobi-Bellman equation.