Estimation of railway capacity using stochastic optimal control models