# Expectation of piece-wise objective function

I recently started reading ''Lectures On Stochastic Programming'' by Alexander Shapiro, Darinka Dentcheva & Andrzej Ruszczyński. On the introduction they adress the News Vendor Problem:

Suppose that a company has to decide about order quantity $$x$$ of a certain product to satisfy a demand $$d$$. The cost of ordering is $$c>0$$ per unit. If the demand $$d$$ is larger than $$x$$, then the company makes an additional order for the unit price $$b\geq 0$$. The cost of this is equal to $$b(d-x)$$ if $$d>x$$ and 0 otherwise. On the other hand, if $$d, then a holding cost of $$h(x-d) \geq 0$$ is incurred.

The Objective Function is:

$$F(x,d) = max \big\{(c-b)x + bd, (c+h)x -hd\big\}$$

Say demand $$D$$ is a random variable, then the expectation of the objective function is:

$$\mathbf{E}[F(x,D)] = b\mathbf{E}[D] + (c-b)x+(b+h)\cdot \int_0^xH(z)dz$$

with $$H(x):=Pr(D\leq x)$$, cdf of D.

How do you get to $$\mathbf{E}[F(x,D)]$$?.

• What do you mean "How do you get to $\mathsf E(F(x,D))$?" It says what to do right there. – Graham Kemp Mar 7 '17 at 0:05
• Whats the proof that $E[F(x,D)]$ is what is stated there, sorry for my english – Tomás Arturo Herrera Castro Mar 12 '17 at 17:58

We begin by observing the second term in the max of $$F$$ can be rewritten as

$$(c - b)x + (h+ b)x - hD$$

so

$$F(x,D) = (c - b)x + bD + (h+b) (x - D)_+$$

where $$(x - D)_+ := \max\{0, x - D\}$$. Therefore

$$\mathbb E[F(x,D)] = b \mathbb E[D] + (c - b) x + (h+b)\mathbb E[(x-D)_+]$$

so it suffices to show

$$\mathbb E[(x-D)_+] = \int_0^x H(z) dz$$

Note that

$$\mathbb E[(x-D)_+] = \mathbb E[\textbf {1} _{x \ge D} (x - D)] = \mathbb E[\textbf 1_{x \ge D} x] - \mathbb E[\textbf 1_{x \ge D} D] = H(x)x - \mathbb E[\textbf 1_{x \ge D} D]$$

where $$\textbf 1_{x \ge D}$$ denotes the indicator random variable that is 1 if and only if $$D$$ is no more than $$x$$, and 0 otherwise.

Finally, for positive $$z$$ we define $$F(z):= P(\textbf 1_{x \ge D} D \le z)$$. Together with the fact that the complementary CDF of a nonnegative random variable integrates to expectation, we are able to obtain

$$\mathbb E[\textbf 1_{x \ge D} D] = \int_0^\infty 1 - F(z) dz$$

and

$$F(z) = \begin{cases} 1 & z \ge x \\ H(z) + 1 - H(x) & z < x \end{cases}$$

Note that $$\textbf 1_{x \ge D}D \le x \le z$$ so the first case in the above piecewise function holds. Verifying the second one is left as an exercise ;) (it's only slightly more elaborate).

Substituting this definition for $$F(z)$$ back into our integral tells us for $$z\ge x$$, $$-F(z)$$ cancels the 1 to give 0, so we are left with

$$\int_0^x 1 - (H(z) + 1 - H(x)) dz = \int_0^x H(x) - H(z) dz$$

By evaluating part of the above integral, we are able to at last conclude that

$$\mathbb E[(x-D)_+] = H(x)x - \Big((H(x)x - \int_0^x H(z) dz\Big) = \int_0^x H(z) dz$$

which is the claim we said it sufficed to show, completing the proof.