MULTI-VESSELS COLLISION AVOIDANCE STRATEGY FOR AUTONOMOUS SURFACE VEHICLES BASED ON GENETIC ALGORITHM IN CONGESTED PORT ENVIRONMENT

Summary An improved genetic collision avoidance algorithm is proposed in this study to address the problem that Autonomous Surface Vehicles (ASV) need to comply with the collision avoidance rules at sea in congested sea areas. Firstly, a collision risk index model for ASV safe encounters is established taking into account the international rules for collision avoidance. The ASV collision risk index and the distance of safe encounters are taken as boundary values of the correlation membership function of the collision risk index model to calculate the optimal heading of ASV in real-time. Secondly, the genetic coding, fitness function, and basic parameters of the genetic algorithm are designed to construct the collision avoidance decision system. Finally, the simulation of collision avoidance between ASV and several obstacle vessels is performed, including the simulation of three collision avoidance states head-on situation, crossing situation, and overtaking situation. The results show that the proposed intelligent genetic algorithm considering the rules of collision avoidance at sea can effectively avoid multiple other vessels in different situations.


Introduction
With the development of the international economy and the prosperity of maritime trade, the density of ships at sea has kept increasing. This adds difficulty to the autonomous navigation of the ASV, which is a typical unmanned intelligent operation system at sea, which includes a control system [1], navigation system [2][3], communication system [4], route planning system [5], and so on. ASV has the advantages of low-cost, flexibility [6], and low risk of casualties. It has attracted widespread attention in the fields of military, civilian, and scientific research. However, due to the nonlinear characteristics of the hull hydrodynamics 70 [7], the technology of ASV collision avoidance is not perfect. Especially in waterways [8] and offshore areas, where there are many ships, ASVs will face a greater collision risk index [9][10][11]. In order to expand its operating range and improve its safety, this paper proposes an intelligent genetic collision avoidance algorithm considering maritime collision avoidance rules.
The Convention on International Regulations for the Prevention of Collisions at Sea (COLREGs) has been an agreement among seafarers to avoid collisions at sea since the IMO revised Convention on the Law of the Sea entered into force in 1995 [12][13]. These rules are not precise IF-THEN type algorithms but are intended to be open for human judgment and interpretation. It is to ensure the safety of navigation of ships, prevent and reduce collision of ships, provisions on the high seas and all navigable waters connected to the high seas to comply with the common maritime traffic rules. In an environment where autonomous vehicles interact with other autonomous vehicles individually, as long as the interaction is consistent and efficient, different protocols can be used [14]. In the face of these problems, in 2006, Zou et al. [15] applied the idea of genetic algorithm to the research of steering collision avoidance of ASV in collision avoidance decision-making. In 2014, Wu [16] proposed a global path planning for maritime ASV considering risk factors and an autonomous real-time collision avoidance algorithm based on maneuvering motion characteristics. In 2015, Liu et al. [17] proposed a Fast-Moving (FM)-based method to ensure that the planned trajectory does not enter any restricted areas in the shipping area and collision avoidance area. In 2016, Liu [18] established a ship collision risk assessment model and collision avoidance decisionmaking based on optimized bacterial foraging algorithms. In 2017, Ni [19] et al. proposed collision-avoidance decision-making for ASV based on a multi-group genetic algorithm. In 2019, Zhu [20] et al. proposed a collision-avoidance decision-making method for ships based on the Coldwell domain model. In 2018, Liu et al. [21] established a domain model of static obstructions and a dynamic domain model of ships and derived a quantitative model of collision risk index. In 2019, Guo [22] combined the rolling optimization window method with the improved ant colony optimization algorithm, and obtained the view method to construct the local environment model, and verified the convergence and stability of the ASV's local static collision avoidance through simulation. These literatures provide the latest intelligent collision avoidance algorithms and collision avoidance decision-making methods.
In 2013, Tam et al. [23] calculated a practical navigation path that complied with the COLREGs standard for the colliding ship and proposed a deterministic path planning algorithm. In 2018, Ma et al. [24] studied the path planning of ASV in the presence of obstacles and currents. In 2019,Abilio et al. [25] used a cognitive model to classify collision avoidance tasks through hierarchical task analysis and proposed an analysis method for collision avoidance tasks. In 2015, Zhang et al. [14] studied a distributed, real-time multi-ship collision avoidance decision support formula under the requirements of COLREGs rules. In 2014, Savvaris et al. [26] introduced the development overview of the C-Enduro ASV and the collision avoidance algorithm of the sensory collision avoidance system. In 2018, Liu et al. [27] have designed and developed a novel algorithm based on self-organizing map (SOM) in terms of multi-task assignment to achieve collision avoidance capabilities. In 2014, Kuwata et al. [28] proposed to extend the speed obstacle method in maritime navigation restricted by COLREGs, and use the speed obstacle method to avoid moving and static hazards. In 2018, Fuat et al. [29] used the fast square of travel algorithm for collision avoidance and path planning based on COLREGs for multiple unmanned surface vehicles. In 2020, Woo et al. [30] proposed a collision avoidance method based on deep reinforcement learning (DRL). Zhao and Roh [31] proposed a deep neural network (DNN) approach to overcome the multiship collision avoidance problem based on DRL algorithm. Using the Boolean expression technology, Ni et al. [32] proposed a practical collision avoidance path planning algorithm  [33] proposed an autonomous decision-making scheme for multi-ship collision avoidance with iterative observation and reasoning, taking into account the dynamics of the real environment. In [34], a collision avoidance dynamic support system was developed, which combined the mathematical model of ship maneuvering motion, the control mechanism of ship maneuvering motion and the dynamic calculation model of collision avoidance parameters. Li et al. [35]proposed a distributed coordination strategy considering ship maneuverability for the many-to-many collision avoidance problem. Sun et al. [36] describes a collision-avoidance system with COLREGs compliance to improve the autonomous navigational ability of ASV. These documents describe how to apply the COLREGs rule to collision avoidance algorithms. These methods will be the research basis of this paper.
In summary, COLREGs, as a set of guidelines for ship encounters at sea, has provided basic collision avoidance navigation rules for ship drivers, but for intelligent ships controlled by computers, the rules are not specific enough, and the relative bearings and steering angles need to be digitized. The aim of the paper is to study the genetic collision avoidance algorithm for autonomous surface vehicles based on COLREGs. The contribution of the paper is that the Distance of Closest Point of Approach (DCPA) and Time of Closest Point of Approach (TCPA) are used to calculate the ASV Collision Risk Index (CRI). And in the genetic collision avoidance algorithm, the optimal collision avoidance heading angle of the ASV is calculated through the super-position of the CRI of multiple obstacles. If ships can navigate intelligently in accordance with these regulations, many maritime traffic accidents caused by human error can be avoided.
The rest of the paper is organized as follows. Section 2 describes the mathematical model of ASV collision risk index with COLREGs compliance, including collision avoidance rules, the membership function of ASV risk factors, and the mathematical model of safe encounter distance. In Section 3, the collision avoidance decision of ASV is proposed based on a genetic algorithm. Section 4 describes the collision avoidance decision simulation using genetic algorithm for ASV. In Section 5, a brief summary and limitations are given.

Mathematical model of ASV collision risk index
In order to realize the autonomous navigation of ASV, an autonomous collision avoidance decision-making system needs to be designed. It is a complex system composed of factors such as hull manoeuvrability, navigation aids, marine environment, relevant international navigation rules, and the motion characteristics of the encountering ships. The ASV's own navigation information and the motion information of the ships it encounters are obtained through navigation equipment such as onboard Global Positioning System (GPS), Compass, Automatic Radar Plotting Aid (ARPA), camera, and Automatic Identification System (AIS). When other ships approach, ASV's autonomous collision avoidance decisionmaking system will calculate, analyze and judge the degree of danger of the current encounter situation, and make collision avoidance decisions ac-cording to the "1972 International Regulations for Preventing Collisions at Sea". The ASV collision avoidance decision-making system includes sub-modules such as information collection, meeting situation decision-making, collision risk index decisionmaking, collision avoidance decision and evasive action. Using obstacle detection equipment such as ARPA, AIS and Camera, the ASV can obtain the position, speed, heading and other information of nearby Target Ships (TSs). According to the comparison between these attitude information and the attitude information of ASV, this paper will establish a mathematical model of ASV collision risk index, and provide decision-making for the steering and speed control of ASV. Through the collision avoidance decision-making system, taking into account the maritime collision avoidance rules, ASV will get a collision-free route. The decision-making error of any module may cause the occurrence of ship collision accidents. The structural block diagram of the ASV collision avoidance decision-making system is shown in Fig.1.

Collision avoidance rules for ASV
COLREGs are maritime traffic rules formulated by the International Maritime Organization to prevent and avoid collisions between ships at sea. The rules are mainly related to definitions, lights and markings, manoeuvring and navigation rules, etc. This article mainly studies the collision avoidance measures that the two ships should take when they meet. According to COLREGs the encounter situations are divided firstly by visibility criterion. In this paper, the encounter situations of ships in sight of each other are divided into three categories, namely Head-on, Overtaking, and Crossing, as shown in Fig.2 In Head-on situations, when the relative bearing between the ASV and the TSs is less than 15 degrees or more than 345 degrees, the ASV should turn right and pass on the left side of the TSs.
In Overtaking situations, when the heading angle difference △θ between the ASV and the TSs satisfies △θ<45°, the ASV should turn to its left or right rudder and pass both left and right of the TSs.
When the relative bearings are not in the above situation, the encounter situation between ASV and TSs is Crossing. The ASV should pass astern of TSs.

ASV collision risk index
The CRI is a parameter to measure the probability of collision of ASV, which is a vague and uncertain concept, and its value ranges between 0-1 [37]. In the case of ASV encounters a ship, its size depends on basic information such as the Distance of Closest Point of Approach (DCPA) value, the Time of Closest Point of Approach (TCPA) value, ship speed ratio (K), the Distance from ASV to ship (D), and the relative Bearings between the ASV and the ship (B).

Crossing scenario
Overtaking scenario

Collision avoidance strategy
End collision avoidance Get optimal collision-free heading by Genetic Algorithm  Fig.3 shows the ASV collision avoidance decision process. The CRI model is established with the use of fuzzy mathematics. CRI is selected for the comparative analysis to judge whether there is a collision risk index. When TCPA is greater than 0, it indicates that the ASV is in danger of collision, and CRI needs to be further calculated. If the CRI is greater than threshold risk, it indicates that there is a greater risk of collision between the ASV and TSs, and the ASV needs to take collision avoidance maneuvers. When TCPA is less than 0, it indicates that the ASV has passed the intersection, and the corresponding geometric model is that there is an intersection between the reverse ex-tension line of the velocity of ASV and TSs. Therefore, it can be determined that there is no danger of collision, and no collision avoidance measures need to be taken.
During the ASV collision avoidance operation, if there is no change in the speed and course between the ASV and TSs, but the latitude and longitude of the two have changed to some degree, which makes the relative position change between ASV and TSs. The change in the distance leads to changes in DCPA and TCPA, which in turn leads to changes in CRI, so there is a collision risk index between ASV and TSs. Under normal circumstances, when the ASV is carrying out collision avoidance decision-making navigation, the corresponding collision risk index is reduced to a certain extent compared with the one before evasive maneuver. Under this condition, it can be judged whether the collision avoidance decision is correct.

Membership function of risk factors
The value of CRI is a measure to assess the risk of collision with other target ships, and it is affected by various factors. Among them, the key factors that have a significant impact on )for the closest encounter distance, shortest encounter time, relative azimuth angle, distance between two ships, and ship speed ratio. The most important feature of CRI is uncertainty, which is mainly caused by measurement errors. CRI is also extremely sensitive to the membership functions of corresponding factors. There is a positive correlation between the DCPA value and the corresponding degree of risk, and the corresponding degree of risk membership of DCPA can be determined based on the following Equation (2)   1   12 12 21   1 when, where 1 d corresponds to the safe field value, and 2 d corresponds to the safe passing distance. TCPA is also closely related to the degree of danger, and its degree of dangerous membership can be determined based on the following Equation (3)   1   2  12  21   2   1 when, 0 when, 0 when, where, 22 1 1 t is the ship collision attention time. When it is judged that the two are far apart during operation, there is hardly any danger. Under the condition that the direct ship has sailed to the latest rudder point, the direct ship can remain unchanged, even if the direct ship avoids obstacles under very large conditions, it cannot achieve the purpose of avoiding danger. So the risk of collision is 1 under this condition.
The relative azimuth angle  is closely related to the corresponding collision risk index. In the course of operation, under normal circumstances, the hazard of the target ship on the starboard of the ship is higher than that on the port. Some statistical analysis studies [38] have also found that under the condition that other influencing factors remain the same when the target ship's relative bearing is 19°, the collision risk index of the ASV is the highest. The dangerous membership degree is set to 1, when the target ship's relative bearing is over 199°, the collision risk index of the ASV is the smallest, and the dangerous membership degree is set to 0 at this time. The corresponding expression of the risk membership function of the relative orientation is shown in Equation (4).  The distance to the target ship is closer, the danger that the target ship poses to ASV is greater. Therefore, the dangerous membership function of the distance between the ASV and TSs is shown in Equation (5). when, Where the Distance of Last-Minute Action of turning (DLMA) is the distance between the two ships when the collision avoidance action is taken at the latest.  c are the courses of the target ship and ASV. W is a constant, W=2. In the study, five factors closely related to collision risk index are specifically analyzed, and their importance is compared. The results show that the importance of these parameters differed significantly, followed by DCPA, TCPA, D, B, and K. In this way, the corresponding weight is determined by further judgment and analysis, and the boundary value of the weight is analyzed and determined based on the safe encounter distance model of maneuverability. The maneuverability of the ASV is introduced during the model establishment process, which can better meet the analysis requirements.

Mathematical model of safe encounter distance
The minimum encounter distance DCPA between ASV and TSs is calculated. The minimum safe encounter distance (SDA) between ASV and TSs is calculated, and the following Equation (7) is used to determine whether there is a collision risk index.
DCPA ≥SDA According to the crew's practical collision avoidance experience, the concept of the ship domain is proposed. Its specific meaning is to avoid entering the waters around the ship as much as possible. The parameter is introduced in the process of determining the safe encounter distance. If entering this area, it can be judged that there is a certain risk of collision. In fact, this concept is a form of safe encounter distance. The relationship between the ship domain and the relative azimuth angle is shown in Equation (8).
Where Dm is the relationship between the ship domain and the relative azimuth angle, and its unit is nautical mile (n mile). The research results of other scholars [39][40] have found that this method is safe, but it also has drawbacks, that is, it leads to a large size and a certain mutation, so it does not meet the requirements of practical applications. Therefore, it is necessary to revise this model to improve its application value. The equation is as shown in Equation (9).
As shown in the Equation (9), q corresponds to the direction of the Closest Point of Approach (CPA).
The concept of maneuvering margin considers the maneuverability of the ASV and TSs to express the margin required for the ship's steering. The maneuvering margin is represented by the distance traveled by the ASV and the TSs within 90° of full rudder turning of ASV at full speed. Assuming that t is the time for the ASV to turn 90° at full rudder speed, Ad is the ASV turning pitch, Dr is the ASV initial turning radius, and VT is the TSs ground speed. Then, within the time that TSs is turning 90° at full rudder and full speed, the TSs have traveled a distance of * VT t , and the own ship has traveled a distance of Ad , so that the maneuvering margin is is the minimum security field value.
The safe encounter area 1 d in this paper is determined by the incoming ship's side angle  , rather than the position of CPA. This determination method is more concise and effective. The relationship between

Collision avoidance decision of ASV based on genetic algorithm
In the previous section, the relevant parameters of the encounter process of the ASV were deduced, and the collision risk index model based on maneuverability was established. On this basis, the research aims to make collision avoidance decisions through a genetic algorithm and determine the appropriate heading to avoid the obstacle. Genetic algorithm is a random search algorithm that simulates the biological evolution process in nature. It was proposed by Professor John Holland of the University of Michigan in 1960 [41]. It originated from Darwin's theory of evolution, Weizmann's theory of species selection and Mendel's theory of population genetics. It is a process search algorithm formed by simulating the natural genetic mechanism and biological evolution theory. Genetic algorithm is mainly composed of four parts: coding, initial population generation, evaluation function, genetic operation, and algorithm termination condition [42]. To solve the ASV collision avoidance problem using genetic algorithm, the design of each part is very important.  The following is a description of the genetic factors and fitness functions to illustrate the decision-making process of collision avoidance for ASV based on genetic algorithms.

Basic parameters of genetic algorithm
When using a genetic algorithm to solve and analyze the ASV collision avoidance decision problem, it is necessary to determine the basic parameters of the genetic algorithm, as follows.
1)Population size The population size determines the number of individuals in each generation. The larger the population, the higher the accuracy of the algorithm, but at the same time, the efficiency will be relatively low. The size of the population reflects the balance between efficiency and accuracy. In general, 101 can be used to comprehensively meet the requirements [43][44]. 2)Probability of crossover (Pc) There is a positive correlation between the crossover probability Pc and the generation rate of new individuals. In general, if this parameter is large, the convergence speed can be improved, which is conducive to convergence to the optimal solution, and if the frequency is too high, it will easily lead to local optimal correlation problems. Choosing 0.4-0.9 can better meet all requirements [41][42], but it should be decided based on the actual problem situation. Another method to determine the crossover probability is to adjust this parameter in conjunction with an adaptive method.
3)Probability of mutation (Pm) This parameter is mainly used to describe the probability of individual mutation. If its value is low, the population diversity will be affected. On the contrary, it is prone to shock problems, causing the algorithm to lose its inherent advantages. In the actual application process, the probability of mutation takes a value between 0.01 and 0.2 [41][42]. In addition, under the condition of population size, in order to ensure the existence of mutation operation, it should be adjusted more appropriately.

4)Maximum evolutionary algebra
The genetic algorithm can be judged to stop the evolution based on this parameter. If this parameter is set to a small value, it will easily lead to the non-convergence of the algorithm. On the contrary, the efficiency requirement will not be met. Therefore, it should be properly balanced, and the control efficiency and accuracy can meet the requirements. Therefore, 50-100 generations are generally selected [41][42]. It can also be determined in other ways to stop the iteration. For example, there are obvious differences in the fitness value of the best individuals in successive generations during the operation. In this case, it can be considered that it has entered the local optimum and should end.

Application of the genetic algorithms to the collision avoidance decision-making systems
The premise of implementing the collision avoidance decision-making system is to determine the collision risk index of each obstacle ship, then the corresponding fitness function can be obtained, and a certain comparative analysis can be performed to determine the optimal solution.
The genetic algorithm is abstracted from the biological evolution process and shows the characteristics of the "generation + test" in the actual application process [45]. The corresponding parameter space is based on the coding space instead, and the fitness function is used as the evaluation standard to realize the selection and mechanism of the genetic operation of a single data string in the population and perform certain iterative operations to approach the optimal solution. The specific steps are as follows.
1. Encode real numbers in the feasible solution space [-90, 90], and each code corresponds to an angle. In some special cases, the ASV needs a large turn (such as turning 90 degrees) to avoid collision. 2. The group size is set to n = 150. 3. Determine the corresponding fitness value according to the CRI model. 4. Roulette selection operation. 5. Single point crossover operation. 6. Gene location mutation operation. 7. CRI is calculated to determine the fitness of each body. 8. In the process of iterative operation, when the judgment is over, genetic algebra is used to control the end of the cycle. When the judgment meets the end condition, the corresponding genetic ends, and go to the next step 9. to output the current optimal solution. In the opposite case, go to step 4. 9. Output the optimal solution. Taking the collision avoidance scenario between ASV and Target Ship1 (TS1) as an example, the improved genetic algorithm programs for ASV collision avoidance are described in Figure 5.

Collision avoidance decision simulation based on genetic algorithm for ASV
In order to study the handling performance of ASV, a mathematical model of ASV motion is established to simulate its collision avoidance motion. In this way, the influencing factors of its navigation performance can be clarified, and the relevant requirements of obstacle avoidance can be better met. In this paper, the mathematical model is used for simulation analysis, and its maneuvering motion is studied to provide support for its obstacle avoidance decision. In this section, the mathematical modelling of ASV's manipulation is studied for the plane collision avoidance motion. The three-degree-of-freedom manipulation mathematical model of the ASV is shown in Equation (13). m m m I J represents the displacement of the ASV, the additional longitudinal mass, the additional lateral mass, the moment of inertia around the Z-axis, and the additional moment of inertia around the Z-axis, respectively. And ,, u v r represents the longitudinal velocity, lateral velocity, and angular velocity of the ASV, respectively, without considering the heave, roll, and pitch. The subscripts H, P, and R of X, Y, and N represent the hull hydrodynamic force, propeller force, rudder force, and their moments, respectively. The subscripts Wind, and Wave of X, Y, and N represent the wind force, wave force, and their moments, respectively.
The nonlinear expansions of the fluid forces and moments on the ASV hull are shown in Equation (14).
Where, () Xu is the resistance function of ASV. , , , During the maneuvering movement, the thrust generated by the propeller provides the main control force of the ASV and overcomes the resistance of the water flow. Therefore, it is necessary to establish a reliable propeller thrust calculation model when modelling the ASV motion, and the propeller force and its torque expressions are shown in Equation (15).
Where, p C is the longitudinal prism coefficient. U is the water velocity. p w represents the effective wake coefficient of the propeller, and its value is related to the motion control range. The rudder force and its moment can be solved by Equation (17).
(1 ) sin Where, (1 ) is the resistance reduction value of the rudder.  is the rudder angle.
H a represents the hull hydrodynamic force generated in the process of steering the rudder. R x is the longitudinal distance from the center of the rudder to the center of gravity of the ASV. N F is the force acting on the rudder in the normal direction, which can be calculated by Equation (18 Where,  is the pitch of the propeller. There are wind pressure and moment on the hull above the waterline when the ASV is sailing at sea. The actual winds are all unsteady, but for the convenience of research, it can be assumed that the encountered winds are steady, and the wind pressure and moment acting on the hull can be expressed by Equation (19).
Where, a  is the air density.
f A is the orthographic projection area of the part above the water-plane of the hull. It is an extremely complicated process to calculate the wave disturbance force and moment suffered by ASV, which is determined by the characteristics of the wave itself. The wave interference force includes the first-order wave force and the second-order wave force, which are also called high-frequency wave force and wave drift force, respectively. In this paper, the collision avoidance algorithm of ASV is studied, and the calculation of wave force is simplified. Here, it is assumed that the ASV encounters regular waves, and the influence of the first-order wave force is assumed to be ignored. The empirical calculation equation of the second-order wave force is shown in Equation (20).
Where,  is the wavelength. L is the waterline length of the ASV. It can be seen that the key to calculating the rudder force is to determine the effective flow velocity and the effective rudder angle.
In this section, the simulation system of ASV will be built on the basis of Visual Studio, and the simulation of ASV collision avoidance decision-making based on genetic algorithm will be carried out. In the program interface, each parameter of the genetic algorithm is set, and four obstacle ships are added to verify the collision avoidance algorithm. The four obstacle ships are set to different heading directions and positions. During the simulation operation, the relevant parameters of the encounter between the ASV and the TSs are saved in real time, such as CRI, DCPA, TCPA, heading, and the distance between the ASV and the The simulation system of ASV collision avoidance is built on the Visual Studio platform and has a complete visual simulation interface. All important parameters can be reflected on the interface in real-time, which makes the simulation operation more convenient. The main scale parameters of ASV are shown in Table 1. First, the crossover probability Pc of the genetic algorithm-related parameters is set to 0.7 in the program, the mutation probability Pm is set to 0.05, the maximum evolution generation number is set to 150, the population size is set to 150, and the maximum number of genes is set to be 1,000.   Fig.6 Simulation interface of the ASV collision avoidance system 1)Head-on In the simulation of ASV collision avoidance, the collision avoidance decision system detects that the collision risk index with the TS1 is greater than 0.61(The threshold risk is 0.61) at 330 seconds. At the beginning of the encounter, the heading angles of the ASV and TS1 were 0° and 180° respectively, and the distance between the two ships was 400 meters, as shown in Figure 6, which shows the trajectory of each ship.
As shown in Figure 7, when the Head-on situation is formed, the decision system changes ASV's expect heading to avoid the collision with TS1. And it can be seen that the closest distance to TS1 is 81.53m. The relative bearing between ASV and TS1 is first increase and then decrease, as shown in Figure 8.
As shown in Figure 9, at the beginning of the Head-on, the collision risk index is 0.62 greater, and the best collision avoidance steering range found by the rear collision avoidance decision-making system is -28.49°. Then the ASV turns to the best collision avoidance angle. Finally, the collision risk index with TS1 stabilized at 0.43 at 426s.
As shown in Figures 10 and 11, when the confrontation situation is formed, both DCPA1 and TCPA1 have a sudden increase in size. The larger the value of DCPA1 and TCPA1, the earlier the collision avoidance measures are taken, the higher the security. 2)Crossing As shown in Figure 6, when the Head-on situation ends, a crossing encounter is formed between the ASV and the Target Ship2 (TS2) and the Target Ship3 (TS3). In the beginning, the heading angle of ASV is -8°, the heading angle of TS2 is 270°, and the heading angle of TS3 is 90°. Then the collision avoidance decision-making system detects that the collision risk index with the incoming ship is greater than 0.61 at 447s. At this time, the distances between ASV and obstacle ships 2 and 3 are respectively 150m, 310m. Figure 9 shows that at the beginning of the cross encounter, the collision risk index of ASV and the TS3 is greater than 0.6, the system first makes a decision on the TS3, and the best collision avoidance steering amplitude found is -28.94°. Then at 465s, it is detected that the collision risk index with TS2 is greater than 0.6, and the system makes a decision on TS2. During the collision avoidance process, the ASV always keeps a safe encounter distance with TS2 and TS3. As shown in Figure 7, the closest distance to TS2 is 61.24m, and the closest distance to TS3 is 76.92m. As shown in Figure 8, the best heading angle obtained by the steering decision-making system of the ship is -33.03° during the simultaneous crossing encounter with the TS2 and TS3, and the crossing encounter situation ends at 700s and starts to return to the original course. For the CRI of multiple target ships may exceed 0.6 at the same time, the algorithm gives priority to avoid target ships with larger CAIs, and if the CAIs of multiple target ships are similar, the CAIs of multiple target ships are added. The heading corresponding to the value with the smallest CAI sum will be selected.
As shown in Figures 10 and 11, when the cross-encounter situation is formed, both DCPA2, DCPA3, and TCPA2, TCPA3 have a sudden increase in size, indicating that the ship has taken early measures at this time, and the safety is very high.
3)Overtaking Figure 9 shows that when the overtaking situation is formed, the collision risk index is greater than 0.6, and the best collision avoidance steering amplitude found by the rear collision avoidance decision-making system is -31.54°. At 900s, the collision risk index with TS4 tends to stabilize to 0.44, and the relative bearing between ASV and TS4 during the chase process is shown in Figure 8. When the overtaking situation shown in Figure 6 is formed, through the decision-making system to avoid collision with the distance between the ship and the TS4, it can be seen that the closest distance to the TS4 is 43.35m, this distance is safe during the navigation of the two ships. As shown in Figures 10 and 11, when the overtaking situation is formed, both the DCPA4 and TCPA4 have a sudden increase in size, indicating that the ship has taken early measures during the overtaking and the safety is very high.

Conclusions
In this paper, the basic principles of ASV collision avoidance are analyzed. And a mathematical model for collision avoidance is established. By establishing a collision risk index model, it can judge whether there is a collision risk index with an obstacle ship. And the COLREGs collision avoidance rules are transformed into mathematical formulas, through which the CAI under different navigation conditions can be calculated, so that the heading corresponding to the minimum CAI can be selected, which is the expected best heading. On the basis of full study of the genetic algorithm, the genetic algorithm is used to solve the collision avoidance problem of the ASV, the genetic algorithm model for the collision avoidance problem of the ASV is established, and the collision risk index based on the manoeuvrability is used as the objective function of the genetic algorithm. An ASV collision avoidance decision model is proposed based on a genetic algorithm. It adopts a reasonable coding method to express the ASV collision avoidance heading prediction, which is practical and convenient to calculate and shows good performance. Under the development environment of Visual Studio, the intelligent collision avoidance system simulation software based on the manoeuvrability of the ASV is designed. The safety of collision avoidance behaviour and compliance with the "collision avoidance rules" are considered in the proposed genetic collision avoidance algorithm. If the CRI of multiple target ships may exceed 0.6 at the same time, the algorithm gives priority to avoid target ships with larger CAIs, and if the CAIs of multiple target ships are similar, the CAIs of multiple target ships are added. The heading corresponding to the value with the smallest CAI sum will be selected. The collision avoidance simulation between ASV and multiple obstacle ships is carried out, including the situations of heading on, crossing, and overtaking. The simulation results show that the proposed intelligent genetic algorithm can effectively avoid multiple obstacle ships from different directions and different states. The simulation data such as DCPA, TCPA, and distance between ASV and the obstacle ships reflect the collision avoidance behaviour is safe, and it verifies the feasibility of the genetic collision avoidance algorithm proposed. In the future, the genetic collision avoidance algorithm will be available for ship collision in the port environment [46] and a fleet of unmanned surface vehicles [47][48].

Acknowledgments
This work was supported by the National Natural Science Foundation of China [Grant number 51309148].