This paper proposed a berth allocation optimization model for random arrival outbound container in con -tainer terminals .The optimization model considers the interaction between the layout of allocated containers and trailer traveling routes .The objective function of optimization model minimizes the total travel distance of the trailers with ship berth as decision variable .Based on optimization model ,a modified genetic algorithm with heuristic search is developed . Finally ,the proposed model and algorithm was simulated and tested through a case study .According to the Comparative analysis of the results of the optimization model and the traditional berth allocation "first come ,first served" method ,the total trailer traveling distance is shortened by 11 .51% when using the optimization model .The results show that reasona-ble berth allocation and container location assignment can be obtained by using the model and algorithm .Implementing this model will have dramatic impact on container terminal performance and operating costs .The results also prove that the model and algorithm are feasible and effective .