An Improved A-Star Ship Path-Planning Algorithm Considering Current, Water Depth, and Trafﬁc Separation Rules

: The inﬂuence of the maritime environment such as water currents, water depth, and trafﬁc separation rules should be considered when conducting ship path planning. Additionally, the maneuverability constraints of the ship play a crucial role in navigation. Addressing the limitations of the traditional A-star algorithm in ship path planning, this paper proposes an improved A-star algorithm. Speciﬁcally, this paper examines the factors inﬂuencing ship navigation safety, and develops a risk model that takes into account water currents, water depth, and obstacles. The goal is to mitigate the total risk of ship collisions and grounding. Secondly, a trafﬁc model is designed to ensure that the planned path adheres to the trafﬁc separation rules and reduces the risk of collision with incoming ships. Then, a turning model and smoothing method are designed to make the generated path easy to track and control for the ship. To validate the effectiveness of the proposed A-star ship path-planning algorithm, three cases are studied in simulations and representative operational scenarios. The results of the cases demonstrate that the proposed A-star ship path-planning algorithm can better control the distance to obstacles, effectively avoid shallow water areas, and comply with trafﬁc separation rules. The safety level of the path is effectively improved.


Introduction
Ships are essential carriers in maritime transportation and play a crucial role in the transportation network [1].Additionally, the integration of intelligent technologies, such as autonomous systems and advanced data analytics, into ships has become an inevitable advancement in maritime transportation [2].In recent years, there has been rapid development in the technology of intelligent ships, which has garnered unprecedented attention in both military and commercial sectors [3,4].The utilization of intelligent ships offers numerous benefits, such as reduced labor costs, energy savings, and fewer accidents [5].Furthermore, these ships can effectively perform complex and hazardous engineering tasks in specific waters [6].Research on intelligent ship autonomy has gained increasing attention as they heavily rely on highly autonomous systems.
Path planning plays a vital role in the development of autonomous systems for ships.It serves as the foundation for ship systems [7].A safe and efficient path is essential for ships to ensure routine safe navigation, dynamic collision avoidance, and avoidance of grounding areas [8].Path planning entails determining a secure and effective route from the starting point to the destination while considering specific requirements such as path length, risk factors, and rule constraints [9,10].Path planning can be broadly classified into global path planning and local (real-time) path planning [11].Global path planning calculates paths in advance in a static environment with stationary obstacles, whereas local path planning computes navigational paths in real time in a dynamic environment with both moving and stationary obstacles.Research on path planning is crucial for the advancement of autonomous systems in ships and serves to enhance their autonomy.
The remainder of this article is structured as follows: Section 2 introduces recent research on path-planning algorithms, including a detailed overview of the A-star algorithm.Section 3 explains the established methods used in the risk, traffic, and turn models.Section 4 presents the principles and specific methods for improving the A-star algorithm.Section 5 showcases three case studies.Lastly, Section 6 summarizes the conclusions and proposes directions for future research.

Literature Review
Ship path planning differs from path planning for robots, roads, and other applications because it considers the influence of the water environment and the maneuvering restrictions of the ship [14,15].This section offers a concise overview of recent research advancements in ship path-planning algorithms and provides a detailed examination of the research conducted on the A-star algorithm in the context of ship path planning.

Research Progress of Ship Path Planning
Ship path planning plays a crucial role in achieving autonomous navigation [16].Over the years, global path-planning methods have been primarily categorized into four groups: search algorithms based on existing map information, random expansion algorithms, intelligent bionic algorithms, and deep reinforcement learning algorithms.The Dijkstra algorithm [17] is a typical search algorithm that utilizes existing map information to determine the shortest path between two points.The A-star algorithm, which enhances the efficiency of the Dijkstra algorithm by incorporating a heuristic function, has been widely employed in ship path planning [18].
The most commonly used random expansion algorithms in ship path planning are the rapidly exploring random trees (RRT) algorithm and the probabilistic road map (PRM) algorithm [19].These algorithms obtain feasible paths by randomly sampling path nodes, which allows them to effectively solve path-planning problems with complex constraints without requiring accurate environmental modeling [20].However, paths planned by these algorithms may not be suitable for tracking, and the convergence speed of the algorithms can be slow.To address the slow convergence of the RRT algorithm, Dong et al. [21] developed an environment framework that provides an initial path and guides the algorithm's expansion.Furthermore, Cao et al. [22] proposed an RRT algorithm enhanced with path shearing and smoothing modules to mitigate navigational risks in inland rivers.However, these algorithms do not consider the specific navigation characteristics of the ship and cannot guarantee that the path is the optimal solution.
Intelligent bionic algorithms, derived from bionic research, are employed to address path-planning challenges in complex environments.Commonly used algorithms include genetic algorithm (GA), ant colony optimization (ACO), and particle swarm optimization (PSO) [23].Although these algorithms are robust, they often get stuck in local optima and are slow in planning.Thus, they are frequently used in combination with other algorithms [24].To overcome the problem of GA getting trapped in the local optimum, Long et al. [25] introduced a new population initialization method with adaptive mutation and crossover probabilities to escape from the local optimal solution.Zhang et al. [26] suggested a differential evolution particle velocity approach, which effectively resolved the issue of PSO falling into the local optimum.Implementing these algorithms typically requires extensive environmental modeling, substantial computational resources, and parameter tuning.These requirements can pose challenges when applying them to practical path-planning scenarios.
The rapid advancement of autonomous ship navigation has rendered traditional algorithms insufficient to meet the demands of ship operations.As a result, researchers have increasingly turned to deep learning and reinforcement learning techniques for ship path planning [27].Li et al. [28] enhanced the action space and reward function by incorporating marine collision avoidance rules into the reward function, and by introducing an artificial potential field.Simulation experiments demonstrated that the trained ship model can autonomously avoid collisions.Liu et al. [29] improved the efficiency and generalization capability of an algorithm by utilizing continuous multi-time target ship information and a redesigned reward function.Their approach, based on the TD3 algorithm, resulted in a smoother and more stable path.However, it is important to note that reinforcement learning algorithms require extensive training of ships to effectively plan paths.In reality, ship accidents are relatively rare, and available data are limited.Therefore, the application of such algorithms to real-world scenarios remains challenging.

Research Progress of A-Star Algorithm
The A-star algorithm is widely utilized in path planning due to its high level of completeness and optimality.However, when used in isolation, it can lead to paths that overlook environmental factors, exhibit poor algorithm efficiency, and do not align with real conditions [30].To tackle these challenges, researchers have put forward various enhancements to the A-star algorithm.
Complex environments and large maps exponentially increase the time complexity of the A-star algorithm [31].To tackle this challenge, researchers have made improvements to the search method of the A-star algorithm.Duchon et al. [32] enhanced the algorithm's efficiency by modifying the traditional eight-neighbor search to an omnidirectional search and incorporating the hop search algorithm into the path-planning process.Chen et al. [33] introduced a bidirectional A-star algorithm that utilizes a dynamic window to search for paths simultaneously from both the start and the goal positions.The dynamic window significantly improved the algorithm's efficiency, resulting in a substantial reduction in search time.Fernandes et al. [34] improved the algorithm's efficiency by limiting node expansion and constructing 16 directional layers that only visit adjacent layers when searching for the lowest cost.Similarly, Zhang et al. [35] proposed an expansion method that prioritizes nodes in the same direction as the target node, reducing the number of expanded nodes in the A-star algorithm.
The A-star algorithm often produces paths with many turns and lacks smoothness [36].Researchers have proposed various cost functions to smoothen paths and several postsmoothing algorithms for generated paths to address these issues.Thaker et al. [37] tackled the problem of excessive turning points in A-star algorithm paths by increasing the offset distance of obstacles using a buffer area centered on the robot.Experimental results confirmed that this method resulted in smoother paths.Lu et al. [38] introduced a pathplanning algorithm that combined the A-star algorithm with the Floyd algorithm to reduce the sharpness of breakpoints in the planned path.Gunawan et al. [39] addressed the issue of large turning point angles in the traditional A-star algorithm paths by incorporating angle information between nodes to minimize the turning angle, thereby avoiding potential safety hazards associated with sudden turns of unmanned vehicles.Sun et al. [40] combined the A-star algorithm with the variable weight evaluation function of the artificial potential field (APF) method and optimized the relevant parameters using the PSO algorithm, resulting in smoother planned paths and enabling dynamic obstacle avoidance.
Environmental factors have a significant impact on global route planning for ships.Recognizing the limitation of the A-star algorithm in considering only path length, researchers have endeavored to incorporate various environmental factors in the maritime area that affect navigation.To address the issue of the A-star algorithm's path being too close to obstacles, Shu et al. [41] proposed the utilization of an obstacle detection method to select safer nodes.In their study, Liu et al. [42] improved the algorithm's cost function by considering the risk of water currents, presenting an A-star algorithm that addresses the combination problem of the normal path and the berthing path.Additionally, Liu [43] integrated environmental water depth interpolation into the algorithm and analyzed the ship motion characteristics to devise an A-star algorithm that takes into account water depth risk, effectively reducing the risk associated with water depth along the path.
In summary, researchers have made significant improvements to the A-star algorithm, resulting in increased efficiency and practicality.However, these improved algorithms often fail to guarantee safe navigation due to their limited consideration of environmental factors, ship turning restrictions, and traffic separation rules.While these algorithms may offer shorter paths, they also introduce higher navigation risks, making them unsuitable for intelligent navigation [44].To address these limitations, this paper proposes an improved A-star algorithm that incorporates various navigation factors.The algorithm comprises risk model, traffic model, and turn model.The risk model takes into account the influence of current, water depth, and obstacle distance on navigation risks, thereby avoiding grounding areas and maintaining a safe distance from obstacles.The traffic model ensures that ships comply with maritime rules, reducing the risk of collision with incoming ships.Furthermore, to better align with the dynamic motion characteristics of the ship during the path-planning stage, the algorithm utilizes a geometric smoothing method.This method optimizes the path to accommodate the ship's turning radius, ensuring that it is in line with the ship's maneuverability.By considering these factors, the proposed algorithm enhances both the safety and the practicality of ship navigation.

Overview of the Model
When planning a ship's path, it is crucial to consider the length of the path and various risks that can impact navigation safety [45].Turbulent currents, grounding, ship encounters, and improper maneuvering are among the factors that can compromise the safety of navigation [46,47].The influence of water currents on ship movement is particularly significant in the ocean.The speed and direction of currents can have a profound impact on a ship's course.Neglecting the influence of water currents during a voyage can lead to deviations from the intended path, resulting in unnecessary delays or increased risks.Water depth is another critical factor that affects navigation safety.Insufficient water depth can lead to grounding or damage to the ship.Therefore, when planning a ship's path, it is essential to consider the limitations imposed by water depth to avoid potential safety issues.Furthermore, adherence to traffic separation rules is necessary in busy waterways to ensure safe and orderly navigation.Failure to comply with these rules can result in hazardous situations such as traffic congestion or collisions.Considering these factors, path planning should incorporate risk assessment to enhance navigation safety.By accounting for turbulent currents, water depth limitations, and traffic separation rules, the path can be optimized to minimize potential risks and ensure a safe and efficient voyage.
To focus on the given problem, certain assumptions were made in this paper.The overall map was assumed to represent a confined ocean environment near a harbor, resulting in a relatively short total travel distance and no significant environmental changes during the ship's journey.Assuming a static environment is reasonable for short-duration travel of 1-2 h.This is because weather information is typically forecasted and updated on an hourly basis, with minimal changes expected during this period.Therefore, if the travel time is <1 h, it can be safely assumed that the environment is static.
To tackle these challenges, three models were developed: the risk model, the traffic model, and the turn model.Figure 1 illustrates the relationship between the risk factors and the respective models.By integrating these models into the path-planning process, we can prioritize safety and ensure the utmost security for ship navigation.

Overview of the Model
When planning a ship's path, it is crucial to consider the length of the path and various risks that can impact navigation safety [45].Turbulent currents, grounding, ship encounters, and improper maneuvering are among the factors that can compromise the safety of navigation [46,47].The influence of water currents on ship movement is particularly significant in the ocean.The speed and direction of currents can have a profound impact on a ship's course.Neglecting the influence of water currents during a voyage can lead to deviations from the intended path, resulting in unnecessary delays or increased risks.Water depth is another critical factor that affects navigation safety.Insufficient water depth can lead to grounding or damage to the ship.Therefore, when planning a ship's path, it is essential to consider the limitations imposed by water depth to avoid potential safety issues.Furthermore, adherence to traffic separation rules is necessary in busy waterways to ensure safe and orderly navigation.Failure to comply with these rules can result in hazardous situations such as traffic congestion or collisions.Considering these factors, path planning should incorporate risk assessment to enhance navigation safety.By accounting for turbulent currents, water depth limitations, and traffic separation rules, the path can be optimized to minimize potential risks and ensure a safe and efficient voyage.
To focus on the given problem, certain assumptions were made in this paper.The overall map was assumed to represent a confined ocean environment near a harbor, resulting in a relatively short total travel distance and no significant environmental changes during the ship's journey.Assuming a static environment is reasonable for short-duration travel of 1-2 h.This is because weather information is typically forecasted and updated on an hourly basis, with minimal changes expected during this period.Therefore, if the travel time is <1 h, it can be safely assumed that the environment is static.
To tackle these challenges, three models were developed: the risk model, the traffic model, and the turn model.Figure 1 illustrates the relationship between the risk factors and the respective models.By integrating these models into the path-planning process, we can prioritize safety and ensure the utmost security for ship navigation.

Risk Model
Although the traditional A-star algorithm can identify the shortest path, the generated path often remains very close to obstacles.This approach significantly increases the navigation risk due to the inherent time lag and inertia in ship movements.During navigation, if the water currents push the ship toward obstacles, the risk of collision further escalates.Furthermore, water depth plays a crucial role in safe navigation as it directly

Risk Model
Although the traditional A-star algorithm can identify the shortest path, the generated path often remains very close to obstacles.This approach significantly increases the navigation risk due to the inherent time lag and inertia in ship movements.During navigation, if the water currents push the ship toward obstacles, the risk of collision further escalates.Furthermore, water depth plays a crucial role in safe navigation as it directly affects the risk of grounding.Therefore, in path planning, it is essential to simultaneously consider the proximity to obstacles, water depth, and the influence of water and wind currents.
On the basis of the analysis conducted earlier, this paper presents the following definition of the risk model: where r obs (m, n) denotes the risk from obstacles, and r depth (m) denotes the stranding risk from shallow water area.The purpose of designing the model r obs (m, n) is to maintain a certain safe distance from obstacles in the environment and prevent collisions between the ship and obstacles caused by wind, water currents, and other factors.The purpose of designing the model r depth (m) is to ensure that the ship can avoid grounding or potentially grounding areas.The expression for r obs (m, n) is as follows: where d is the distance from a navigable node N[m] to the obstacle node O[n].Furthermore, v cur is the current velocity.It should be noted that this article replaced obstacle expansion with the distance function in Equation ( 2).This was to prevent the algorithm from being trapped in a locally optimal solution in a narrow area.Lastly, h c denotes the direction coefficient, expressed as follows: where v U is the ship velocity, and θ cur represents the angle between the water current v cur and the horizontal direction.As shown in Figure 2 affects the risk of grounding.Therefore, in path planning, it is essential to simultaneously consider the proximity to obstacles, water depth, and the influence of water and wind currents.
On the basis of the analysis conducted earlier, this paper presents the following definition of the risk model: where   (, ) denotes the risk from obstacles, and  ℎ () denotes the stranding risk from shallow water area.The purpose of designing the model   (, ) is to maintain a certain safe distance from obstacles in the environment and prevent collisions between the ship and obstacles caused by wind, water currents, and other factors.The purpose of designing the model  ℎ () is to ensure that the ship can avoid grounding or potentially grounding areas.The expression for   (, ) is as follows: where  is the distance from a navigable node [] to the obstacle node O[n].Furthermore,   is the current velocity.It should be noted that this article replaced obstacle expansion with the distance function in Equation ( 2).This was to prevent the algorithm from being trapped in a locally optimal solution in a narrow area.Lastly, ℎ  denotes the direction coefficient, expressed as follows: where   is the ship velocity, and   represents the angle between the water current   and the horizontal direction.As shown in Figure 2  To ensure that the ship can avoid grounding areas, we define  ℎ () as follows: To ensure that the ship can avoid grounding areas, we define r depth (m) as follows: where D[m] is the water depth at node N[m], and S min is the maximum draft of the ship, expressed as follows: where z max is the maximum settlement amplitude of ships at different velocity, L is the length of ships, θ max is the maximum pitch angle, T is the average draft under the mission load, and e enc is the calculation error.
According to Equation ( 1), there will be k obstacle nodes near a feasible node N[m], corresponding to k different risk values.In this case, the maximum value is taken as the final risk degree.
In addition, a local search is used instead of a global search to save time.The search range is set to d g , as shown in Figure 3.
where D[m] is the water depth at node N[m], and   is the maximum draft of the ship, expressed as follows: where   is the maximum settlement amplitude of ships at different velocity,  is the length of ships,   is the maximum pitch angle,  � is the average draft under the mission load, and   is the calculation error.
According to Equation ( 1), there will be  obstacle nodes near a feasible node N[m], corresponding to  different risk values.In this case, the maximum value is taken as the final risk degree.

Traffic Model
Similar to road traffic, ship navigation is also governed by traffic rules at sea.The International Regulations for Preventing Collisions at Sea (COLREGS) mandate that ships should cross separation zones in a direction perpendicular to the separation zone whenever possible.This rule aims to clarify the intention of crossing, minimize the risk of collision with other ships within the separation zone, and enhance navigation efficiency.However, the conventional A-star algorithm does not inherently ensure that the planned path aligns with the specified direction required by the traffic separation rules.To address this issue, we define the following traffic model on the basis of the rules: where

Traffic Model
Similar to road traffic, ship navigation is also governed by traffic rules at sea.The International Regulations for Preventing Collisions at Sea (COLREGS) mandate that ships should cross separation zones in a direction perpendicular to the separation zone whenever possible.This rule aims to clarify the intention of crossing, minimize the risk of collision with other ships within the separation zone, and enhance navigation efficiency.However, the conventional A-star algorithm does not inherently ensure that the planned path aligns with the specified direction required by the traffic separation rules.To address this issue, we define the following traffic model on the basis of the rules: where r tra (m) is the traffic separation cost at node N[m], θ t is the direction of traffic rules toward the true north, N[m].f is the parent node of N[m], and θ ship is the direction of path vector . f toward the true north, which is the ship's driving direction.As shown in Figure 4, the orange horizontal line denotes the traffic separation zone.The orange arrow is the driving direction specified by the traffic rules, where α = θ t − θ U is used to calculate whether the currently planned path conforms to the specified direction.For example, if the ship continues to follow the path in Figure 4 at time t i+1 , the ship will violate the traffic rules at sea.As shown in Figure 4, the orange horizontal line denotes the traffic separation zone.The orange arrow is the driving direction specified by the traffic rules, where  =   −   is used to calculate whether the currently planned path conforms to the specified direction.For example, if the ship continues to follow the path in Figure 4 at time  +1 , the ship will violate the traffic rules at sea.

Turn Model
In actual ship navigation, frequent turning can increase the difficulty of the captain's maneuvering and pose a risk to navigation.However, traditional A-star path-planning algorithms only consider the path length and often include many turning nodes.To address this issue, this paper presents a turn model to reduce the number of turns in the planned path.The turn model is defined as follows: where

Turn Model
In actual ship navigation, frequent turning can increase the difficulty of the captain's maneuvering and pose a risk to navigation.However, traditional A-star path-planning algorithms only consider the path length and often include many turning nodes.To address this issue, this paper presents a turn model to reduce the number of turns in the planned path.The turn model is defined as follows: As shown in Figure 4, the orange horizontal line denotes the traffic separation zone.The orange arrow is the driving direction specified by the traffic rules, where  =   −   is used to calculate whether the currently planned path conforms to the specified direction.For example, if the ship continues to follow the path in Figure 4 at time  +1 , the ship will violate the traffic rules at sea.

Turn Model
In actual ship navigation, frequent turning can increase the difficulty of the captain's maneuvering and pose a risk to navigation.However, traditional A-star path-planning algorithms only consider the path length and often include many turning nodes.To address this issue, this paper presents a turn model to reduce the number of turns in the planned path.The turn model is defined as follows: where

A-Star Algorithm and Improvements
This section begins by introducing the rules of environmental modeling, which can help to ensure that the A-star algorithm plans a path that is safer, better suits ship tracking, and adheres to traffic separation rules.Next, we propose an improved A-star algorithm based on the model presented in Section 3.

Environment Modeling
To accurately represent the path-planning process, it is necessary to create a twodimensional environment map.There are several conventional methods for environmental modeling, including the grid, geometric information, and view methods [48].The grid method involves dividing a planar map into a series of grids to create a grid map.This method is efficient in representing the characteristics of the actual environment while optimizing time and space consumption.It is also simple and direct, reducing the path search time and simplifying programming.Therefore, the grid method is utilized in this study to model the navigation environment.
(1) Water area and water depth division standard The division of grids into navigable and non-navigable areas can be based on the boundaries of the environment.A grid that contains objects is considered non-navigable and denoted in black, representing non-navigable waters.On the other hand, a grid that does not contain any objects is considered navigable and denoted in white, representing navigable water areas, as illustrated in Figure 6a.Obstructions that occupy less than one grid are expanded to ensure grid regularity and facilitate subsequent simulation implementation.The navigable and non-navigable waters after expansion are depicted in Figure 6b.The method for establishing the water depth environment follows the same process as above, as shown in Figure 6c,d.

A-Star Algorithm and Improvements
This section begins by introducing the rules of environmental modeling, which can help to ensure that the A-star algorithm plans a path that is safer, better suits ship tracking, and adheres to traffic separation rules.Next, we propose an improved A-star algorithm based on the model presented in Section 3.

Environment Modeling
To accurately represent the path-planning process, it is necessary to create a twodimensional environment map.There are several conventional methods for environmental modeling, including the grid, geometric information, and view methods [48].The grid method involves dividing a planar map into a series of grids to create a grid map.This method is efficient in representing the characteristics of the actual environment while optimizing time and space consumption.It is also simple and direct, reducing the path search time and simplifying programming.Therefore, the grid method is utilized in this study to model the navigation environment.
(1) Water area and water depth division standard The division of grids into navigable and non-navigable areas can be based on the boundaries of the environment.A grid that contains objects is considered non-navigable and denoted in black, representing non-navigable waters.On the other hand, a grid that does not contain any objects is considered navigable and denoted in white, representing navigable water areas, as illustrated in Figure 6a.Obstructions that occupy less than one grid are expanded to ensure grid regularity and facilitate subsequent simulation implementation.The navigable and non-navigable waters after expansion are depicted in Figure 6b.The method for establishing the water depth environment follows the same process as above, as shown in Figure 6c,d.(2) Movement rules of ships in the grid environment Ships can only move within the white grids representing feasible water areas and cannot cross or appear in the black grids.At the same time, the ship can move in eight directions within the grid environment, as illustrated in Figure 7.  (2) Movement rules of ships in the grid environment Ships can only move within the white grids representing feasible water areas and cannot cross or appear in the black grids.At the same time, the ship can move in eight directions within the grid environment, as illustrated in Figure 7.

A-Star Algorithm and Improvements
This section begins by introducing the rules of environmental modeling, which can help to ensure that the A-star algorithm plans a path that is safer, better suits ship tracking, and adheres to traffic separation rules.Next, we propose an improved A-star algorithm based on the model presented in Section 3.

Environment Modeling
To accurately represent the path-planning process, it is necessary to create a twodimensional environment map.There are several conventional methods for environmental modeling, including the grid, geometric information, and view methods [48].The grid method involves dividing a planar map into a series of grids to create a grid map.This method is efficient in representing the characteristics of the actual environment while optimizing time and space consumption.It is also simple and direct, reducing the path search time and simplifying programming.Therefore, the grid method is utilized in this study to model the navigation environment.
(1) Water area and water depth division standard The division of grids into navigable and non-navigable areas can be based on the boundaries of the environment.A grid that contains objects is considered non-navigable and denoted in black, representing non-navigable waters.On the other hand, a grid that does not contain any objects is considered navigable and denoted in white, representing navigable water areas, as illustrated in Figure 6a.Obstructions that occupy less than one grid are expanded to ensure grid regularity and facilitate subsequent simulation implementation.The navigable and non-navigable waters after expansion are depicted in Figure 6b.The method for establishing the water depth environment follows the same process as above, as shown in Figure 6c,d.(2) Movement rules of ships in the grid environment Ships can only move within the white grids representing feasible water areas and cannot cross or appear in the black grids.At the same time, the ship can move in eight directions within the grid environment, as illustrated in Figure 7.It is worth noting that the algorithm proposed in this paper is also applicable to the Electronic Nautical Chart (ENC) environment.The specific steps are to import the ENC data into the computer for preprocessing and establish the environmental model of the electronic chart on the basis of the processed ENC data.The environmental model is established using the grid map method, with each grid containing data on water depth, water currents, wind currents, and traffic separation rules.Lastly, path planning is performed using the constructed environment and the improved algorithm, and the resulting path nodes are displayed on the electronic chart [49].

Improved A-Star Algorithm
Given the limitations of traditional A-star algorithms in ship path planning, this section explores an improved A-star algorithm based on the risk models developed in Section 3.

Traditional A-Star Algorithm
The A-star algorithm is a heuristic algorithm based on the graph method, and it is also the most effective direct search algorithm for finding the shortest path in static road networks.Due to its high accuracy and efficiency, it is widely used in global path planning.The algorithm searches for the path by calculating the cost function of each node in the field, which has the following form: where Here, h(N[i]) has several forms, which are expressed by Euclidean distance in this paper, as follows: where (x i , y i ) and x g , y g are the current node N[i] and target node N[target] position coordinates, respectively.

Improved A-Star Algorithm
To incorporate the risk model, traffic model, and turn model into the A-star algorithm, this paper introduces a redesigned cost function.The improved cost function, denoted as F(N[i]), is defined as follows: where ε > 0 is a constant coefficient.ε is used to balance the weight between g(n) and h where t is the node amount from ) is the risk function, which is defined as follows: where r s (n), r tra (n), and r turn (n) were defined in Equations ( 1), ( 7) and (8).
The improved A-star algorithm was designed to consider various factors that affect navigation safety so that the planned path can meet several key characteristics.Firstly, it can maintain a safe distance from obstacles in the environment.Secondly, it can avoid shallow water areas and reduce the risks associated with currents.Thirdly, it can comply with traffic separation rules.Lastly, it can minimize the number of turns required.The pseudocode of Algorithm 1 demonstrates the implementation of the improved A-star algorithm.Calculate r s (j), r tra (j), r turn (j) by ( 1), (7), and ( 8), respectively.13: ) and set parent node of N[j] as N[i] 15: return "path P n is not found"

Smooth Paths with Geometry
The map is modeled using a grid-based approach, and the planned path consists of line segments formed by the grid.However, the vertices of this path are not conducive to the tracking and smooth navigation of the ship.Since the dynamic motion characteristics of the ship play a crucial role in path planning, and the turning radius of the ship is an important parameter of its dynamic motion characteristics in global path planning, the planned path must be within the range of the ship's maneuverability.To address this issue, this paper adopts the geometric smoothing path method to replace the vertices of the planned path with curve segments, taking into account the ship's minimum turning radius as an important reference parameter.The optimization process is shown in Figure 8.
shallow water areas and reduce the risks associated with currents.Thirdly, it can comply with traffic separation rules.Lastly, it can minimize the number of turns required.The pseudocode of Algorithm 1 demonstrates the implementation of the improved A-star algorithm.Calculate rs(j), rtra(j), rturn(j) by ( 1), (7), and ( 8), respectively.13:

Algorithm 1:
if Ni[j] in openlist and Fnew(Ni [j]) is smaller than Fold(Ni[j]) then 14: ) and set parent node of N[j] as N[i] 15: return "path Pn is not found"

Smooth Paths with Geometry
The map is modeled using a grid-based approach, and the planned path consists of line segments formed by the grid.However, the vertices of this path are not conducive to the tracking and smooth navigation of the ship.Since the dynamic motion characteristics of the ship play a crucial role in path planning, and the turning radius of the ship is an important parameter of its dynamic motion characteristics in global path planning, the planned path must be within the range of the ship's maneuverability.To address this issue, this paper adopts the geometric smoothing path method to replace the vertices of the planned path with curve segments, taking into account the ship's minimum turning radius as an important reference parameter.The optimization process is shown in Figure 8.As shown in Figure 8,  −1 ( −1 ,  −1 ),   (  ,   ), and  +1 ( +1 ,  +1 ) are polyline segments on the planned path.We use a circle of radius  such that  −1   and    +1 are tangents to the circle, intersecting at  1 ( 1 ,  1 ) and  2 ( 2 ,  2 ).The calculation process of  1 ,  2 is as follows: As shown in Figure 8, p i−1 (x i−1 , y i−1 ), p i (x i , y i ), and i+1 (x i+1 , y i+1 ) are polyline seg- ments on the planned path.We use a circle of radius R such that p i−1 p i and p i p i+1 are tangents to the circle, intersecting at p new1 (x new1 , y new1 ) and p new2 (x new2 , y new2 ).The calcu- lation process of p new1 , p new2 is as follows: The radius of the circle is set to R = p new1 O, and the coordinate scale coefficient ϕ of the tangent point is set as follows: From p i−1 (x i−1 , y i−1 ), p i (x i , y i ), p i+1 (x i+1 , y i+1 ), and the coordinate scale coefficient ϕ, we get The slopes and formulas of the straight line p i−1 p i and the straight line p i p i+1 are From the slope k 1 and the point p new1 , the vertical straight line y 1 and the straight line y 1 passing through the point p new1 can be obtained.In the same way, y 2 can be obtained (y 2 passes through p new2 and is perpendicular to y 2 ).The intersection of the straight lines y 1 and y 2 is the center of the circle, and the center of the circle is set to O(x o , y o ); then, the function expression of the curve after smooth geometric optimization is as follows: In practical applications, we can adjust the curvature of the smooth curve by changing the size of R, so that the curvature of the optimized curve satisfies the minimum turning radius of ships.

Case Study
Simulation experiments were conducted in this section to validate the effectiveness of the proposed improved A-star path-planning method.First, the path-planning performance of the proposed A-star method was compared with traditional A-star methods, considering obstacles, water depth, water currents, and traffic separation rules.Then, the proposed improved A-star method was tested in real scenes in Zhoushan and Hainan ports.It should be noted that the environmental data for Case 2 and Case 3 were obtained from shipxy.com.In case 2, nautical charts were used for path planning instead of satellite maps to illustrate the bathymetric boundaries and marine traffic diversion areas.In case 1 and case 2, the China-made autonomous cargo ship, 'Jindouyun 0', was selected for the simulation experiment.The ship's key parameters are shown in Table 1.The minimum safe navigation depth was calculated on the basis of the ship's key parameters.For this study, we conducted simulation experiments on the Python 3.8 platform and used a 50 × 40 grid map for the experiment.In order to simulate realistic environmental conditions, we created a complex environment that included current velocity, shallow water areas, and traffic separation zones.

Setup
The relevant model parameters need to be determined to establish the proposed model.The velocity of the current is set to v m = 2m/s.The direction of the current is due east.The ship velocity is set to v U = 4m/s.N[start] is set to (5,8), and N[target] is set to (40,35).The grid length is set to 20 m.The depth of shallow water is set to 1 m.Other parameters of the simulation experiment are shown in Table 2.In order to verify the effectiveness of each model, this section designs a path for each model.Using the model established in Section 3, the following four different cost functions are used for simulation experiments:

Results
Figure 9 compares the four different path-planning results.Path1 is located close to the obstacle and passes through a shallow water area, violating traffic rules and increasing the risk of grounding.Moreover, Path1 has many sharp turns that could lead to ship collisions and groundings.Path2 starts planning the path toward the upper left direction from the starting point, aiming to move away from obstacles and reduce the risk of water currents pushing the ship toward them.This demonstrates the effectiveness of the proposed risk model in this paper.However, Path2 does not comply with the rule of separated traffic, which could increase the risk of collision with oncoming ships when navigating in the opposite direction.Path3 follows the separation rule by driving to the right in the lower part of the map and crossing the separation zone perpendicularly in the upper part of the map to reach the destination.This demonstrates the effectiveness of the traffic model proposed in this paper.However, Path3 is still too close to the obstacle, which is due to the lack of consideration of the risk model.Path4 is a path planned using the improved algorithm proposed in this paper that considers multiple risk factors.This path keeps a safe distance from the obstacle, avoids shallow water areas, and reduces the risk of ship navigation.Path4 also adheres to traffic separation rules, with fewer turns and a smoother trajectory.
With the aid of geometrically smooth curves, the optimized path ensures that the curvature of turns remains within the maneuverability range of the ship, making it more suitable for safe navigation and tracking.The proposed algorithm comprehensively improves the safety of path planning in complex marine environments, making the planned route highly suitable for ship navigation, and demonstrating its superiority over the traditional methods.
J. Mar.Sci.Eng.2023, 11, x FOR PEER REVIEW 14 of 20 of ship navigation.Path4 also adheres to traffic separation rules, with fewer turns and a smoother trajectory.With the aid of geometrically smooth curves, the optimized path ensures that the curvature of turns remains within the maneuverability range of the ship, making it more suitable for safe navigation and tracking.The proposed algorithm comprehensively improves the safety of path planning in complex marine environments, making the planned route highly suitable for ship navigation, and demonstrating its superiority over the traditional methods.To further demonstrate the superiority of the improved algorithm, we calculated risk indicators for two paths: navigation risk   =   (, ).We compared path length, navigation risk, number of turns, maximum turn angle, and adherence to traffic separation rules among the four paths.The risk calculation was based on Equation (1) of the risk model.
The simulation results of the statistical experiment are presented in Table 3. Comparing the data, we can observe that Path1 planned by the traditional A-star algorithm has the shortest length.However, it has significantly higher risks of ship grounding and collision, as well as more turns, indicating a higher navigation risk compared to the algorithm proposed in this paper.Path2 also considers the risk model and has a navigation risk close to Path4.Path3 complies with the traffic model and conforms to traffic rules, but its proximity to the obstacle increases the risk of ship navigation.Paths2-4 have fewer turns compared to Path1, as they all consider the turn model.Path 4 significantly reduces various risks at the expense of a certain path length.Meanwhile, the path is smooth and conforms to traffic separation rules.The turning radius at the path's bends is within the ship's handling capabilities.In summary, the advantages of Path4 prove the effectiveness of the improved A* algorithm.To further demonstrate the superiority of the improved algorithm, we calculated risk indicators for two paths: navigation risk r s = r s (m, n).We compared path length, navigation risk, number of turns, maximum turn angle, and adherence to traffic separation rules among the four paths.The risk calculation was based on Equation (1) of the risk model.
The simulation results of the statistical experiment are presented in Table 3. Comparing the data, we can observe that Path1 planned by the traditional A-star algorithm has the shortest length.However, it has significantly higher risks of ship grounding and collision, as well as more turns, indicating a higher navigation risk compared to the algorithm proposed in this paper.Path2 also considers the risk model and has a navigation risk close to Path4.Path3 complies with the traffic model and conforms to traffic rules, but its proximity to the obstacle increases the risk of ship navigation.Paths2-4 have fewer turns compared to Path1, as they all consider the turn model.Path 4 significantly reduces various risks at the expense of a certain path length.Meanwhile, the path is smooth and conforms to traffic separation rules.The turning radius at the path's bends is within the ship's handling capabilities.In summary, the advantages of Path4 prove the effectiveness of the improved A* algorithm.In this scenario, the effectiveness of the improved A-star method is verified using a real scene of the hidden reef in Zhoushan Harbor.The ship intends to travel from a starting point (29 • 56.551 N, 122 • 13.826 E) to a destination point (29 • 56.96 N, 122 • 13.60 E).The area is characterized by numerous hidden reefs that obstruct ships from passing through.In addition, several shallow areas in this range affect navigation, as depicted in Figure 10.The grid length is set to 25 m, and the velocity of the water current is set to v c = 1 m/s.The direction of the water current is northwest.The geometric smooth path radius R is set to 50 m.It should be noted that the reef area does not adhere to traffic separation regulations due to the low volume of ship traffic in the area, and traffic separation rules are not taken into account in this case.The remaining parameter settings are the same as in Case 1.

Case 2: Path Planning in Real Scenes in Zhoushan Port
In this scenario, the effectiveness of the improved A-star method is verified using a real scene of the hidden reef in Zhoushan Harbor.The ship intends to travel from a starting point (29°56.551N, 122°13.826E) to a destination point (29°56.96N, 122°13.60E).The area is characterized by numerous hidden reefs that obstruct ships from passing through.In addition, several shallow areas in this range affect navigation, as depicted in Figure 10.The grid length is set to 25 m, and the velocity of the water current is set to   = 1m/s.The direction of the water current is northwest.The geometric smooth path radius  is set to 50 m.It should be noted that the reef area does not adhere to traffic separation regulations due to the low volume of ship traffic in the area, and traffic separation rules are not taken into account in this case.The remaining parameter settings are the same as in Case 1.In Figure 10, Path1 and Path2 represent the paths generated by the traditional and improved A-star algorithms, respectively.From Figure 10, it can be observed that the path distance planned by the traditional A-star algorithm is close to the reefs.In complex marine environments, there is a high probability of collision with reefs due to the influence of water currents, which undermines the assurance of safe ship arrival at the destination.Furthermore, Path1 passes through two shallow water areas comparable to the ship's maximum draft, posing a high risk of grounding.Compared with Path1, Path2 avoids all shallow water areas and keeps a certain distance from obstacles to ensure that the ship will not collide with obstacles due to water currents.Table 4 compares various metrics for the paths.According to the experimental data, Path1 traverses shallow water areas below the maximum draft of the ship, resulting in an infinite risk of grounding.The navigation risk associated with Path1 is extremely high, making it unsuitable for ship tracking.On the other hand, Path2 takes into account multiple safety factors during navigation, exhibiting a higher level of safety and thus being more suitable for ship operations.Moreover, Path2 has a turning radius of 50 m (2 grids), well within the maneuverable range of the ship, ensuring a smooth trajectory.In summary, the improved A-star algorithm In Figure 10, Path1 and Path2 represent the paths generated by the traditional and improved A-star algorithms, respectively.From Figure 10, it can be observed that the path distance planned by the traditional A-star algorithm is close to the reefs.In complex marine environments, there is a high probability of collision with reefs due to the influence of water currents, which undermines the assurance of safe ship arrival at the destination.Furthermore, Path1 passes through two shallow water areas comparable to the ship's maximum draft, posing a high risk of grounding.Compared with Path1, Path2 avoids all shallow water areas and keeps a certain distance from obstacles to ensure that the ship will not collide with obstacles due to water currents.Table 4 compares various metrics for the paths.According to the experimental data, Path1 traverses shallow water areas below the maximum draft of the ship, resulting in an infinite risk of grounding.The navigation risk associated with Path1 is extremely high, making it unsuitable for ship tracking.On the other hand, Path2 takes into account multiple safety factors during navigation, exhibiting a higher level of safety and thus being more suitable for ship operations.Moreover, Path2 has a turning radius of 50 m (2 grids), well within the maneuverable range of the ship, ensuring a smooth trajectory.In summary, the improved A-star algorithm significantly reduces ship risks while slightly increasing the path length.Case 2 demonstrates the effectiveness of the proposed model and highlights its practical significance in the context of complex shallow water ship path planning.In this case study, we choose the real scene of Hainan Port to verify the effectiveness of the improved A-star method.There are multiple traffic separation zones in this area, as shown in the rectangular area circled by the pink dotted line in Figure 11.The sides of the traffic separation zone dictate the opposite direction of travel, and ships that violate these rules run the risk of colliding with incoming ships.Therefore, it is crucial to ensure that planned routes respect traffic segregation regulations.In order to verify the effectiveness of the algorithm in this case, the "Yude Ship" is selected for simulation experiments.The "Yude Ship" has a length of 199 m, a full load draft of 12 m, and a minimum turning radius of twice the length of the ship.The planning start point (20 significantly reduces ship risks while slightly increasing the path length.Case 2 demonstrates the effectiveness of the proposed model and highlights its practical significance in the context of complex shallow water ship path planning.In this case study, we choose the real scene of Hainan Port to verify the effectiveness of the improved A-star method.There are multiple traffic separation zones in this area, as shown in the rectangular area circled by the pink dotted line in Figure 11.The sides of the traffic separation zone dictate the opposite direction of travel, and ships that violate these rules run the risk of colliding with incoming ships.Therefore, it is crucial to ensure that planned routes respect traffic segregation regulations.In order to verify the effectiveness of the algorithm in this case, the "Yude Ship" is selected for simulation experiments.The "Yude Ship" has a length of 199 m, a full load draft of 12 m, and a minimum turning radius of twice the length of the ship.The planning start point (20°4.755N, 110°8.501E) and end point (20°15.392N, 110°22.11E) are set.The area is divided into 100 × 100 grids, and the length of each grid is set to 300 m.The water current velocity   is 2 m/s, and the direction is 10° northeast.The smooth path radius  is set to two meshes.11, although both paths avoid all navigation markers and reach the destination safely, their planned paths are quite different.Path2 obeys the traffic separation rules, while Path1 violates the rules, and there is a path traveling in the opposite direction.Table 5 compares the experimental result data of the two paths.According to the experimental data, the reverse driving of Path1 violates the traffic rules, resulting in an infinite risk value.Path2 sacrifices a certain path length to make the planned path comply with traffic separation rules.The path planned by the improved A* algorithm improves the safety of the path and enables the ship to follow the prescribed channel.In summary, Case 3 verifies the effectiveness of the improved A-star algorithm.

Conclusions
This paper presented a ship path-planning approach that considers multiple safety factors.The proposed algorithm aims to enhance ship navigation safety by considering environmental effects, traffic regulations, and ship maneuvering constraints.It considers environmental factors such as water currents and water depth, as well as traffic regulations and the minimum turning radius of the ship.The effectiveness of the proposed A-star algorithm was demonstrated through three cases.The simulation results showed that the algorithm effectively considers multiple risk factors during navigation, maximizing the safety of the voyage.The planned paths not only comply with traffic regulations but also remain within the ship's maneuvering capabilities, ensuring safe and efficient navigation.Additionally, the algorithm strikes a balance between path length and navigation safety, reducing the risks of ship collisions and groundings.These improvements to the Astar algorithm have significant potential for enhancing path-planning safety during ship navigation.The findings contribute to the field of ship navigation safety, benefiting the maritime industry and mitigating the risks associated with ship collisions and groundings.
With the rapid development of meteorology and measurement technology, more accurate environmental information can be forecasted.By utilizing this information, safer and more precise paths can be generated.The proposed path-planning system is generally applicable to ships of any size, as most parameters such as ship dimensions, maneuvering constraints, and water depth are used as input parameters.
A major drawback of the proposed path-planning method is the increased time complexity due to the increased number of nodes and computational burden.This can be reduced through code optimization, and the time used for a priori path planning before actual navigation would not substantially affect the operation of the ship.Second, some assumptions and simplifications in this article may differ from reality.In future research, the consideration of factors such as weather can be explored to plan paths that avoid adverse weather conditions.

Figure 1 .
Figure 1.Correspondence between risk factors and models.

Figure 1 .
Figure 1.Correspondence between risk factors and models.
, θ mn is the angle between vector − −−−−− → N[m]O[n] and the horizontal direction, while − −−−−− → N[m]O[n] represents the angle formed between the current position of the ship N[m] and the obstacle O[n].

Figure 2 .
Figure 2. Schematic diagram of calculating risk.In Figure 2, assuming that node N[m] is the node where the ship sails at time   , it can be observed that at this moment the ship has collision risks with obstacles O[n] and O[n + 1]. represents the angle between the vector [][] ���������������������⃗ and the water current   .By calculating , the risk value at node N[m] can be computed using Equation (2).To ensure that the ship can avoid grounding areas, we define  ℎ () as follows:

Figure 2 .
Figure 2. Schematic diagram of calculating risk.In Figure 2, assuming that node N[m] is the node where the ship sails at time t i , it can be observed that at this moment the ship has collision risks with obstacles O[n] and O[n + 1].α represents the angle between the vector − −−−−− → N[m]O[n] and the water current v cur .By calculating α, the risk value at node N[m] can be computed using Equation (2).To ensure that the ship can avoid grounding areas, we define r depth (m) as follows:

Figure 3 .
Figure 3. Schematic diagram of local search.

Figure 3 .
Figure 3. Schematic diagram of local search.

Figure 4 .
Figure 4. Schematic diagram of the traffic model.

Figure 5 .
Figure 5. Schematic diagram of the turn model.

Figure 4 .
Figure 4. Schematic diagram of the traffic model.
where r turn (m) is the turning cost at node N[m], N[m].s is the child node of node N[m], and N[m].f is the parent node of node N[m].As shown in Figure 5, the ship is at node N[m] at time t i .The turning cost here is estimated by calculating the angle β i .β i is the angle of vector − −−−−−−− → N[m]N[m].si toward the vector − −−−−−−− → N[m].f N[m] .A greater turning range at node N[m] attracts a greater turning cost.This model not only reduces the number of turns but also limits the scope of turns to a certain extent.J. Mar.Sci.Eng.2023, 11, x FOR PEER REVIEW 8 of 20

Figure 4 .
Figure 4. Schematic diagram of the traffic model.

Figure 5 .
Figure 5. Schematic diagram of the turn model.Figure 5. Schematic diagram of the turn model.

Figure 5 .
Figure 5. Schematic diagram of the turn model.Figure 5. Schematic diagram of the turn model.

Figure 6 .
Figure 6.Obstacles division and water depth standards.

Figure 6 .
Figure 6.Obstacles division and water depth standards.

Figure 6 .
Figure 6.Obstacles division and water depth standards.

Figure 7 .
Figure 7. Schematic diagram of eight neighborhoods.Figure 7. Schematic diagram of eight neighborhoods.

Figure 7 .
Figure 7. Schematic diagram of eight neighborhoods.Figure 7. Schematic diagram of eight neighborhoods.

Figure 9 .
Figure 9. Simulation results of four different cost functions.

Figure 9 .
Figure 9. Simulation results of four different cost functions.

Figure 10 .
Figure 10.The path planned by the proposed A-star algorithm in Zhoushan port, China.

Figure 10 .
Figure 10.The path planned by the proposed A-star algorithm in Zhoushan port, China.
• 4.755 N, 110 • 8.501 E) and end point (20 • 15.392 N, 110 • 22.11 E) are set.The area is divided into 100 × 100 grids, and the length of each grid is set to 300 m.The water current velocity v c is 2 m/s, and the direction is 10 • northeast.The smooth path radius R is set to two meshes.J. Mar.Sci.Eng.2023, 11, x FOR PEER REVIEW 16 of 20

Figure 11 .
Figure 11.The path planned by the proposed A-star algorithm in Hainan port, China.In Figure 11, Path1 and Path2 represent paths generated by the traditional A-star algorithm and the improved A-star algorithm, respectively.The area framed by the dotted line of the pink rectangle indicates the traffic control area where ships are required to obey the traffic separation rules.Pink arrows indicate the navigation direction for each area.As

Figure 11 .
Figure 11.The path planned by the proposed A-star algorithm in Hainan port, China.In Figure 11, Path1 and Path2 represent paths generated by the traditional A-star algorithm and the improved A-star algorithm, respectively.The area framed by the dotted line of the pink rectangle indicates the traffic control area where ships are required to obey the traffic separation rules.Pink arrows indicate the navigation direction for each

Table 3 .
Comparison of experimental simulation data.

Table 3 .
Comparison of experimental simulation data.

Table 4 .
Comparison of experimental simulation data.

Table 4 .
Comparison of experimental simulation data.

Table 5 .
Comparison of experimental simulation data.