Each of the n lathes available in a machine shop can be used to produce two types of parts. If z lathes are used to produce the first part, the expected profit is 3z and if z of them are used to produce the second part, the expected profit is 2.5z. The lathes are subject to attrition so that after completing the first part, only z/3 out of z remain available for further work. Similarly, after completing the second part, only 2z/3 out of z remain available for further work.
The process is repeated with the remaining lathes for two more stages. Find the number of lathes to be allocated to each part at each stage to maximize the total expected profit. Assume that any nonnegative real number of lathes can be assigned at each stage.