Fix a positive constant $q=O(1)$ (say $1.5$). I am trying to find a function $\ell(x):[0, 1] \to \mathbb{R}_{\geq 0}$ that satisfies $\int_0^1 \ell(x) dx \leq q$ and minimizes the expression

$$\int_0^1 e^{-qx}\ell(x) dx - (1-e^{-q})(1-e^{-\int_0^1 \ell(x)})$$

My colleague told me that variational calculus *might* be useful here, but looking at the Wikipedia page, it seems to apply to functions of the form $\int_{x_1}^{x_2}L(x, y(x), y'(x)) dx$ for some function $L$. However, I can't write my specific problem in that format. Is there a general method to approach these optimization problems (I just need a pointer to read more, no need to even solve this specific problem!)