A machine learning approach for optimisation in railway planning