Dynamic programming at a non linear programming problem Could you explain to me how we can use dynamic programming in order to solve a non linear programming problem?
What do we do for example if we are given the following problem?
$$\max (y_1^3-11 y_1^2+40 y_1+y_2^3-8y_2^2+21 y_2) \\ y_1+y_2 \leq 5.4 \\ y_1, y_2 \geq 0$$

I now know that this is an exercise and you need to use dynamic programming, however, I'll leave this solution up for reference. 
Fix $y_1 + y_2 = z$ for $z\leq 5.4$.
The objective can be rewritten: 
$$y_1^3-11 y_1^2+40 y_1+(z-y_1)^3-8(z-y_1)^2+21(z-y_1)$$ 
This function is concave in $y_1$ (the cubic terms fall out leaving an upside-down parabola), so the first order condition is sufficient for (constrained) global maximum. 
The first order condition is: $y_1 = \frac{z+1}{2}$ and thus $y_2 = \frac{z-1}{2}$ 
Plugging these into to the objective and simplifying gives:
$$\frac{1}{4}(z^3 - 19z^2 +119z +19)$$
This is increasing to $5\frac{2}{3}\geq5.4$. Thus, the objective is maximized for $z=5.4$. Using the first order condition above again gives the solution:
This is: $$y_1=\frac{16}{5}$$ 
$$y_2=\frac{11}{5}$$ 
