In this paper we address the railway crew-scheduling problem, for which we have solved it for head of crew (train master) in passenger trains with real data of Iranian I.R. Railways. All possible activities of crew during a period of time are classified into two groups of activities, tasks and transfers. First, these activities and the precedence relationships among them are shown graphically by a multidepot network containing tasks and transfers arcs. According to the designed network, a new mathematical model, is, then, presented which is able to optimally solve small and medium size problems.. In order to solve large size or real world problems, a heuristic algorithm which is called constraints logic pattern is developed. Based on real data taken from passenger train scheduling of Iranian Railways, using branch and bound method, several problems in different sizes are solved. These problems are, also, solved and compared by a simplified method and the constraints logic pattern method. By comparing these two latter heuristic solution approaches with the present approach at Iranian Railways, it is concluded that constraints
logic pattern, while improving quality of solutions, can solve real world problems and provide noticeable savings.