Solution (source code)

= Solution

A dispatch cycle contains $N$ interarrival times and has mean length $N/\mu$. The expected total passenger waiting time in one cycle is
$$
\frac1\mu(1+2+\cdots+(N-1))=\frac{N(N-1)}{2\mu}.
$$
The renewal-reward average cost rate is therefore
$$
C(N)=\frac{K+cN(N-1)/(2\mu)}{N/\mu}
=\frac{\mu K}{N}+\frac c2(N-1).
$$
Thus the continuous optimum is $\sqrt{2\mu K/c}$, and the integer optimum is the positive integer minimizing $C(N)$; equivalently it is the smallest $N$ with
$$
N(N+1)\geq\frac{2\mu K}{c},
$$
with both adjacent values optimal in the equality case.