$W\_{opt}=\arg \{\max(\pi\_0 F\_{L\_0}(W)-\frac{\pi\_1}{W}\int\_0^W F\_{L\_1}( \alpha )d \alpha )\}$ 


subject to $\quad \int\_0^W F\_{L\_0} (\alpha)d\alpha <\xi$ 


We should find analytically the optimal $W >0$ which maximize the first equation subject to the second equation, where $F( \cdot )$ is comulative distribution function (CDF), and $L\_0$ and $L\_1$ are positive random variables. $\xi$, $\pi\_0$, $\pi\_1$ are constant. Also, $0<\pi\_0, \pi\_1<1$ and $\pi\_0 + \pi\_1 =1$. All variables are real. Further, if needed, we can assume that, for example, $L\_0$ and $L\_1$ may have Erlang or exponential distribution.



One-Variable Optimization Problem
Hmm, you could rewrite it this way: (I'm going to assume that $\pi\_0, \pi\_1, \xi'', \mu, \lambda$ are pre-defined constants, and $\alpha,W$ are variables)


$$
\begin{align}
&\max\_{W}\; \pi\_{0} (1 - e^{-\mu W}) - \frac{\pi\_{1}}{W}z\_{1}(W)\\
s.t.\;& \frac{dz\_{0}(\alpha)}{d\alpha} = 1 - e^{-\mu \alpha},\quad z\_{0}(0) = 0\\
& \frac{dz\_{1}(\alpha)}{d\alpha} = 1 - e^{-\lambda \alpha},\quad z\_{1}(0) = 0\\
& z\_{0}(W) + \epsilon \leq \xi''\\
& W \geq 0
\end{align}
$$
where $z\_{0},z\_{1}$ are auxiliary variables and $\epsilon$ is a numerical tolerance value. This then becomes a DAE (differential-algebraic equation) optimization problem, which can be solved numerically. (though given that your decision variable is also the independent variable in the differential equations, some further bilinear transformations may be required. See <http://dx.doi.org/10.1016/j.na.2005.03.066>. Some software packages do this automatically.).


Edit: I just realized, if indeed $\xi''$ is a constant as I have assumed, the inequality constraint can easily be converted into a bound.
$$ 
\begin{align}
\int\_{0}^{W^U} 1-e^{-\mu \alpha}\,d\alpha = \xi'' - \epsilon\\
\frac{e^{-\mu W^{U}}}{\mu} + W^{U} - \frac{1}{\mu} = \xi'' - \epsilon\\
\end{align}
$$
Solve for $W^{U}$, and replace the above inequality constraints with:
$$ 0 \leq W \leq W^{U}
$$
You may be able to solve this using optimal control methods.


