With the huge increase in the throughput of container terminals, the problem of berth scheduling is a problem that restricts the development of container terminals. To address the problem of container terminal ship berth scheduling and improve the operational efficiency of the terminal is a necessary way to reduce the operating cost of the terminal and reduce the total time of ships in port. This paper establishes a discrete berth scheduling mathematical model for improving the operational efficiency of Yangshan Phase IV automated terminal on the basis of the ship scheduling system of Yangshan Phase IV automated terminal, aiming at the shortest total time in port for all ships. The optimal solution to the mathematical model is sought using a genetic algorithm based on integer coding.