I have found a solved example of A Stochastic Two-Period Model with No Setup Cost that has a lot of complicated calculations to arrive to the solution.
In the following example, $c=$cost of ordering, $h=$cost of holding and $p=$shortage cost.
The part where things start to complicate, is when making the substitution of $y_1^0$ into $C_1(x_1)$.
Clearly will not be an easy calculation by hand since $C_1$ has this function $L$, that it's evaluated with diferent arguments, which are two integrals.
I am not sure what form the argument of $\displaystyle \min_{y_1\ge x_1}\{\dots\}$ will have, nor what would be best to do next. My book mentions this OR Courseware but since I have the pdf file book I don't have the disk? is refering to.
And my question is what can I do here in order to find the optimal $y_1^0$ without having to deal with lots and lots of calculations by hand?
Any suggestions are very appreciated.
edit.
Following the comment of Larry, I substitute $y_1^0$ in the equation equal to zero (below the $C_1(x_1)$ definition in the image).
I assumed $y_1^0=5$ to be the optimal and this is what I got
$$-15+(15+10)\frac{5}{10}+(10-15)\Phi(5-2)+(15+10)\int_0^{3}\Phi(5-\xi)\phi_D(\xi)d\xi $$ $$=more\ calculations$$ $$=-\frac {11}{8}$$ This is different than $0$, which I don't understand why, the equation should have had the value $0$ because the book mentioned the optimal was $y_1^0=5$ and not $y_1^0=6$. Also the optimal should satisfy the equation equal to zero, but does not.
I really don't see what am I doing wrong? I did check twice the calculations of the expression and found no errors.




I don't fully understand/ know about this topic but I have some ideas about the possible answer or how to disentangle the problems.
The optimal value of $y_1^0$ is $5.42$, as they compute in the example. However, they don't use the general equation:
But, the equation for the case of a uniform distribution:
In fact you can use the first equation (I did it) and obtain the same result. I give you some middle steps:
$$-15 + \frac{25y_1^0}{10} - 5 \frac{y_1^0-y_2^0}{10} + 25 \int_0^{y_1^0-y_2^0} \frac{y_1^0-\xi}{10}\frac{1}{10}d\xi = 0.$$
After substituting $y_2^0=2$ and some computations you reach:
$$-\frac{29}{2} + 2 y_1^0 + \frac{{y_1^0}^2}{8}=0,$$
with the only positive solution being $y_1^0 = 5.4164$. However, I imagine $y_1^0$ needs to be an integer, so he substitutes $C_1(x_1)$ for either $y_1^0=5$ and $y_1^0=6$ (the nearest points) to find which of them is the one that gives a smaller value. You can try to see if you can get this.
I computed $L(z)$ and I get:
$$L(z)=p\int_z^{10} \frac{\xi-z}{10} d\xi + h \int_0^z \frac{z-\xi}{10}d\xi = \dots = \frac{p}{20} \left(10^2 - 20z\right) + \frac{z^2}{20} (p+h) = 5 (15-3z + \frac{z^2}{4}),$$
in case it is useful for you.