Shunting for taking-out and placing-in of wagons (STPW) is an important work of freight stations, technical stations with more cargo operations, and large intermediate stations.The sequence optimization of STPW can effectively reduce the total shunting time and reduce operating costs, which is of great significance. When the optimization goal is to minimize the total shunting time, there will be many optimal solutions. Therefore, it is necessary to introduce a second optimization objective in order to seek a more reasonable solution from numerous optimal solutions. However, there is no relevant research on this in existing literature. In response to this situation, this paper proposes two optimization objectives: the first is to minimize the total time of STPW, and the second is to minimize the wagon-hour based on minimizing the total time of STPW. Based on the above two optimization objectives, a mathematical model is established, and a three-stage optimization solution strategy is proposed. The first stage is to solve the first optimization objective by using the improved ant colony algorithm; the second stage is to introduce and improve the crossover operation of the genetic algorithm to improve the diversity of the optimal path; the third stage is to solve the second optimization objective. Finally, an example is given to verify the feasibility of the model and the solution strategy.