The aim of this study is to propose a comprehensive approach for handling the crew scheduling
problem in the railway systems. In this approach, the information of different railway trips are considered as input and the problem is divided to three separated phases. In phase I, we generate all feasible sequences of the trips, which are named as the pairings. A depth-first search algorithm is developed to implement this phase. In phase II, the pairings constituting the optimal solution
are to be obtained. Both mentioned phases are handled in a centralized decision-making system for the entire railway network. Phase III aims to locally assign the crew groups to the optimal pairings. To solve the problem in phase III, a new mathematical model is developed in this paper. The model can determine the minimum required crew groups, and optimally assign the crew groups to the selected pairings of each home depot. In order to evaluate the developed algorithm and model, the Iranian railway network is evaluated by consideration of all passenger trips of the network. The results show that the proposed approach is capable of efficiently generating the optimal schedules for the railway crew groups in a reasonable computation time.