I am trying to solve an allocation problem for a nested CES production function with three factors.
The production function we posit is:
$$ F(K, \mathbf L, \mathbf C) = [\alpha K^\rho + \sum_{i\not\in \text{AT}} \beta_i L_i ^\rho + \sum_{i\in \text{AT}} \beta_i (L_i + \eta_i C_i)^\rho]^{\frac{1}{\rho}} $$
where $K$ is capital, $\mathbf L$ is labour, $\mathbf C$ is compute, $\rho$ is the labour-capital substitution coefficient, $\alpha + \sum_{0 \le i \le n} \beta_i = 1$ are the task-specific share parameters, $\text{AT}$ is the set of automatable tasks and $\eta_i < 1$ are the task-specific substitution factors between labour and compute.
Assuming capital and labour are gross complements (ie $\rho < 0$) then the problem is equivalent to minimizing $$ F'(\mathbf L, \mathbf C) = \sum_{i} \beta_i (L_i + \eta_i C_i )^\rho $$ subject to the budget constraints
$$ \sum_i L_i = L $$ $$\sum_{i} C_i = C$$ $$C_i = 0, \text{ if } i\not\in \text{AT}$$
The point of minimization happens when the marginal returns to labour and compute on each task are equal.
This gives rise to the optimality conditions $\frac{\partial F'}{\partial L_i} = \frac{\partial F'}{\partial L_j}$ for all $i,j$; and $\frac{\partial F'}{\partial C_i} = \frac{\partial F'}{\partial C_j}$ for $i,j \in \text{AT}$.
$$ \frac{\partial F'}{\partial L_i} = \beta_i \rho (L_i + \eta_i C_i)^{\rho - 1} = \beta_0 \rho (L_0 + \eta_0 C_0)^{\rho - 1} = \frac{\partial F'}{\partial L_0} $$
$$ \frac{\partial F'}{\partial C_i} = \beta_i \rho (L_i + \eta_i C_i)^{\rho -1} \eta_i = \beta_0 \rho (L_0 + \eta_0 C_0)^{\rho -1} \eta_0 = \frac{\partial F'}{\partial C_0} $$
where we assumed that task 0 is automatable ie $0\in \text{AT}$.
After eliminating $\rho$ and resolving the exponent we have that:
$$ \frac{1}{\beta_0^{\sigma}}L_0 - \frac{1}{\beta_i^{\sigma}}L_i + \frac{\eta_0}{\beta_0^{\sigma}}C_0 - \frac{\eta_i}{\beta_i^{\sigma}}C_i = 0 $$
$$ \frac{1}{\beta_0^{\sigma}\eta_0^{\sigma}}L_0 - \frac{1}{\beta_i^{\sigma}\eta_i^{\sigma}}L_i + \frac{\eta_0^{1 - \sigma}}{\beta_0^{\sigma}}C_0 - \frac{\eta_i^{1 - \sigma}}{\beta_i^{\sigma}}C_i = 0 $$ where $\sigma = \frac{1}{1 - \rho}$ is the coefficient of elasticity of the CES production function.
Together with the budget conditions, these equations form a uniquely determined system of linear equations. Since $F'$ is convex, the solution is neccessarily the minimum.
So far so good, but I wanted to check that the solution works in an example.
I chose $C = 1, L=1, \beta_1 = 1/3, \beta_2=2/3, \rho = -0.5, \eta_0 = 1, \text{AT} = \{0\}$.
The solution that I get using a lineal algebra solver is $L_0 = -0.22702358, L_1 = 1.22702358, C_0 = 1, C_1 = 0$.
So clearly I have forgotten to account for the restriction that each individual factor must be non negative. The question is, how do I incorporate that in the solution?