1 Introduction

Over the past decade, ship autonomy technology has made significant advancements due to extensive research on intelligent algorithms such as deep learning and bionic algorithms (Chen et al. 2021; Xiao et al. 2021; Tang et al. 2021; Öztürk et al. 2022; Xing et al. 2022). In the pursuit of achieving full autonomy for ships, path planning algorithms play a crucial role. The path planning algorithm aims to optimize the economy and safety of the ship while performing tasks (Niu et al. 2020). One aspect that has garnered significant attention from scholars is the economy of the path, with a focus on reducing carbon emissions and operating costs (Barreiro et al. 2022; Du et al. 2022a). In particular, for Unmanned Surface Vehicles (USVs) with limited energy, the energy required for the path determines the feasibility of the task. To guide the ship to the destination safely with lower energy consumption in the intricate marine environment, an advanced path planning algorithm considering energy consumption is urgently needed.

Path planning algorithms can be categorized into two types based on the availability of environmental information: global path planning algorithms and local path planning algorithms (Zhao et al. 2023). The global path planning algorithm primarily focuses on ensuring the optimality of the path using known information. On the other hand, the local path planning algorithm is specifically designed to handle unknown risks that may arise during navigation. As the global path planning significantly influences the energy consumption required for ship mission execution, this article will primarily concentrate on researching global path planning algorithms.

For the ship path planning problem, many algorithms and their variants have been used, such as Dijkstra's algorithm (Zyczkowski and Szlapczynski 2023), A* algorithm (Song et al. 2019), genetic algorithm (GA; Wang et al. 2020), ant colony optimization (ACO; Dong et al. 2021), particle swarm optimization (PSO; Du et al. 2022b), and pigeon-inspired optimization (PIO; Duan and Qiao 2014). Dijkstra's algorithm and A* algorithm are commonly used graph-based methods for calculating the shortest path between two points. These algorithms are highly efficient for small-scale path planning tasks. However, they may require significant computational time when dealing with complex environments (Gu et al. 2023). Compared to graph-based methods, intelligent algorithms like GA, ACO, and PSO demonstrate better adaptability in handling complex path planning tasks. Among them, the ACO is widely utilized for solving path planning problems by virtue of its self-organization, parallelism, and positive feedback (Liu et al. 2017; Hou et al. 2022; Yu et al. 2022). The ACO algorithm is generally effective, but a typical negative feature is its tendency to fall into a local optimum (Stodola et al. 2022). To this end, researchers have improved and extended the fundamentals of the algorithm with various techniques.

In ACO, ants choose nodes randomly through a roulette selection process based on node information. While this approach enhances the global search ability, it may also impact the convergence speed of the algorithm. Thus, a pseudo-random-proportional rule is designed (Dorigo and Gambardella 1997), and compared to the traditional state transition rule it prefers nodes with low cost and a high amount of pheromones, thereby accelerating the convergence of the algorithm. Based on this, the researchers made improvements to the control parameter by adjusting it according to various factors such as the quality of the solution (Luo et al. 2020), the number of iterations (Wu et al. 2023), and the diversity of the solution (Zhang et al. 2021a). To address the drawbacks caused by the uniform distribution of initial pheromones, some methods of unevenly distributing pheromones are usually adopted to improve the performance of ACO. These methods include providing extra pheromones to the semicircular region where the target point is located (Tang and Xin 2022), adding additional pheromones to the elliptical region between the target point and the starting point (He and Fan 2021), and adaptively allocating pheromones according to the distance of the node from the starting point and the target point (Luo et al. 2020; Zhang et al. 2021b; Wu et al. 2023). To enhance the guidance of previous ants to subsequent ants, Miao et al. (2021) performed additional rewards and penalties for the optimal and worst paths after one iteration, respectively. Liu et al. (2017) devised a new pheromone diffusion strategy to improve the search performance of the algorithm, where the pheromone diffuses along the direction of the potential field force. In addition to optimizing the fundamentals of ACO, some studies have embarked on further optimization of the solutions, such as comparing and recombining different solutions to obtain a better solution (Gao et al. 2020; Hou et al. 2022) or discarding some redundant nodes (Yang et al. 2019). Based on the above analysis, the primary challenges to enhancing the performance of ACO in global path planning can be summarized as follows: (1) striking a balance between global exploration and convergence speed, and (2) enhancing solution utilization and post-processing.

The energy consumption of ships during navigation is intricately linked to the marine environment. Therefore, it is necessary to obtain the relationship model between ship energy consumption and the marine environment. In the study conducted by Xia et al. (2019), a calculation method for ship energy consumption is proposed using the ship dynamics model. On the other hand, Lee et al. (2011, 2015) calculated the energy consumption of ships by considering the work done to overcome environmental resistance. Besides, calculations using either the fitted formula (Zhou 2020) or main engine power and sailing resistance (Du et al. 2022a; Han et al. 2022) are also commonly used.

The above-mentioned research has achieved some achievements, however, it should be noted that there is limited research on ship energy-saving path planning. Developing an algorithm that can effectively plan a global path for energy-saving while considering ship motion characteristics remains a challenging task. For example, in the process of ship energy-saving path planning, the ship energy consumption model is required to take into account both accuracy and efficiency. Additionally, most of the existing algorithms still have some weaknesses in complex marine environments, such as easy to fall into local optimum and excessive turning points. To this end, this paper proposes an adaptive ant colony system (AACS) for energy-saving path planning of ships. Firstly, inspired by previous research, a ship energy consumption estimation model considering the influence of wind, wave, and current on ship energy consumption is designed. This work aims to save energy by leveraging the marine environment. Therefore, the proposed ship energy consumption estimation model primarily calculates the energy expended by the ship to counteract external disturbances. Secondly, our proposed algorithm improves on the fundamentals of ACS based on the diversity of the planning process and the quality of the solution. Given the diversity of the planning process, the proportion of algorithms exploitation and exploration is adaptively adjusted. And the number of ants involved in the global updating and recombination of solutions is based on the quality of the solution in the iteration. Also, to further reduce the energy consumption and redundant nodes, an improved turning point optimization method and B-spline curve are designed. The contributions of this work are summarized as follows:

  1. (1)

    A ship energy consumption estimation model for evaluating and guiding energy-saving path planning is established. The model can effectively reflect the influence of wind, wave, and current on energy consumption during ship navigation.

  2. (2)

    By introducing the process evaluation method and the improved recombination mechanism into ACS, an adaptive ant colony system is proposed to address the problem of ship energy-saving path planning. AACS effectively balances global search and convergence speed, while also leveraging valuable components of suboptimal solutions to enhance the performance of the algorithm.

  3. (3)

    A post-processing smoothing approach including an improved turning point optimization method and a B-spline smoothing method is proposed to reduce the energy consumption of the path and improve the smoothness.

The rest parts of this study are structured as follows: In Sect. 2, the environmental modeling and the energy consumption estimation model are described. In Sect. 3, the improving methods and process of AACS are explained. In Sect. 4, the comparative experimental results are discussed. Conclusions are given in Sect. 5.

2 Related model of ship path planning problem

2.1 Grid environment model

Environment modelling is a technique for simulating real application scenarios. It is a prerequisite for path planning and provides environmental information for algorithm implementation (Liu et al. 2023). In this article, mainly considering the position changes of the ship, it is assumed that the marine environment is a two-dimensional space. In terms of modeling two-dimensional space, the grid method is a common method (Chen et al. 2021). The grid method decomposes the space S into white grids and black grids, which represent navigable areas Sf and non-navigable areas So, respectively (Zhao et al. 2023). The white grid can store various kinds of environmental information to further simulate the actual environment. To ensure the safety of ship navigation, the proposed model considers errors in map data and ship positioning information. It expands the non-navigable area outwards, and the expanded part is treated as gray grids, representing the non-navigable risk area Sr. The composition of the space is shown in Eq. (1). Figure 1 represents the process of gridding a virtual environment into a grid map after expanding the obstacles. Besides, the grid coding method used in the model primarily involves serial index and coordinates. In the cost calculation process, it is often necessary to convert the serial index into coordinates. The conversion method is shown in Eq. (2).

$$ S{ = }S_{f} + S_{o} + S_{r} $$
(1)
$$ \left\{ {\begin{array}{*{20}l} {x = \left\{ {\begin{array}{*{20}l} {b\left( {\bmod \left( {index,N_{x} } \right) - 0.5} \right){ , }\bmod \left( {index,N_{x} } \right) \ne 0} \\ {b\left( {N_{x} - 0.5} \right), \bmod \left( {index,N_{x} } \right) = 0 \, } \\ \end{array} } \right.} \\ {y = b\left( {N_{y} + 0.5 - {\text{ceil}}\left( {index/N_{x} } \right)} \right) \, } \\ \end{array} } \right. $$
(2)

where b is the size of the grid; Nx and Ny are the number of grids in row and column direction respectively.

Fig. 1
figure 1

Environmental gridding

2.2 Energy consumption estimation model

For planning of ship’s energy-saving route, it is necessary to obtain the estimation model of the energy consumption required by the ship moving between grids. To this end, this study presents a ship energy consumption estimation model, inspired by the approach proposed by Lee et al. (2011). This method assumes that the resistance of the ship and the thrust of the propulsion system are balanced, thereby simplifying the calculation of energy consumption to the calculation of work required to overcome resistance. The coefficients in the energy consumption estimation model are given in Table 1.

Table 1 Coefficients in the energy consumption estimation model

The main sources of resistance to a ship while sailing are wind, wave, and current. In practical application problems, the wave forces acting on ships are divided into the first-order wave forces and the higher-order wave forces (Zhang et al. 2022). Among these, second-order wave forces are the main factor influencing the position of the ship. This paper assumes that the second-order wave force is a constant value and applies the calculation method proposed by Daidola to determine the wave drift force acting on the ship in regular waves. The calculation method can be expressed as:

$$ \left[ {\begin{array}{*{20}c} {F_{wave\_x} } \\ {F_{wave\_y} } \\ \end{array} } \right] = \frac{{\rho_{sea} gL\xi^{2} }}{2}\left[ {\begin{array}{*{20}c} {C_{xw} \cos \left( \delta \right)} \\ {C_{yw} \sin \left( \delta \right)} \\ \end{array} } \right] $$
(3)

where wave drift force coefficients Cxw and Cyw can be calculated using the regression formula derived by Daidola (Sun 2021):

$$ \left\{ {\begin{array}{*{20}c} {C_{xw} = 0.05 - 0.2\left( {\frac{\lambda }{L}} \right) + 0.75\left( {\frac{\lambda }{L}} \right)^{2} - 0.51\left( {\frac{\lambda }{L}} \right)^{3} \, } \\ {C_{yw} = 0.46 + 6.83\left( {\frac{\lambda }{L}} \right) - 15.65\left( {\frac{\lambda }{L}} \right)^{2} + 8.44\left( {\frac{\lambda }{L}} \right)^{3} } \\ \end{array} } \right. $$
(4)

For the wind, the approximate equation shown in Eq. (5) is used to calculate the disturbance force it exerts on the ship.

$$ \left[ {\begin{array}{*{20}c} {F_{wind\_x} } \\ {F_{wind\_y} } \\ \end{array} } \right] = \frac{{\rho_{air} }}{2}\left[ {\begin{array}{*{20}c} {C_{x}^{wind} u_{rw} \left| {u_{rw} } \right|A_{ax} } \\ {C_{y}^{wind} v_{rw} \left| {v_{rw} } \right|A_{ay} } \\ \end{array} } \right] $$
(5)

Based on the slender body assumption, the resistance caused by the current when the ship is sailing can be expressed as follows (Zhang et al. 2022; Lee et al. 2011).

$$ \left[ {\begin{array}{*{20}c} {F_{current\_x} } \\ {F_{current\_y} } \\ \end{array} } \right] = \frac{{\rho_{sea} }}{2}\left[ {\begin{array}{*{20}c} {S_{wet} C_{T} u_{rc} \left| {u_{rc} } \right|} \\ {DC_{D} Lv_{rc} \left| {v_{rc} } \right|} \\ \end{array} } \right] $$
(6)

When the next node j to be moved by the ship is determined, the energy consumed Etotal of the ship from i to j can be calculated according to the following.

$$ \left[ {\begin{array}{*{20}c} {E_{x}^{each} \left( {i,j} \right)} \\ {E_{y}^{each} \left( {i,j} \right)} \\ \end{array} } \right] = \frac{{L_{ij} }}{2}\left[ {\begin{array}{*{20}c} {F_{x}^{each} \left( i \right) + F_{x}^{each} \left( j \right)} \\ {\left( {F_{y}^{each} \left( i \right)v_{y}^{each} \left( i \right) + F_{y}^{each} \left( j \right)v_{y}^{each} \left( j \right)} \right)\frac{1}{u}} \\ \end{array} } \right] $$
(7)
$$ E_{total} \left( {i,j} \right) = \sum {E_{x}^{each} \left( {i,j} \right) + \sum {E_{y}^{each} \left( {i,j} \right)} } $$
(8)

In the process of edge cost calculation, there will inevitably be negative energy consumption values. For state transition rule, negative values should be avoided. In the y-direction, the ship always needs to do work to offset the impact of the environment, so it is reasonable to take the absolute value of \(E_{y}^{each}\). And in the x-direction, since the modification of the edge cost is easy to impair the physical meaning, the negative energy consumption value is often set to 0.

3 Design of the adaptive ant colony system

3.1 Process evaluation method

Ant colony system (ACS) is a swarm intelligence heuristic algorithm used to search for optimal solutions. As a well-known variant of ACO, ACS has good search ability, but it still has the disadvantage of being prone to falling into local optimum (Zhang et al. 2021b). To address this, two process evaluation indexes are designed and introduced into ACS.

  1. (1)

    Process diversity index

    The diversity of candidate solutions reflects the current global search ability of the algorithm, but few studies have analyzed and utilized it. In this paper, information entropy is introduced as a process diversity index to quantify the diversity in the optimization process. Without loss of generality, it is assumed that r different paths are obtained by e ants, where the number of ants searching for path i is a. And the probability of path i being searched and the information entropy of this iteration can be calculated according to Eqs. (9) and (10).

    $$ P_{i} \left( t \right) = \frac{a}{e} $$
    (9)
    $$ H\left( t \right) = - \sum\limits_{i = 1}^{r} {P_{i} \left( t \right)\ln P_{i} \left( t \right)}/ \ln \left( e \right) $$
    (10)

    where \(P_{i} \left( t \right)\) represents the probability that path i is searched in the t-th iteration;\(H\left( t \right)\) is the information entropy in the t-th iteration.

  2. (2)

    Path quality index

    Under the influence of the local updating rule, ACS will obtain more different solutions in a single iteration compared to ACO. In order to assess different solutions effectively, it is crucial to establish an evaluation index. Therefore, a path quality index is proposed in this work, mapping different solutions to [0, 2]. When the energy consumption of path i is lower than the current optimal solution, path i is mapped to an interval greater than 1, and the degree of exceeding 1 is negatively correlated with the energy consumption; otherwise, path i is mapped to an interval smaller than 1. The path quality index is designed as follows.

    $$ \varsigma \left( i \right) = 1 + \frac{2}{\pi }\arctan \left( {\frac{{E_{\min } - E\left( i \right)}}{{E_{aver} - E_{\min } + 1}}} \right) $$
    (11)

    where \(\varsigma \left( i \right)\) is the mapping value of path i;\(E\left( i \right)\) is energy consumption of path i;\(E_{\min }\) is the energy consumption of the current optimal path, and \(E_{aver}\) is the average energy consumption of all the complete paths in this iteration.

3.2 Adaptive ant colony system

3.2.1 Improved heuristic information function

To achieve the planning of energy-saving paths, it is necessary to combine the heuristic information function with the energy consumption estimation model mentioned in Sect. 2.2. However, the heuristic information function based only on the energy consumption value tends to lead the algorithm into a deadlock state. Therefore, in this article, a novel heuristic information function is designed by combining energy consumption, distance information of the goal point and distance information of the next point. The function is calculated as follows:

$$ \omega_{ij} = \frac{{k_{1} }}{E\left( j \right)} + \frac{1}{{k_{2} d_{jz} + k_{3} d_{ij} }} $$
(12)

where djz and dij are the Euclidean distances from the candidate node j to the goal point z andthe current point \(i\), respectively; And k1, k2 and k3 are the corresponding coefficients respectively.

3.2.2 Adaptive state transition rule

Heuristic algorithms are very sensitive to parameters and, therefore, these algorithms generally lack adaptability to different application scenarios (Stodola et al. 2022). As an essential step of ACS, the state transition rule plays a significant role in the optimization process. However, the control parameter of the state transition rule in ACS is usually set manually as fixed values and cannot be dynamically adjusted according to the present state. For enhancing the algorithm’s ability to perform global searches, an adaptive state transition rule based on the process diversity index is proposed, which can be calculated according to Eqs. (13) and (14).

$$ \varepsilon \left( t \right) = \left\{ {\begin{array}{*{20}l} {q_{0} + \left( {H\left( t \right) - \varphi } \right) \, , \, H\left( t \right) > \varphi } \\ { \, q_{0} \, , \, H\left( t \right) \le \varphi } \\ \end{array} } \right. $$
(13)
$$ s = \left\{ {\begin{array}{*{20}l} {\mathop {\arg \max }\limits_{{j \in allowed_{k} }} \left[ {\tau_{ij} \left( t \right)} \right]^{\alpha } \left[ {\omega_{ij} \left( t \right)} \right]^{\beta } \, , \, if \, q \le \varepsilon \left( t \right)} \\ {\frac{{\left[ {\tau_{ij} \left( t \right)} \right]^{\alpha } \left[ {\omega_{ij} \left( t \right)} \right]^{\beta } }}{{\sum\limits_{{s \in allowed_{k} }} {\left[ {\tau_{is} \left( t \right)} \right]^{\alpha } \left[ {\omega_{is} \left( t \right)} \right]^{\beta } } }} \, , \, if \, q > \varepsilon \left( t \right)} \\ { \, 0 \, , \, else} \\ \end{array} } \right. $$
(14)

where τij is the pheromone value of the edge \(ij\);\(\varepsilon \left( t \right)\) is a dynamic control parameter in the t-th iteration; q is a random number between [0,1]; q0 is the initial value of the control parameter; α and β are the coefficients that adjust the influence of pheromone and heuristic information on the node selection, respectively;\(\varphi\) is a constant and its value with q0 will be determined by statistical experiments in Sect. 4.1.

3.2.3 Adaptive global updating rule

For ACS, once all ants have complete their search, pheromone is updated on the edges of the most energy-saving path according to

$$ \tau \left( {t + 1} \right) = \left( {1 - \rho } \right) \cdot \tau \left( t \right) + \rho \cdot \Delta \tau^{\min } $$
(15)
$$ \Delta \tau^{\min } = \frac{Q}{{E_{\min } }} $$
(16)

where ρ is a pheromone decay parameter;\(\Delta \tau^{\min }\) is the pheromone increment on the best path; Q is the update intensity of pheromones; Emin is the energy consumption of the best path.

The traditional global updating rule, as shown in Eq. (15), can effectively converge the ant colony to the vicinity of the sub-optimal solution. However, it is also easy to fall into local optimum. To overcome the above shortcoming, an adaptive global updating rule based on the path quality index is proposed.

Specifically, the repetitive parts in the effective solution will be removed after each iteration, and the remaining parts will be evaluated and mapped to [0,2] according to Eq. (11). In order to ensure good global search ability in the early stage and continuously strengthen the convergence capabilities with iterations, this paper proposes a dynamic threshold \(\nu\) to regulate the number of pheromone update objects. When the mapping value of the solution is greater than the threshold value, the corresponding pheromone will be rewarded, otherwise no operation will be performed. The adaptive global updating rule is defined as:

$$ \tau \left( {t + 1} \right) = \left\{ {\begin{array}{*{20}c} {\left( {1 - \rho } \right) \cdot \tau \left( t \right) + \rho \cdot \left( {\sum\limits_{k = 1}^{f} {\Delta \tau_{k} \left( t \right) + \Delta \tau^{\min } } } \right) \, , \, if \, f > 0 \, } \\ { \, \left( {1 - \rho } \right) \cdot \tau \left( t \right) + \rho \cdot \Delta \tau^{\min } \, ,{\text{ otherwise }}} \\ \end{array} } \right. $$
(17)
$$ \Delta \tau_{k} \left( t \right) = \frac{{Q \cdot \left( {f - g_{k} + 1} \right) \cdot \varsigma \left( k \right)^{2} }}{{f \cdot k \cdot E_{k} }} $$
(18)
$$ \nu = \nu_{0} - \left( {\nu_{0} - 1} \right) \cdot \left( \frac{2t}{T} \right)^{2} $$
(19)

where f is the number of effective solutions after filtering; gk is the ranking of the effective solution in this iteration and \(\nu_{0}\) is the initial value of the dynamic threshold.

3.2.4 Improved recombination mechanism

The difference between ACS and ACO is that ACS does not require all ants to concentrate on a certain solution, but rather allows ants to search in the neighborhood of a certain solution. Based on this principle, a large number of different solutions will be obtained after each search. Although the vast majority of these solutions are not optimal, they probably contain a fraction of the optimal solution (Gao et al. 2020; Hou et al. 2022). And this part is not well utilized by ACS. In order to fully utilize the suboptimal solution, an improved recombination mechanism is proposed in this paper.

Figure 2 is a simple example to illustrate this mechanism. Figure 2a displays the effective paths obtained by the ant colony after completing a search. Among these paths, there are paths that contain parts of the global optimal path, as well as numerous paths with low quality. It is evident that recombination with inferior paths generally offers only limited improvement. To enhance search efficiency, the dynamic threshold is introduced to filter the recombined objects. Only paths that are larger than the current threshold are selected for recombination with the current optimal path. Figure 2b shows the effective path after filtering. The red path is the current optimal path. Normally, the current optimal path is the optimal path that the algorithm searches for in the iterative process. By recombining the current optimal solution with the filtered effective path, the quality of the current optimal path is improved, as shown in Fig. 2c.

Fig. 2
figure 2

Example of the improved recombination mechanism

3.3 Post-processing smoothing approach

3.3.1 Improved turning point optimization method

After discretizing the environment by the grid method, the ant’s search is constrained to eight directions. Given this characteristic, the paths obtained through planning usually have many unnecessary turns. These turns not only increase the energy cost of the ship in practice but even make the ship impossible to track. Therefore, an improved turning point optimization method is proposed to reduce the number of unnecessary turns in the path.

The proposed method differs from the traditional method in that it strikes a balance between path smoothness and energy consumption. The specific implementation process is as follows: For the original path, the set of all nodes as

$$ N = \left\{ {N_{1} ,N_{2} , \ldots ,N_{n - 1} ,N_{n} } \right\} $$
(20)

Starting from N1, find the nodes in the set N that can be directly connected and do not collide with the obstacle. Without loss of generality, let the set of these nodes as

$$ N^{*} = \left\{ {N_{2} ,N_{3} , \ldots ,N_{i - 1} ,N_{i} } \right\} $$
(21)

If it requires less energy to go directly from N1 to Ni than the original path, the intermediate points are removed, and Ni is used as the starting point to continue optimizing until the end point is reached. Otherwise, the nodes are judged sequentially from far to near until a suitable node is found. Besides, if none of these nodes satisfy the condition or if N* is empty, the process is repeated using the next point N2 as the starting point.

As shown in Fig. 3, Path 1 represents the result obtained using the proposed method, while Path 2 represents the result obtained using a common method (Ma et al. 2023). Although Path 2 is smoother and shorter compared to Path 1, it requires 3.44% and 4.05% more energy than the original path and Path 1, respectively. In contrast, Path 1 sacrifices some of its smoothness to save more energy.

Fig. 3
figure 3

Example of the improved turning point optimization method

3.3.2 Smoothing method using B-spline curve

To further improve the smoothness of the path to meet the navigation requirements of the ship, B-spline curve is introduced in this paper. Since the navigation space of the ship is discretized, the planned path consists of n nodes, and these n nodes can be used as control points Pi of a B-spline curve. The formula of the B-spline curve is shown in Eq. (22).

$$ P\left( u \right) = \sum\limits_{i = 1}^{n + 1} {P_{i} N_{i,k} \left( u \right)} $$
(22)

where u is the knot vector, and \(N_{i,k} \left( u \right)\) is the B-spline based function defined by the following DeBoor-Cox recursion formulas (Yang et al. 2019)

$$ N_{i,1} \left( u \right) = \left\{ {\begin{array}{*{20}l} {1 \, ,{\text{ x}}_{i} \le u < x_{i + 1} \, } \\ {0 \, , \, otherwise \, } \\ \end{array} } \right. $$
(23)
$$ N_{i,k} \left( u \right) = \frac{{\left( {u - x_{i} } \right)N_{i,k - 1} \left( u \right)}}{{x_{i + k - 1} - x_{i} }} + \frac{{\left( {x_{i + k} - u} \right)N_{i + 1,k - 1} \left( u \right)}}{{x_{i + k} - x_{i + 1} }} $$
(24)

where xi is the knot values.

3.4 Process of adaptive ant colony system

After introducing the above improving strategies specifically, a complete adaptive ant colony system is formed within the following steps:

  1. Step 1:

    Load the marine environment model for path planning and initialize the parameters.

  2. Step 2:

    Calculate the control parameter for this iteration according to Eq. (13). Then, each ant selects the next node according to Eq. (14). After completing a move, the pheromone is locally updated. Repeat this process until the ant reaches the target point or falls into a deadlock state.

  3. Step 3:

    Once all ants have completed their search, all the duplicated parts of the set for effective paths will be removed and the remaining parts will be evaluated according to Eq. (11). And the dynamic threshold at time t is calculated using Eq. (19). The remaining part is filtered based on the dynamic threshold.

  4. Step 4:

    The filtered effective paths are optimized based on an improved recombination mechanism and the current optimal path is updated.

  5. Step 5:

    Update pheromones according to Eqs. (17) and (18). And the diversity of paths in this iteration is evaluated using Eqs. (9) and (10).

  6. Step 6:

    Steps 2–5 will be repeated continuously until the stopping conditions are satisfied.

  7. Step 7:

    The optimal path is post-processed based on the improved turning point optimization method and the smoothing method using B-spline curves.

  8. Step 8:

    The optimal path is outputted.

The flowchart of the energy-saving path planning method is shown in Fig. 4.

Fig. 4
figure 4

Flowchart of AACS

4 Experimental results and discussions

To verify the effectiveness of AACS in solving the problem of energy-saving path planning for ships, a series of experiments are conducted in different environments. Considering that ant colony algorithm is a probabilistic optimization algorithm, to ensure the reliability of the experimental results, each group of experiments is repeated 60 times. The simulation configuration used in this work is the following: Windows 10 64-bit; processor, Intel(R) Core(TM) i7-12700KF clocked at 3.6 GHz; memory, 32 GB; simulation software, Matlab R2018b.

4.1 Parameter determination

The selection of parameters is a critical and indispensable step for ant colony algorithm, which directly affects the performance of the algorithm. However, since there is no accepted and effective method for parameter selection, most studies use statistical experiments to determine the parameters of the algorithm. Therefore, in order to determine the suitable parameters for AACS, comprehensive statistical experiments are performed in this section. For brevity, only the determination processes for q0, φ and \(\nu_{0}\) are introduced in the environment of Fig. 5. Among them, q0 is taken in the range of [0.1,0.9] with an interval of 0.1, φ is taken in the range of [0.6,1] with an interval of 0.05, and \(\nu_{0}\) is taken in the range of [0,1] with an interval of 0.05. Other critical parameters in the test are set as shown in Table 2, and they are determined in a similar process.

Fig. 5
figure 5

Simulation environment in statistical experiment

Table 2 Parameters setting of AACS in statistical experiment

To adaptively adjust the proportion of exploration and exploitation, parameters q0 and φ are used in Eq. (13) to change the control parameter. Different values of q0 and φ are set up for combined testing, and the experimental results are shown in Fig. 6. According to Eq. (10), the maximum value of H(t) is 1. Therefore, when \(\varphi = 1\), the control parameter \(\varepsilon \left( t \right) = q_{0}\); that is, the traditional state transition rule, which can be used as an experimental comparison benchmark. From the experimental results, it can be found that the value of q0 has a large impact on both the energy consumption and the planning efficiency. In detail, as q0 increases, the energy consumption usually decreases and then increases. And the magnitude of the decrease becomes larger rapidly with the increase of φ. In terms of planning efficiency, the efficiency tends to improve as q0 increases, but there are small fluctuations in the process. Meanwhile, the overall efficiency tends to decrease as φ increases. Moreover, compared with the traditional state transition rule, it can be found that both energy consumption and planning efficiency are improved after introducing the improvement. In general, the recommended value ranges based on the present work are \(q_{0} \in \left[ {0.4,0.6} \right]\) and \(\varphi \in \left[ {0.65,0.75} \right]\).

Fig. 6
figure 6

Results of statistical experiments on q0 and \(\varphi\)

The optimal number of ants for contribute to the global updating rule has been a widely researched topic. In ant system all the ants contribute, while in the ACS only the best one does. Obviously, there are intermediate possibilities. Therefore, the parameter \(\nu_{0}\) is used in Eq. (19) to dynamically control the number of these ants. The experimental results of \(\nu_{0}\) are shown in Fig. 7. On the whole, the performance of the algorithm improves as \(\nu_{0}\) decreases. When \(\nu_{0} \le 0.6\), the performance of the algorithm varies less with \(\nu_{0}\). However, when \(\nu_{0} > 0.6\), the performance of the algorithm degrades rapidly with the increase of \(\nu_{0}\). Based on the above, it can be found that the number of ants contributing to the global updating rule within a reasonable range should be set more in the early stage and slowly reduced with iterations. Therefore, the recommended value ranges is \(\nu_{0} \in \left[ {0.05,0.25} \right]\).

Fig. 7
figure 7

Results of statistical experiments on \(\nu_{0}\)

4.2 Experimental simulation in static environment

To verify the adaptability and effectiveness of AACS in static environments, three different maps are created for simulation, and the size of a unit grid is 1 × 1 km. Since the influence of the marine environment is not taken into account, the path length is the most important factor in determining the energy consumption of the ship. In this section, the path length is used as the energy consumption index to evaluate the results obtained by all algorithms. In addition, two novel improved ACO which are IACA (Luo et al. 2020) and IAACO (Miao et al. 2021), A* algorithm, ACS, PSO, and an improved pigeon-inspired optimization (IPIO; Xia et al. 2022) are used for comparison. The parameters of each algorithm are set as follows:

  • AACS: m = 50, T = 100, Q = 50, α = 1.1, β = 6, ρ = 0.2, ρlocal = 0.2, k1 = 0, k2 = 1, k3 = 1, k = 1, q0 = 0.5, φ = 0.75, ν0 = 0.25.

  • IAACO: m = 50, T = 100, Q = 2.5, α = 1, β = 7, Environment 1: δ0 = 0.15, κ = 0.2; Environment 2: δ0 = 0.5, κ = 0.15; Environment 3: δ0 = 0.5, κ = 0.2.

  • IACA: m = 50, T = 100, Q = 100, α = 1.1, β = 7, ρ = 0.2, λ = 0.2, Environment 1: q0 = 0.3, N0 = 5; Environment 2: q0 = 0.3, N0 = 8; Environment 3: q0 = 0.7, N0 = 8;

  • ACS: m = 50, T = 100, Q = 50, α = 1.1, β = 6, ρ = 0.2, ρlocal = 0.2, q0 = 0.7.

  • PSO: m = 100, T = 100, c1 = 2, c2 = 2, w = 0.9.

  • IPIO: m = 100, Nc1 = 75, Nc2 = 100, R = 0.2, F = 0.5, γ = 0.5, CR = 0.3.

The simulation results are presented in Table 3, which primarily compares the optimal results and average results obtained by each algorithm. Additionally, the convergence performance of each variant of ACO is also compared to validate the effectiveness of the improvement. Figure 8 displays the optimal paths obtained by each algorithm in three different environments. The box-whisker plot of the path length for each algorithm is shown in Fig. 9.

Table 3 Comparison of simulation results in static environment
Fig. 8
figure 8

Comparison of path planning results in static environment

Fig. 9
figure 9

Comparison of the solution quality in static environment

According to Table 3 and Fig. 9, the results achieved by AACS are superior to other methods in terms of both optimal and average results. This indicates that AACS exhibits better planning performance in static environments. And as shown in Fig. 8, it is clear that the path produced by the proposed AACS has less number of turns and shorter length. Different from other comparison algorithms, the A* algorithm’s path construction process is not random as it consistently chooses the node with the lowest cost in the Open list. In addition to the A* algorithm, AACS and IPIO demonstrate better stability than other methods in various environments. In terms of convergence speed, ACS requires the least number of iterations in Environment 1, while AACS has a faster convergence rate than other ACO variants in the remaining environment. However, ACS always falls into the local optimum in Environment 1. Although the local updating rule in ACS can effectively improve the ability to jump out of the local optimum, the objects of the global updating rule in ACS are too limited. In contrast, the other three ACO variants have more update objects in addition to the optimal solution in their global updating rule, which results in better global search capabilities. But IACA and IAACO update the pheromones of all complete paths, which can lead to slow convergence in complex scenarios such as Environment 3.

4.3 Experimental simulation in virtual marine environment

In this section, the performance of AACS is further validated in three scenarios that consider environmental influences. The three scenarios are shown in Fig. 10. Moreover, ACS, A* algorithm, PSO and IPIO are used for comparison. The specific configuration of different scenarios is shown in Table 4. And the speed of the ship is set to 8 m/s. The parameters that need to be varied in the simulation experiment are shown in Table 5.

Fig. 10
figure 10

Virtual marine environments for the simulations

Table 4 The configurations of virtual marine environment
Table 5 Parameters setting in virtual marine environment

Figure 11 displays the best path generated by each method. As shown in Fig. 11, the energy-saving path considering the environmental impact is more inclined to follow or reverse the direction of the environmental load to save energy. Furthermore, the implementation of the post-processing smoothing approach by AACS results in a path with fewer turning points and smoother transitions at those points. This reduces the difficulty of the ship tracking path. Based on Fig. 12 and Table 6, it can be observed that the optimal path planned by AACS consumes the least energy, whereas the optimal path planned by ACS consumes the most energy. Moreover, except for the A* algorithm, AACS exhibits the best stability in different environments. Compared with other comparison algorithms, ACS has the worst average result in Environment 4, while PSO has the worst stability in the remaining environment. This comparison result not only proves the superiority of AACS compared with other algorithms, but also verifies the effectiveness of the proposed improvement strategy. In addition, AACS requires fewer iterations to obtain the optimal solution in these environments compared to ACS. The main reason is that the sub-optimal solutions are effectively utilized by the adaptive global updating rule as well as the improved recombination mechanism.

Fig. 11
figure 11

Comparison of path planning results in virtual marine environment

Fig. 12
figure 12

Comparison of the solution quality in virtual marine environment

Table 6 Comparison of simulation results in virtual marine environment

4.4 Experimental simulation in actul environment

In this section, a public database of Danish ferry is used to further verify the feasibility of the proposed method. The database contains data related to the case ship between February 16th and April 12th, 2010, spanning almost two months (Petersen et al. 2012). These data are publicly available at http://cogsys.dtu.dk/propulsionmodelling/. To verify the performance of our method in the actual environment, 11 different paths in March are selected for comparison. The sea area in which the case ship operates is discretized into 60 × 60 grids with each grid having a length of 1.053 km. For the safety of navigation, the unnavigable area in the sea area is extended by 200 m. In addition, it is assumed that the ship sailed at a constant speed and the ship speed was obtained by averaging the data. As the main focus of this work is on saving energy by taking advantage of environmental factors during the voyage, only the part of the path that is in the open sea is retained and evaluated based on the energy consumption estimation model.

To differentiate between AACS with post-processing smoothing approach introduced and AACS without post-processing smoothing approach, we will refer to the former as AACS*. Figure 13a and b display the comparison between the planned path by AACS* and the actual path taken. As the redundant nodes in the path are removed using the post-processing smoothing approach, the path planned by AACS* is closer to the real path and can better meet the motion characteristics of the ship. The results depicted in Fig. 13c indicate that the optimal paths planned by AACS in most scenarios without implementing the post-processing smoothing approach consume more energy than the actual paths. The main reason for this phenomenon is the low resolution of the grid map. Although increasing the resolution of the grid map is an effective way to solve this problem, it results in a lot of additional time costs. In contrast, the post-processing smoothing approach is more appropriate. As can be seen in Fig. 13, the optimal path after using the post-processing smoothing approach requires approximately 3.21% less energy than the actual path of the case ship.

Fig. 13
figure 13

Results of experimental simulation in actual environment

5 Conclusion

To adapt to the energy consumption requirements of ship technology development on the path, this paper conducts an insightful study on the problem of ship energy-saving path planning. By designing a ship energy consumption estimation model and introducing it into the heuristic information function of the algorithm, the proposed method can better exploit environmental factors to save energy. Also, this improved method not only evaluates the optimization process but also applies the evaluation results to the various optimization stages of the algorithm. In the stage of path construction, an adaptive state transition rule is designed according to the diversity of solutions, which effectively improves the search performance of the algorithm. During the pheromone update stage, the number of ants contributing to global updating is dynamically adjusted. Furthermore, an improved recombination mechanism is proposed to improve the planning efficiency of the algorithm. In order to further smooth the path and improve its quality, an improved turning point optimization method and the smoothing method using B-spline curves are introduced. Finally, simulation experiments have been conducted in different scenarios. The simulation results not only demonstrate the superiority of the proposed method over comparison algorithms but also verify its feasibility in practical applications. However, it needs to be acknowledged that this study still has some limitations that should be addressed in future work.

  1. (1)

    This paper primarily focuses on energy consumption in the presence of stable environmental disturbances. However, during long-term navigation missions, changes in the environment over time cannot be ignored. Thus, future research should also consider the problem of energy consumption optimization in time-varying environments.

  2. (2)

    By introducing path post-processing smoothing technology, the smoothness and continuity of the path are guaranteed. In order to further consider the dynamic characteristics of ships, ship dynamics models should be introduced in future studies.

  3. (3)

    The lack of experiments in the study limits its persuasiveness when addressing practical application problems. In future research, we aim to establish an experimental platform and conduct experimental verification.