The problem is more abstract, but can be illustrated nicely using ovens. A oven can produce any heat, but is most efficient when it produces $c$ heat. The inefficency increases quadratically as one moves away from the ideal temperature.
For a concretely example imagine we have the following three ovens
$ \hspace{1cm} A = 10, B = 15, C = 20 $
The efficiency loss could then be modeled by
$\hspace{1cm} E(x,y,z) = g(10, x) + g(15, y) + g(20, z) $
Where $g$ is given as
$ \hspace{1cm} g(a, x) = \left\{ \begin{array}{ccc} 100(a-x)^2/a & \text{if} & x > 0 \\ 0 & \text{if} & x = 0 \end{array} \right. $
The problem is at which rate the ovens should run to generate the heat $T$. In other words minimize $E(x,y,z)$ subject to $x + y + z = T$.
Is there some efficient way to achieve this? For 3, I can iterate over them but for 10 this is harder...


The inefficiency is a quadratic function of your variables, and the constraint is a hyperplane. By an appropriate (fairly easy) linear transformation the inefficiency is the Euclidean distance of your variable vector to the origin, and then you are minimizing the distance from the origin to a variable point on a hyperplane: the minimum is reached at the orthogonal projection of the origin on the hyperplane.