*Article* **Optimized APF-ACO Algorithm for Ship Collision Avoidance and Path Planning**

**Mingze Li, Bing Li, Zhigang Qi \*, Jiashuai Li and Jiawei Wu**

College of Intelligent Science and Engineering, Harbin Engineering University, Harbin 150001, China; limingze123@hrbeu.edu.cn (M.L.); libing265@hrbeu.edu.cn (B.L.); lijiashuai@hrbeu.edu.cn (J.L.); wujiawei@hrbeu.edu.cn (J.W.)

**\*** Correspondence: qizhigang@hrbeu.edu.cn

**Abstract:** The primary objective of this study is to investigate maritime collision avoidance and trajectory planning in the presence of dynamic and static obstacles during navigation. Adhering to safety regulations is crucial when executing ship collision avoidance tasks. To address this issue, we propose an optimized APF-ACO algorithm for collision avoidance and path planning. First, a ship collision avoidance constraint model is constructed based on COLREGs to enhance the safety and applicability of the algorithm. Then, by introducing factors such as velocity, position, and shape parameters, the traditional APF method is optimized, creating a dynamic APF gradient for collision avoidance decision making in the face of dynamic obstacles. Furthermore, the optimized APF method is integrated with the ant colony optimization algorithm, the latter modified to overcome the inherent local optimality issues in the APF method. Ultimately, validations are conducted in three areas: static avoidance and planning in restricted sea areas, avoidance under conditions of mixed static and dynamic obstacles, and avoidance in situations of multiple ship encounters. These serve to illustrate the feasibility and efficacy of the proposed algorithm in achieving dynamic ship collision avoidance while simultaneously completing path-planning tasks.

**Keywords:** path planning; collision avoidance; the optimal APF; ACO
