# Step-by-Step Multi-Ship Collision Avoidance Navigation Path Planning Based on Particle Swarm Optimization

Authors: Canglong Zhao
Journal: Journal of Control Science and Engineering
 (2022)

---

## Abstract

In order to solve the problem that it is difficult to combine path planning with navigation rules in the process of multi-ship collision avoidance in wide waters, a step-by-step multi-ship collision avoidance path planning algorithm is proposed in this paper. Firstly, the obstacle ship is regarded as a static obstacle, and the static path planning is carried out by using the particle swarm optimization path planning algorithm in polar coordinate space combined with the field of ship safety to obtain the turning point of ship collision avoidance. Then, the steering angle of the steering point is dynamically corrected by using the navigation rules. The experimental results show that the particle swarm optimization algorithm finds an optimal path in about 35 iterations, and the shortest path is 38.4n miles. Conclusion. The algorithm can solve the problem of multi-ship collision avoidance path planning and provide a new idea for solving the problem of multi-ship collision avoidance.


---

## Body

## 1. Introduction

The Maritime Safety Committee (MSC) of the International Maritime Organization (IMO) proposed a new work plan on maritime autonomous surface ships (MASSs) and rapidly promoted it [1]. MASS has become a research hotspot in the international maritime field or will become the development direction of shipping in the future. The shipping industry and relevant scientific research institutions have invested in relevant research to develop different levels of intelligent or automated ships and realize them in stages. Rolls Royce completed the project of machine executable collision regulations for marine autonomous systems (MAXCMAS) in 2017 and tested it in bridge simulators at sea and in various scenarios. It claims to meet the requirements of the existing international regulations for preventing collisions at sea, COLREGS (hereinafter referred to as the “rules”) [2]. In the special plan for scientific and technological innovation in the transportation field of the 13th five year plan, the Ministry of Science and Technology and the Ministry of Transport pointed out the key technologies of intelligent ships in “water transportation,” including intelligent navigation: automatic technology and verification technology of ship intelligent collision avoidance auxiliary decision making based on the rules, ship route optimization and independent decision making based on ship shore cooperation, ship automatic navigation technology, intelligent collision avoidance auxiliary decision-making technology of ships in complex waters, etc. From the perspective of international, domestic, and industrial development, unmanned ship, smart ship, or MASS has become a research hotspot in the industry, and the automatic collision avoidance/risk avoidance decision of ships in complex waters is the focus of research. From the perspective of necessity, although navigation technology has been highly developed, ship collision, grounding, and reef accidents still occur from time to time. Figure 1 shows the planning and design of multi-ship collision avoidance navigation path step by step [3].Figure 1
Step-by-step multi-ship collision avoidance navigation path planning and design.


## 2. Literature Review

Huang et al. used the research results of expert system theory to process the relevant knowledge in the field of ship collision avoidance and established a ship Intelligent Collision Avoidance Expert System to guide the ship’s collision avoidance navigation at sea [4]. Cho et al. designed a fuzzy logic collision avoidance method for unmanned ships based on behavior control and multi-objective behavior selection [5]. Zheng et al. combined fuzzy logic with neural network for ship collision avoidance and achieved good results [6]. Wang et al. designed a collision avoidance expert system considering a variety of collision influencing factors to solve the problem of high collision risk of ships in complex waters. These algorithms have indeed achieved some research results for different research backgrounds and research objects. However, there are many problems, such as less consideration of environmental factors and less collision avoidance decision-making schemes [7].Steering is the most effective decision making in the process of ship collision avoidance. Therefore, finding the steering time and steering angle of ship collision avoidance can effectively avoid collision. The earliest method to determine the turning time and turning angle is through the ship safety domain model and the geometric method of ship collision risk. Ning and others combined the distributed technology with the traditional geometric method to design the multi-ship collision avoidance simulation software, which further accelerated the research of geometric method: with the development of science and technology, the methods to determine the turning time and turning angle by relying on artificial intelligence methods such as data mining are also generated randomly [8]. The velocity obstacle method and artificial potential field method in the field of robot path planning have also been deeply applied in the field of ship collision avoidance. The multi-agent method is a new kind of method with the development of intelligent technology. Lazarowska and others regarded the ship as an independent agent and adopted the distributed decision-making system among agents to benefit each other and alleviate the overall collision risk situation [9]. Vanitha et al. introduced the agent of passive agent mechanism into the research of collision avoidance, which further improved the calculation time and accuracy [10].Therefore, a step-by-step multi-ship collision avoidance path planning algorithm based on particle swarm optimization and navigation rules is proposed in this paper. Firstly, multiple obstacle ships are regarded as static obstacles, and the rules are used to model the obstacle ships. The particle swarm optimization path planning algorithm in polar coordinate space is used for static path planning to obtain the global path of ship collision avoidance, and the turning point and turning angle of collision avoidance are obtained at the same time. Then, a dynamic correction algorithm of turning point and turning angle based on navigation rule reasoning is designed to dynamically correct the initial path during ship navigation. In this process, combined with the actual collision avoidance operation habits of the crew, the problem of difficult combination with rules in the process of multi-ship collision avoidance path planning is solved, so that the planned path meets the requirements of navigation rules and improves the efficiency and safety of navigation.


## 3. Research Methods

### 3.1. Problem Description and Modeling

For ships, path planning is to find the set of turning points for their navigation in the ocean. Since most of the main collision avoidance operations are turning operations, the particle swarm optimization path planning modeling method based on polar coordinate space is adopted:S is the starting point, G is the target point, S is the origin, and the connecting line between S and G is used as the polar axis to establish the polar coordinate system. Divide SG by m+1 to obtain segment m+1 with interval length of SGm+1. Make a circle with the connecting line from each bisection point to s as the radius to obtain a series of concentric arcs li. The intersection of arc li and path is the turning point of path. Path planning is a set pi=p1,p2,…,pm for finding turning points. There are no turning points between ships and adjacent areas. The maximum distance applicable to the ship field (the visibility distance of the light signal) is 6 n miles. When the distance between the two ships is greater than 6 n miles, any action taken by the ship will not violate the rules [11, 12]. The provisions on ship collision avoidance are not applicable at this time and there is no need for collision avoidance. Therefore, the target ship is expanded into a circular field with a radius of 6 n miles, and the navigation path of the ship is statically planned beyond 6 n miles. The schematic diagram of path planning in polar coordinates is shown in Figure 2 [13].Figure 2
Schematic diagram of path planning in polar coordinates.The coordinates of thei-th turning point pi can be represented by Rpi,θpi. At the same time, through Figure 2, it is found that the relationship between polar diameter Rpi and polar angle θpi is as follows [14]:(1)θpi=∑i=0mΔθpi,Rpi=i⋅SGm+1,where Δθpi is the steering angle of the i-th steering point. It can be seen from equation (1) that the turning point on the path can be uniquely determined by its serial number and turning angle. Considering that the main collision avoidance action of the crew during ship navigation is steering collision avoidance, a candidate path can be expressed by the steering angle of the steering point on this path:(2)pi=Δθp1,Δθp2,…,Δθpm.In this way, the path planning is transformed into the planning of steering angle, which is beneficial to the dynamic correction of collision avoidance path.


### 3.2. Path Planning Based on Particle Swarm Optimization

#### 3.2.1. Basic Principle of Particle Swarm Optimization Algorithm

Particle swarm optimization is an intelligent swarm optimization algorithm [15]. The predator-prey behavior of birds is simulated, and the speed and position search model is adopted. Each particle is an alternative solution, and the quality of the solution is determined by the fitness. Particle swarm optimization algorithm randomly initializes n particles, and each particle has m dimensions [16]. The position of the ii=1,2,…,n-th particle in the m-dimensional solution space is xi=xi,1,xi,2,…,xi,m. Each iterative particle obtains the individual optimal value Pbesti and the group optimal value Gbest according to its own flight experience to determine its speed, adjust its position, and gradually move closer to the optimal particle. The velocity of the i-th particle is [1](3)vi=vi,1,vi,2,…,vi,m.The update formula of particle velocity and position is as follows:(4)vi,jt+1=ω⋅vi,jt+c1r1pi,jt−xi,jtΔt+c2r2pg,jt−xi,jtΔt,xi,jt+1=xi,jt+vi,jt+1Δt,where vi,jt+1 and xi,jt+1, respectively, represent the velocity and position of the j-dimensional j=1,2,…,m component of particle i at time t; pi,jt is the optimal position searched by the j-dimensional component of particle i at time t; pg,jt represents the optimal position searched by the j-dimensional component of all particles at time t; Δt is the unit time; c1 and c2 are the acceleration constants, which represent the propulsion acceleration weight of the particle to its own optimal position and global optimal position; r1 and r2 are random numbers, generally between (0, 1); and ω is the inertia weight. If ω is large, the global search ability is strong; if ω is small, the local search ability is strong, and ω decreases linearly with the number of iterations. The value of ω is generally between 0.4 and 0.9.


#### 3.2.2. Algorithm Implementation

Select a turning pointpi (pi must be a free point) on the arc li of article i. In order to ensure the safety of navigation, the selection of pi must meet several conditions:(1)
Within the value range ofli.(2)
Not in the territory of any obstacle ship.(3)
The connection betweenpi and its chosen point on the adjacent arc li−1 cannot intersect the domain of any obstacle ship.In order to meet these three conditions, the value range ofpi on li is set from the intersection of arc and chart to the intersection of arc and obstacle ship, and the value range should be set in advance during particle initialization; secondly, the distance from the connecting line between two adjacent points to the center of the circle should be greater than the radius of the obstacle ship. Starting from the starting point S, connect the points on the arc in turn to reach the target point G, that is, get a planned path, and then optimize the path, that is, get the global optimal path [17].Considering the economy of navigation, the result of path planning is that the navigation distance is expected to be as short as possible, so the fitness function is selected as the navigation path, as follows:(5)Fx=lp=lsp1+∑i=1m−1lpipi+1+lpmG=∑i=0mlpipi+1.Specific steps [18]:Step1. Initialize particle number n and particle latitude m. Initialize particle pi, and the historical optimal value of each particle is its own Pbesti. Calculate the fitness value of each particle and select the particle with the smallest fitness value as the global optimal value Gbest.Step 2. Update the velocity and position of particles by equation (4).Step 3. For each particle pi, calculate the fitness value. If the fitness value is smaller than the fitness value of Pbesti, then Pbesti=pi.Step 4. Go to step 2 to iterate until the accuracy or iteration number requirements are met.


### 3.3. Dynamic Correction Algorithm of Collision Avoidance Path for Navigation Rule Reasoning

#### 3.3.1. Basic Idea

According to the research, the most maneuvering behavior of ship collision avoidance is steering collision avoidance. This paper adopts the way of steering collision avoidance. Firstly, the ship regards the obstacle ship as a static obstacle and carries out path planning in the static environment to obtain the optimal turning point setpi. After planning the initial path, the ship navigates along the planned turning point of the initial path. Each point will judge the distance DT between the next turning point pi+1 and the nearest obstacle ship and judge whether the ship has collision risk in pi+1. If DT is greater than the safe encounter distance of the ship, there is no risk of collision. There is no need to correct the turning point and continue to sail along the initially planned turning point. When DT is less than the safe encounter distance of the ship, determine the encounter state, collision avoidance mode, and steering angle h according to the collision avoidance rules, so as to adjust the steering angle Δθ to the next turning point pi+1, obtain the new next turning point pnewi+1, and update the latest turning point to the dynamic correction path set pnewi. pnewi is the ship’s dynamic collision avoidance path.


#### 3.3.2. Rule Design

The second chapter of navigation rules is the focus of collision avoidance research. Among them, there are clear restrictions on various encounter situations and ship collision avoidance, which provides guidelines for our collision avoidance research work. Among them, keeping a safe distance between ships and other obstacles is an important factor to improve maritime safety. However, maintaining a continuous safe distance between two ships is also an important factor to reduce the risk of collision in the case of overtaking and collision. Therefore, Section 13 of the rules also emphasizes the maintenance of the safe distance between two ships in case of overtaking and collision. The cross meeting of two ships is another encounter situation with great collision risk in maritime navigation. According to the requirements of the rules, the ship shall take actions as soon as possible to avoid the dangerous situation of starboard to starboard and try to avoid passing through the port side through the port side. These cross encounters are clearly described in Section 15 of the rules. According to the rules, ships coming from the starboard side enjoy higher navigation priority, which are called direct ships. Ships from the port side have lower navigational priority and are called yield ships. When considering the collision situation, if the giving way ship does not take any appropriate action to avoid the collision in accordance with the requirements of Section 17 of the rules, the direct ship must take appropriate action to avoid the collision. However, the collision avoidance scheme also depends on the characteristics of ship maneuverability. Therefore, in these key collision situations, the ship’s collision avoidance decision-making process should be carefully formulated. Some wrong decisions may lead to collision due to the lack of deceleration and stopping distance. Therefore, the stopping distance of the ship and the characteristics of the steering circle should be considered in the collision avoidance decision making. In addition, in Section 8 of the rules, it is also emphasized that the operation of changing the ship’s course and speed at sea to avoid collision must be easily observed by other ships’ vision or radar. The above rules are important rules that must be observed in the process of ship collision avoidance [19].The design of dynamic collision avoidance rules takes into account the sudden nature of ship collision avoidance scene, adopts the method of forward reasoning, and designs the rule base as a five-input and two-output model, which reduces the thinking process and enhances the timeliness. Among them, the input includesθT, indicating the side angle of the obstacle ship relative to the ship at the next turning point; ∠A is the speed angle between the ship and the obstacle ship; DT is the distance between the ship and the nearest obstacle ship at the next turning point; v0 and vt represent the speed of the ship and the obstacle ship; the output O is the type adjusted by the ship according to the dynamic obstacle on the global path; and Δφ is the adjustment amount of the ship’s heading at the next track point. The polar angle of the turning point can be updated by the following equation:(6)θpnewi+1=θpi+Δθpi+Δφ.First, divide the collision avoidance area according to the collision avoidance rulesθT. According to the meeting of two ships in the mutual meeting of rules, the action situation is divided into six areas: A, B, C, D, E, and F, as shown in Figure 3. For ships coming from area A, the ship should take collision avoidance action of turning right. For ships coming from area B, the ship is a yield ship with large relative orientation, so turn left. For ships in areas C, D, and E, the ship is a direct ship, and the ship does not need to take action. The vessel coming from area F should turn right.Figure 3
Division of maneuvering situation between two ships.The best steering angle of the giving way ship can be obtained from equations (7) and (8):(7)Δφ=maxθT,arcsin0.25−∠S′+θT,where(8)∠S'=arcsinvTsin∠A+Δφv02+vT2−2v0vT∠A+Δφ.The safe passage distance is divided according to different encounter situations. The corresponding safe passage distance is determined by determining different encounter situations. Table1 shows the corresponding table between the safe passage distance of ships in open water and each division.Table 1
Corresponding table of safe passage distance and zoning of ships.
Encounter situationSafety distance (n miles)Corresponding partitionRight encounter1.07F zoneCrossing situation1.0A, B, and E zonesBeing chased0.65C and D zonesThrough the study of encounter situation, steering collision avoidance angle, and safety distance, the ship dynamic collision avoidance rule base shown in Table2 is obtained.Table 2
Ship dynamic collision avoidance rule base.
IfElse ifThen−5<θT<5DT<1.07Turn rightΔφ5<θT<67.5DT<1Turn rightΔφ67.5<θT<112.5DT<1Turn leftΔφ112.5<θT<247.5DT<0.65Turn rightΔφ247.5<θT<355DT<1Turn rightΔφThe above rules are analyzed and sorted according to the ship navigation rules and the ship collision avoidance decision, and the input and output are corresponding one by one to dynamically correct the turning point of the initial path, which can solve various situations in the process of ship encounter and obtain a new dynamic collision avoidance path [20].


#### 3.3.3. Specific Steps

Step 1. The optimal set of path turning points Pi in the initial static state is obtained by particle swarm optimization algorithm. Initialize the dynamic collision avoidance path turning point set pnewi pnewii=1,2,…,m. m is the number of turning points and obstacle boats Tjj=1,2,…,n. n is the number of obstacle ships. Let i=1 and use i to traverse the optimal path turning point pi and point to the next turning point. Let j=1 and use j to traverse the number of obstacle ships.Step 2. If i>m, turn to Step 6. Obtain the next turning point pi+1 of the initial static path, the next turning point of the ship sailing in the dynamic environment is pnewi+1, and initialize pnewi=pi+1.Step 3. If j>n, turn to Step 5. Obtain navigation information of obstacle ship. If the distance DTj at turning point pi+1 (indicating the distance from the obstacle ship in article j) is greater than the safe distance, make j=j+1 and turn to Step 3.Step 4. The current track point of the ship is pi, and the next track point pi+1 is in danger of collision with the obstacle ship Tj. Determine the input values of the rule base to obtain the correct collision avoidance decision output O and a new pnewi+1.Step 5. Let i=i+1, add pnewi+1 to the dynamic turning point set pnewi, and go to Step 2.Step 6. At the end of the algorithm, the route points of the ship are saved in pnewi.


## 3.1. Problem Description and Modeling

For ships, path planning is to find the set of turning points for their navigation in the ocean. Since most of the main collision avoidance operations are turning operations, the particle swarm optimization path planning modeling method based on polar coordinate space is adopted:S is the starting point, G is the target point, S is the origin, and the connecting line between S and G is used as the polar axis to establish the polar coordinate system. Divide SG by m+1 to obtain segment m+1 with interval length of SGm+1. Make a circle with the connecting line from each bisection point to s as the radius to obtain a series of concentric arcs li. The intersection of arc li and path is the turning point of path. Path planning is a set pi=p1,p2,…,pm for finding turning points. There are no turning points between ships and adjacent areas. The maximum distance applicable to the ship field (the visibility distance of the light signal) is 6 n miles. When the distance between the two ships is greater than 6 n miles, any action taken by the ship will not violate the rules [11, 12]. The provisions on ship collision avoidance are not applicable at this time and there is no need for collision avoidance. Therefore, the target ship is expanded into a circular field with a radius of 6 n miles, and the navigation path of the ship is statically planned beyond 6 n miles. The schematic diagram of path planning in polar coordinates is shown in Figure 2 [13].Figure 2
Schematic diagram of path planning in polar coordinates.The coordinates of thei-th turning point pi can be represented by Rpi,θpi. At the same time, through Figure 2, it is found that the relationship between polar diameter Rpi and polar angle θpi is as follows [14]:(1)θpi=∑i=0mΔθpi,Rpi=i⋅SGm+1,where Δθpi is the steering angle of the i-th steering point. It can be seen from equation (1) that the turning point on the path can be uniquely determined by its serial number and turning angle. Considering that the main collision avoidance action of the crew during ship navigation is steering collision avoidance, a candidate path can be expressed by the steering angle of the steering point on this path:(2)pi=Δθp1,Δθp2,…,Δθpm.In this way, the path planning is transformed into the planning of steering angle, which is beneficial to the dynamic correction of collision avoidance path.


## 3.2. Path Planning Based on Particle Swarm Optimization

### 3.2.1. Basic Principle of Particle Swarm Optimization Algorithm

Particle swarm optimization is an intelligent swarm optimization algorithm [15]. The predator-prey behavior of birds is simulated, and the speed and position search model is adopted. Each particle is an alternative solution, and the quality of the solution is determined by the fitness. Particle swarm optimization algorithm randomly initializes n particles, and each particle has m dimensions [16]. The position of the ii=1,2,…,n-th particle in the m-dimensional solution space is xi=xi,1,xi,2,…,xi,m. Each iterative particle obtains the individual optimal value Pbesti and the group optimal value Gbest according to its own flight experience to determine its speed, adjust its position, and gradually move closer to the optimal particle. The velocity of the i-th particle is [1](3)vi=vi,1,vi,2,…,vi,m.The update formula of particle velocity and position is as follows:(4)vi,jt+1=ω⋅vi,jt+c1r1pi,jt−xi,jtΔt+c2r2pg,jt−xi,jtΔt,xi,jt+1=xi,jt+vi,jt+1Δt,where vi,jt+1 and xi,jt+1, respectively, represent the velocity and position of the j-dimensional j=1,2,…,m component of particle i at time t; pi,jt is the optimal position searched by the j-dimensional component of particle i at time t; pg,jt represents the optimal position searched by the j-dimensional component of all particles at time t; Δt is the unit time; c1 and c2 are the acceleration constants, which represent the propulsion acceleration weight of the particle to its own optimal position and global optimal position; r1 and r2 are random numbers, generally between (0, 1); and ω is the inertia weight. If ω is large, the global search ability is strong; if ω is small, the local search ability is strong, and ω decreases linearly with the number of iterations. The value of ω is generally between 0.4 and 0.9.


### 3.2.2. Algorithm Implementation

Select a turning pointpi (pi must be a free point) on the arc li of article i. In order to ensure the safety of navigation, the selection of pi must meet several conditions:(1)
Within the value range ofli.(2)
Not in the territory of any obstacle ship.(3)
The connection betweenpi and its chosen point on the adjacent arc li−1 cannot intersect the domain of any obstacle ship.In order to meet these three conditions, the value range ofpi on li is set from the intersection of arc and chart to the intersection of arc and obstacle ship, and the value range should be set in advance during particle initialization; secondly, the distance from the connecting line between two adjacent points to the center of the circle should be greater than the radius of the obstacle ship. Starting from the starting point S, connect the points on the arc in turn to reach the target point G, that is, get a planned path, and then optimize the path, that is, get the global optimal path [17].Considering the economy of navigation, the result of path planning is that the navigation distance is expected to be as short as possible, so the fitness function is selected as the navigation path, as follows:(5)Fx=lp=lsp1+∑i=1m−1lpipi+1+lpmG=∑i=0mlpipi+1.Specific steps [18]:Step1. Initialize particle number n and particle latitude m. Initialize particle pi, and the historical optimal value of each particle is its own Pbesti. Calculate the fitness value of each particle and select the particle with the smallest fitness value as the global optimal value Gbest.Step 2. Update the velocity and position of particles by equation (4).Step 3. For each particle pi, calculate the fitness value. If the fitness value is smaller than the fitness value of Pbesti, then Pbesti=pi.Step 4. Go to step 2 to iterate until the accuracy or iteration number requirements are met.


## 3.2.1. Basic Principle of Particle Swarm Optimization Algorithm

Particle swarm optimization is an intelligent swarm optimization algorithm [15]. The predator-prey behavior of birds is simulated, and the speed and position search model is adopted. Each particle is an alternative solution, and the quality of the solution is determined by the fitness. Particle swarm optimization algorithm randomly initializes n particles, and each particle has m dimensions [16]. The position of the ii=1,2,…,n-th particle in the m-dimensional solution space is xi=xi,1,xi,2,…,xi,m. Each iterative particle obtains the individual optimal value Pbesti and the group optimal value Gbest according to its own flight experience to determine its speed, adjust its position, and gradually move closer to the optimal particle. The velocity of the i-th particle is [1](3)vi=vi,1,vi,2,…,vi,m.The update formula of particle velocity and position is as follows:(4)vi,jt+1=ω⋅vi,jt+c1r1pi,jt−xi,jtΔt+c2r2pg,jt−xi,jtΔt,xi,jt+1=xi,jt+vi,jt+1Δt,where vi,jt+1 and xi,jt+1, respectively, represent the velocity and position of the j-dimensional j=1,2,…,m component of particle i at time t; pi,jt is the optimal position searched by the j-dimensional component of particle i at time t; pg,jt represents the optimal position searched by the j-dimensional component of all particles at time t; Δt is the unit time; c1 and c2 are the acceleration constants, which represent the propulsion acceleration weight of the particle to its own optimal position and global optimal position; r1 and r2 are random numbers, generally between (0, 1); and ω is the inertia weight. If ω is large, the global search ability is strong; if ω is small, the local search ability is strong, and ω decreases linearly with the number of iterations. The value of ω is generally between 0.4 and 0.9.


## 3.2.2. Algorithm Implementation

Select a turning pointpi (pi must be a free point) on the arc li of article i. In order to ensure the safety of navigation, the selection of pi must meet several conditions:(1)
Within the value range ofli.(2)
Not in the territory of any obstacle ship.(3)
The connection betweenpi and its chosen point on the adjacent arc li−1 cannot intersect the domain of any obstacle ship.In order to meet these three conditions, the value range ofpi on li is set from the intersection of arc and chart to the intersection of arc and obstacle ship, and the value range should be set in advance during particle initialization; secondly, the distance from the connecting line between two adjacent points to the center of the circle should be greater than the radius of the obstacle ship. Starting from the starting point S, connect the points on the arc in turn to reach the target point G, that is, get a planned path, and then optimize the path, that is, get the global optimal path [17].Considering the economy of navigation, the result of path planning is that the navigation distance is expected to be as short as possible, so the fitness function is selected as the navigation path, as follows:(5)Fx=lp=lsp1+∑i=1m−1lpipi+1+lpmG=∑i=0mlpipi+1.Specific steps [18]:Step1. Initialize particle number n and particle latitude m. Initialize particle pi, and the historical optimal value of each particle is its own Pbesti. Calculate the fitness value of each particle and select the particle with the smallest fitness value as the global optimal value Gbest.Step 2. Update the velocity and position of particles by equation (4).Step 3. For each particle pi, calculate the fitness value. If the fitness value is smaller than the fitness value of Pbesti, then Pbesti=pi.Step 4. Go to step 2 to iterate until the accuracy or iteration number requirements are met.


## 3.3. Dynamic Correction Algorithm of Collision Avoidance Path for Navigation Rule Reasoning

### 3.3.1. Basic Idea

According to the research, the most maneuvering behavior of ship collision avoidance is steering collision avoidance. This paper adopts the way of steering collision avoidance. Firstly, the ship regards the obstacle ship as a static obstacle and carries out path planning in the static environment to obtain the optimal turning point setpi. After planning the initial path, the ship navigates along the planned turning point of the initial path. Each point will judge the distance DT between the next turning point pi+1 and the nearest obstacle ship and judge whether the ship has collision risk in pi+1. If DT is greater than the safe encounter distance of the ship, there is no risk of collision. There is no need to correct the turning point and continue to sail along the initially planned turning point. When DT is less than the safe encounter distance of the ship, determine the encounter state, collision avoidance mode, and steering angle h according to the collision avoidance rules, so as to adjust the steering angle Δθ to the next turning point pi+1, obtain the new next turning point pnewi+1, and update the latest turning point to the dynamic correction path set pnewi. pnewi is the ship’s dynamic collision avoidance path.


### 3.3.2. Rule Design

The second chapter of navigation rules is the focus of collision avoidance research. Among them, there are clear restrictions on various encounter situations and ship collision avoidance, which provides guidelines for our collision avoidance research work. Among them, keeping a safe distance between ships and other obstacles is an important factor to improve maritime safety. However, maintaining a continuous safe distance between two ships is also an important factor to reduce the risk of collision in the case of overtaking and collision. Therefore, Section 13 of the rules also emphasizes the maintenance of the safe distance between two ships in case of overtaking and collision. The cross meeting of two ships is another encounter situation with great collision risk in maritime navigation. According to the requirements of the rules, the ship shall take actions as soon as possible to avoid the dangerous situation of starboard to starboard and try to avoid passing through the port side through the port side. These cross encounters are clearly described in Section 15 of the rules. According to the rules, ships coming from the starboard side enjoy higher navigation priority, which are called direct ships. Ships from the port side have lower navigational priority and are called yield ships. When considering the collision situation, if the giving way ship does not take any appropriate action to avoid the collision in accordance with the requirements of Section 17 of the rules, the direct ship must take appropriate action to avoid the collision. However, the collision avoidance scheme also depends on the characteristics of ship maneuverability. Therefore, in these key collision situations, the ship’s collision avoidance decision-making process should be carefully formulated. Some wrong decisions may lead to collision due to the lack of deceleration and stopping distance. Therefore, the stopping distance of the ship and the characteristics of the steering circle should be considered in the collision avoidance decision making. In addition, in Section 8 of the rules, it is also emphasized that the operation of changing the ship’s course and speed at sea to avoid collision must be easily observed by other ships’ vision or radar. The above rules are important rules that must be observed in the process of ship collision avoidance [19].The design of dynamic collision avoidance rules takes into account the sudden nature of ship collision avoidance scene, adopts the method of forward reasoning, and designs the rule base as a five-input and two-output model, which reduces the thinking process and enhances the timeliness. Among them, the input includesθT, indicating the side angle of the obstacle ship relative to the ship at the next turning point; ∠A is the speed angle between the ship and the obstacle ship; DT is the distance between the ship and the nearest obstacle ship at the next turning point; v0 and vt represent the speed of the ship and the obstacle ship; the output O is the type adjusted by the ship according to the dynamic obstacle on the global path; and Δφ is the adjustment amount of the ship’s heading at the next track point. The polar angle of the turning point can be updated by the following equation:(6)θpnewi+1=θpi+Δθpi+Δφ.First, divide the collision avoidance area according to the collision avoidance rulesθT. According to the meeting of two ships in the mutual meeting of rules, the action situation is divided into six areas: A, B, C, D, E, and F, as shown in Figure 3. For ships coming from area A, the ship should take collision avoidance action of turning right. For ships coming from area B, the ship is a yield ship with large relative orientation, so turn left. For ships in areas C, D, and E, the ship is a direct ship, and the ship does not need to take action. The vessel coming from area F should turn right.Figure 3
Division of maneuvering situation between two ships.The best steering angle of the giving way ship can be obtained from equations (7) and (8):(7)Δφ=maxθT,arcsin0.25−∠S′+θT,where(8)∠S'=arcsinvTsin∠A+Δφv02+vT2−2v0vT∠A+Δφ.The safe passage distance is divided according to different encounter situations. The corresponding safe passage distance is determined by determining different encounter situations. Table1 shows the corresponding table between the safe passage distance of ships in open water and each division.Table 1
Corresponding table of safe passage distance and zoning of ships.
Encounter situationSafety distance (n miles)Corresponding partitionRight encounter1.07F zoneCrossing situation1.0A, B, and E zonesBeing chased0.65C and D zonesThrough the study of encounter situation, steering collision avoidance angle, and safety distance, the ship dynamic collision avoidance rule base shown in Table2 is obtained.Table 2
Ship dynamic collision avoidance rule base.
IfElse ifThen−5<θT<5DT<1.07Turn rightΔφ5<θT<67.5DT<1Turn rightΔφ67.5<θT<112.5DT<1Turn leftΔφ112.5<θT<247.5DT<0.65Turn rightΔφ247.5<θT<355DT<1Turn rightΔφThe above rules are analyzed and sorted according to the ship navigation rules and the ship collision avoidance decision, and the input and output are corresponding one by one to dynamically correct the turning point of the initial path, which can solve various situations in the process of ship encounter and obtain a new dynamic collision avoidance path [20].


### 3.3.3. Specific Steps

Step 1. The optimal set of path turning points Pi in the initial static state is obtained by particle swarm optimization algorithm. Initialize the dynamic collision avoidance path turning point set pnewi pnewii=1,2,…,m. m is the number of turning points and obstacle boats Tjj=1,2,…,n. n is the number of obstacle ships. Let i=1 and use i to traverse the optimal path turning point pi and point to the next turning point. Let j=1 and use j to traverse the number of obstacle ships.Step 2. If i>m, turn to Step 6. Obtain the next turning point pi+1 of the initial static path, the next turning point of the ship sailing in the dynamic environment is pnewi+1, and initialize pnewi=pi+1.Step 3. If j>n, turn to Step 5. Obtain navigation information of obstacle ship. If the distance DTj at turning point pi+1 (indicating the distance from the obstacle ship in article j) is greater than the safe distance, make j=j+1 and turn to Step 3.Step 4. The current track point of the ship is pi, and the next track point pi+1 is in danger of collision with the obstacle ship Tj. Determine the input values of the rule base to obtain the correct collision avoidance decision output O and a new pnewi+1.Step 5. Let i=i+1, add pnewi+1 to the dynamic turning point set pnewi, and go to Step 2.Step 6. At the end of the algorithm, the route points of the ship are saved in pnewi.


## 3.3.1. Basic Idea

According to the research, the most maneuvering behavior of ship collision avoidance is steering collision avoidance. This paper adopts the way of steering collision avoidance. Firstly, the ship regards the obstacle ship as a static obstacle and carries out path planning in the static environment to obtain the optimal turning point setpi. After planning the initial path, the ship navigates along the planned turning point of the initial path. Each point will judge the distance DT between the next turning point pi+1 and the nearest obstacle ship and judge whether the ship has collision risk in pi+1. If DT is greater than the safe encounter distance of the ship, there is no risk of collision. There is no need to correct the turning point and continue to sail along the initially planned turning point. When DT is less than the safe encounter distance of the ship, determine the encounter state, collision avoidance mode, and steering angle h according to the collision avoidance rules, so as to adjust the steering angle Δθ to the next turning point pi+1, obtain the new next turning point pnewi+1, and update the latest turning point to the dynamic correction path set pnewi. pnewi is the ship’s dynamic collision avoidance path.


## 3.3.2. Rule Design

The second chapter of navigation rules is the focus of collision avoidance research. Among them, there are clear restrictions on various encounter situations and ship collision avoidance, which provides guidelines for our collision avoidance research work. Among them, keeping a safe distance between ships and other obstacles is an important factor to improve maritime safety. However, maintaining a continuous safe distance between two ships is also an important factor to reduce the risk of collision in the case of overtaking and collision. Therefore, Section 13 of the rules also emphasizes the maintenance of the safe distance between two ships in case of overtaking and collision. The cross meeting of two ships is another encounter situation with great collision risk in maritime navigation. According to the requirements of the rules, the ship shall take actions as soon as possible to avoid the dangerous situation of starboard to starboard and try to avoid passing through the port side through the port side. These cross encounters are clearly described in Section 15 of the rules. According to the rules, ships coming from the starboard side enjoy higher navigation priority, which are called direct ships. Ships from the port side have lower navigational priority and are called yield ships. When considering the collision situation, if the giving way ship does not take any appropriate action to avoid the collision in accordance with the requirements of Section 17 of the rules, the direct ship must take appropriate action to avoid the collision. However, the collision avoidance scheme also depends on the characteristics of ship maneuverability. Therefore, in these key collision situations, the ship’s collision avoidance decision-making process should be carefully formulated. Some wrong decisions may lead to collision due to the lack of deceleration and stopping distance. Therefore, the stopping distance of the ship and the characteristics of the steering circle should be considered in the collision avoidance decision making. In addition, in Section 8 of the rules, it is also emphasized that the operation of changing the ship’s course and speed at sea to avoid collision must be easily observed by other ships’ vision or radar. The above rules are important rules that must be observed in the process of ship collision avoidance [19].The design of dynamic collision avoidance rules takes into account the sudden nature of ship collision avoidance scene, adopts the method of forward reasoning, and designs the rule base as a five-input and two-output model, which reduces the thinking process and enhances the timeliness. Among them, the input includesθT, indicating the side angle of the obstacle ship relative to the ship at the next turning point; ∠A is the speed angle between the ship and the obstacle ship; DT is the distance between the ship and the nearest obstacle ship at the next turning point; v0 and vt represent the speed of the ship and the obstacle ship; the output O is the type adjusted by the ship according to the dynamic obstacle on the global path; and Δφ is the adjustment amount of the ship’s heading at the next track point. The polar angle of the turning point can be updated by the following equation:(6)θpnewi+1=θpi+Δθpi+Δφ.First, divide the collision avoidance area according to the collision avoidance rulesθT. According to the meeting of two ships in the mutual meeting of rules, the action situation is divided into six areas: A, B, C, D, E, and F, as shown in Figure 3. For ships coming from area A, the ship should take collision avoidance action of turning right. For ships coming from area B, the ship is a yield ship with large relative orientation, so turn left. For ships in areas C, D, and E, the ship is a direct ship, and the ship does not need to take action. The vessel coming from area F should turn right.Figure 3
Division of maneuvering situation between two ships.The best steering angle of the giving way ship can be obtained from equations (7) and (8):(7)Δφ=maxθT,arcsin0.25−∠S′+θT,where(8)∠S'=arcsinvTsin∠A+Δφv02+vT2−2v0vT∠A+Δφ.The safe passage distance is divided according to different encounter situations. The corresponding safe passage distance is determined by determining different encounter situations. Table1 shows the corresponding table between the safe passage distance of ships in open water and each division.Table 1
Corresponding table of safe passage distance and zoning of ships.
Encounter situationSafety distance (n miles)Corresponding partitionRight encounter1.07F zoneCrossing situation1.0A, B, and E zonesBeing chased0.65C and D zonesThrough the study of encounter situation, steering collision avoidance angle, and safety distance, the ship dynamic collision avoidance rule base shown in Table2 is obtained.Table 2
Ship dynamic collision avoidance rule base.
IfElse ifThen−5<θT<5DT<1.07Turn rightΔφ5<θT<67.5DT<1Turn rightΔφ67.5<θT<112.5DT<1Turn leftΔφ112.5<θT<247.5DT<0.65Turn rightΔφ247.5<θT<355DT<1Turn rightΔφThe above rules are analyzed and sorted according to the ship navigation rules and the ship collision avoidance decision, and the input and output are corresponding one by one to dynamically correct the turning point of the initial path, which can solve various situations in the process of ship encounter and obtain a new dynamic collision avoidance path [20].


## 3.3.3. Specific Steps

Step 1. The optimal set of path turning points Pi in the initial static state is obtained by particle swarm optimization algorithm. Initialize the dynamic collision avoidance path turning point set pnewi pnewii=1,2,…,m. m is the number of turning points and obstacle boats Tjj=1,2,…,n. n is the number of obstacle ships. Let i=1 and use i to traverse the optimal path turning point pi and point to the next turning point. Let j=1 and use j to traverse the number of obstacle ships.Step 2. If i>m, turn to Step 6. Obtain the next turning point pi+1 of the initial static path, the next turning point of the ship sailing in the dynamic environment is pnewi+1, and initialize pnewi=pi+1.Step 3. If j>n, turn to Step 5. Obtain navigation information of obstacle ship. If the distance DTj at turning point pi+1 (indicating the distance from the obstacle ship in article j) is greater than the safe distance, make j=j+1 and turn to Step 3.Step 4. The current track point of the ship is pi, and the next track point pi+1 is in danger of collision with the obstacle ship Tj. Determine the input values of the rule base to obtain the correct collision avoidance decision output O and a new pnewi+1.Step 5. Let i=i+1, add pnewi+1 to the dynamic turning point set pnewi, and go to Step 2.Step 6. At the end of the algorithm, the route points of the ship are saved in pnewi.


## 4. Result Analysis

In order to verify the effect of the algorithm, simulation experiments are carried out on the computer [21]. The current position point of the ship is point S, and the target track point is point G in the due east direction. The two points meet 36 n miles, so that the heading in the due east direction is 0°, and clockwise is the positive direction. The position coordinates and heading of each obstacle ship relative to the ship are shown in Table 3. The speed of this ship and obstacle ship is 12n, and each obstacle ship runs according to the navigation rules. The parameters of particle swarm optimization algorithm are set to c1=c2=1.5, ω=0.9, the number of population is n = 15, and the maximum number of iterations is set to 50.Table 3
Obstacle ship data.
Obstacle ship no.Pole diameter (n/mile)Polar angle (°)Heading (°)T1123060T2240180The path of the initial state is planned to obtain the turning point of the initial path. The ship navigates along the turning point for dynamic collision avoidance. When the sailing distance between two ships is less than the safe collision avoidance distance, it turns according to the collision avoidance rule base, so as to change the next turning point and obtain the new turning point coordinates.In order to facilitate the display of the path in the chart, use equation (9) to convert the turning point in polar coordinates into rectangular coordinates.(9)xy=cosαsinα−sinαcosα⋅RpcosθpRpsinθp,where α is the included angle between the polar axis and the rectangular coordinate x axis, which is 0°.The simulation results on MATLAB are shown in Figure4. The dotted line is the path planned in the static state; the solid line is the path of dynamic adjustment; the circle is the ship field in the initial state; the direction of the arrow is the movement direction of the obstacle ship.Figure 4
Path planning in rectangular coordinates.The iteration diagram of particle swarm optimization algorithm is shown in Figure5. It can be seen that in the initial state, particle swarm optimization algorithm can quickly find an optimal path. The shortest path is 38.4 n miles, which is obtained in about 35 iterations.Figure 5
Schematic diagram of particle swarm iteration.


## 5. Conclusion

This paper uses particle swarm optimization algorithm combined with ship field and ship navigation rules to carry out step-by-step multi-ship collision avoidance path planning, which provides a new idea for multi-ship collision avoidance auxiliary decision making. This idea solves the problem that the collision avoidance algorithm is difficult to combine with the navigation rules. The simulation results show that the algorithm has good collision avoidance effect and can truly realize multi-ship dynamic collision avoidance.



---

*Source: 5360674-2022-06-24.xml*