Optimization techniques applied to railway systems