Let $V_1,\ldots,V_n$ be $n$ vector subspaces of a Hilbert space, $y_i\in V_i$ for each $i$ and $\overline{x}$ be a fixed vector. I want to solve the optimization problem: \begin{equation*} \begin{aligned} & \underset{x_1,\ldots,x_n}{\min} & & \sum_{i=1}^n \| x_i - y_i\|_2^2 \\ & \text{subject to} & & \frac{1}{n}\sum_{i=1}^n x_i = \overline{x},\\ & && \ x_i \in V_i \text{ for }i=1,...n. \end{aligned} \end{equation*} I don't have a basis for the $V_i$ a priori but I can use the projection operators $P_i$ as I please. The setting is supposed to be an infinite dimensional Hilbert space but any finite dimensional help is appreciated too. The $V_i$ are not necessarily orthogonal nor does their direct sum equal the whole space necessarily.
If the $V_i$ are orthogonal and direct sum into the whole space, I believe the solution is $x_i = y_i + N*P_i(\overline{x} - \overline{y})$.
Feel free to add in any assumptions you might need.