Let $d,n\ge 1$ be fixed integers. Given some compact subset $E\subset \mathbb R^d$, consider the function $f: E^n\ni (x_1,\ldots, x_n) \longrightarrow f(x_1,\ldots, x_n)\in \mathbb R$ defined by

$$f(x_1,\ldots, x_n):= \max_{(c_1,\ldots,c_n)\in\mathbb R^n}\left\{\int_E \left(\min_{1\le i\le n}|y-x_i|^2-c_i\right)p(y)dy + \sum_{i=1}^n \alpha_i c_i\right\},$$

where $p:E\to \mathbb R_+$ is a probability density on $E$ and $\alpha_1,\ldots, \alpha_n>0$ s.t. $\sum_{i=1}^n \alpha_i =1$. Under which conditions (on $E, \rho$) $f$ is differentiable (almost everywhere) on $E^n$?