This paper aims to propose a flexible method for optimizing the service-oriented train timetable and utilization of different service trains in an urban rail transit line, in which the inhomogeneous passenger demands in two directions are taken into consideration. Different types of trains with various loading capacities are scheduled to satisfy passenger demands, such that the energy cost and passenger waiting time can be minimized. We first formulate a nonlinear integer programming model by considering a variety of system constraints, including inventory train constraints, train loading capacity constraints, train type constraints, etc. Then, complexity analyses and decomposition methods are specifically discussed to solve the model. A modified tabu search algorithm (MTS) with prior enumeration methods (PE) is then designed to find approximately optimal solutions for the formulated model. A set of numerical examples are implemented to verify the effectiveness and performance of the proposed approaches on a simple metro line and the Beijing Metro Yizhuang Line.