Introduction

Groundwater has become a high-quality water supply source due to its advantages such as convenient exploitation, good water quality, and stable supply. It is also an important water resource in agricultural irrigation areas. However, groundwater extraction should generally not exceed the recharge rate; otherwise, it can cause environmental harm. Therefore, developing a rational optimal allocation scheme for groundwater resources has become a key issue that urgently needs to be addressed. The main technologies used to solve optimization problems include various optimization methods such as mathematical programming, heuristic algorithms, and metaheuristic algorithms. Mathematical programming primarily uses traditional mathematical methods to solve problems, while heuristic and metaheuristic algorithms simulate natural behaviors or phenomena to solve problems.

In the field of water resource allocation, Zhang1 proposed a surrogate model based on groundwater numerical simulation combined with an improved BP neural network and optimization algorithm, effectively improving the utilization efficiency of water re-sources. Lu et al.2 coupled a water resource allocation model with a groundwater numerical simulation model to iteratively plan groundwater extraction volumes. Yang3 analyzed changes in groundwater and provided schemes for the rational allocation of water resources. Nie4 considered both surface water and groundwater comprehensively and used a multi-objective optimization allocation model, which significantly enhanced water resource utilization efficiency.

In recent years, many new metaheuristic algorithms have been proposed and widely applied to optimize real-life problems. The Snake Optimizer (SO) is a novel metaheuristic optimization algorithm proposed by Hashim et al.5which simulates the behavioral patterns of snakes to achieve optimization. Currently, the SO algorithm is extensively used in various fields for optimization. Li et al.6 introduced a variable-step multi-scale method to address signal classification issues and utilized the SO algorithm to optimize single-threshold slope entropy thresholds with variable step sizes, ultimately achieving accurate signal classification. Ismail7 applied the SO algorithm to chronic kidney dis-ease (CKD) detection, proposing a CKD-SO framework for CKD data analysis. Compared with other algorithms, the proposed framework achieved an accuracy rate of 99.7%. Li et al.8 combined the SO algorithm with variational mode decomposition and proposed a denoising method using SO-VMD and correlation coefficient dual-threshold criteria to reduce ship noise’s environmental impact. They experimentally verified the denoising capability of the proposed method. Cui9 optimized the structure of a Bigru-Attention model using the SO algorithm and finally obtained a highly efficient energy supply pre-diction model capable of stably and effectively predicting power supply during different periods. Cheng et al.10 applied the SO algorithm to signal timing optimization and control. They optimized the parameters of the control timing model using the SO algorithm, and the optimized scheme reduced delay time by about 20% compared to the fixed timing scheme. Aswini et al.11 combined the SO algorithm with Bi-GRU networks for disease prediction, achieving high accuracy with the proposed method. Chen et al.12 integrated the SO algorithm with Extreme Gradient Boosting (XGB), proposing an SO-GXB method for pavement damage prediction. They experimentally verified the accuracy and applicability of the proposed algorithm. Wang et al.13 used the SO algorithm and experience replay to optimize gated recurrent networks, obtaining a predictive model that solved the problem of poor information prediction accuracy in communication systems. Although the snake algorithm can effectively solve some optimization problems, it tends to fall into local optima. Many scholars have improved the traditional SO algorithm to address this issue. Fatima et al.14 used the SO algorithm to extract diode model parameters to accurately predict energy generation. However, after comparing with other algorithms, they found that the SO algorithm performed poorly. Therefore, they proposed an improved snake algorithm for parameter extraction, and experiments verified the performance of the proposed algorithm. Zhao et al.15 improved the SO algorithm by incorporating Tent chaotic mapping, inertia weight factor, and sine-cosine algorithms into the SO algorithm, resulting in an improved snake algorithm. Subsequently, they established a CEEMD-ISCASO-KELM wind power prediction model. Simulations showed the superiority of the proposed model. Zheng et al.16 added a compact strategy to the SO algorithm and proposed a new SO algorithm, which was effectively used in positioning and reduced positioning errors. Li et al.17 introduced a dual mutation mechanism into the SO algorithm, increasing population diversity. The approach demonstrated advantages when applied to real scientific workflow scheduling. Yang et al.18 incorporated chaotic initialization, asynchronous learning factors, and Levy flight into the snake algorithm, resulting in an improved snake algorithm. The proposed algorithm exhibited excellent optimization performance in optimizing array configurations. When optimizing the capacity configuration of hybrid energy storage systems, Wang et al.13 proposed a multistrategy SO optimizer, which showed superior performance in capacity optimization. Karam et al.19 proposed an improved snake algorithm suitable for detecting load variations in photovoltaic systems and compared it with other metaheuristic algorithms to verify the performance of the proposed algorithm. Liao et al.20 improved the snake algorithm and applied it to the field of positioning estimation. Liu21 proposed an adaptive chaotic Gaussian SO for soil element monitoring.

Through the above research, it was found that the traditional snake algorithm still has issues such as weak randomness in population initialization, slow convergence speed in later stages, and a tendency to get stuck in local optima. To address these issues in the traditional snake optimization algorithm, this paper proposes an improved snake optimization algorithm integrating Logistic chaotic sequences, the bubble net mechanism from the whale algorithm, and an adaptive weighting factor. The effectiveness of the pro-posed algorithm is validated through comparisons with the traditional SO algorithm and other optimization algorithms in optimizing groundwater utilization strategies.

The rest of this paper is organized as follows: Sect. 2 introduces the traditional SO algorithm. Section 3 introduces the W-SO algorithm, which first incorporates Logistic chaotic sequences into the snake population initialization phase; secondly integrates the bubble net mechanism of the whale algorithm during the exploration phase; and finally adds an adaptive weighting factor during the update phase. In Sect. 4, the proposed W-SO algorithm and comparison algorithms are used to optimize groundwater utilization strategies. Section 5 provides a brief summary of this paper.

Methods

Although the Logistic chaos initialization and the bubble-net mechanism of the Whale Optimization Algorithm (WOA) have been applied in other optimization algorithms (such as WOA and Particle Swarm Optimization (PSO)), their integration and application within the Snake Optimization Algorithm (SO) offer unique advantages and innovations. Existing improvements in algorithms typically focus on enhancing exploration ability or accelerating convergence speed. However, the W-SO algorithm proposed in this study not only combines these two mechanisms but also further enhances the diversity in the search process by introducing an adaptive weighting factor. This helps avoid premature convergence and the problem of getting trapped in local optima. Additionally, within the unique framework of Snake Optimization, the W-SO algorithm leverages the advantages of the bubble-net mechanism to strengthen global exploration, making it particularly suitable for real-world problems such as groundwater utilization optimization. Therefore, the innovation of this study lies in the novel application of these combined mechanisms in the Snake Optimization Algorithm, demonstrating its superior performance in groundwater scheduling.

Principle of the snake optimizer algorithm

The Snake Optimization (SO) algorithm is a novel nature-inspired swarm intelligence algorithm whose design is based on the living habits of snakes to solve various optimization problems. The population initialization process of the SO algorithm is similar to most metaheuristic optimization algorithms, and the initialization of the population is shown in Eq. (1):

$${P_i}={P_{\hbox{min} }}+rand \times ({P_{\hbox{max} }} - {P_{\hbox{min} }})$$
(1)

In the equation, \({P_i}\)​represents the initial position of the i snake; rand is a random number uniformly distributed in the interval [0,1]; \({P_{\hbox{max} }}\) and \({P_{\hbox{min} }}\) denote the lower and upper bounds, respectively. After initialization, the food value for the snake population is evaluated. The female snakes and male snakes are separated, assuming their numbers are equal, as shown in Eqs. (2) and (3):

Research manuscripts reporting large datasets that are deposited in a publicly available database should specify where the data have been deposited and provide the relevant accession numbers. If the accession numbers have not yet been obtained at the time of submission, please state that they will be provided during review. They must be provided prior to publication.

$${N_m}=\frac{N}{2}$$
(2)
$${N_f}=N - {N_m}$$
(3)

In the above equations, is the total number of snakes in the population; \({N_m}\) is the number of male snakes; \({N_f}\)is the number of female snakes.

Next, each group of snakes is evaluated to select the best individuals from both the male and female groups, as well as to determine the temperature condition and food location. The temperature condition is described as shown in Eq. (4):

$$Temp={e^{(\frac{{ - t}}{T})}}$$
(4)

In the above equation, t represents the current iteration number, indicating the current temperature, and T ​denotes the maximum number of iterations, representing the highest temperature of the population.

The update formula for the food position is given in Eq. (5):

$$F={\lambda _1}{e^{(\frac{{t - T}}{T})}}$$
(5)

If the food is not found, the snakes will randomly search for food and update their positions in time. The position update formulas for the snakes are shown in Eqs. (6) and (7):

$${P_{i,m}}\left( {t+1} \right)={P_{rand,m}}(t) \pm {\lambda _2} \times {Q_m} \times (({P_{\hbox{max} }} - {P_{\hbox{min} }}) \times rand+{P_{\hbox{min} }})$$
(6)
$${P_{i,f}}\left( {t+1} \right)={P_{rand,f}}(t) \pm {\lambda _2} \times {Q_m} \times (({P_{\hbox{max} }} - {P_{\hbox{min} }}) \times rand+{P_{\hbox{min} }})$$
(7)

In these equations, \({P_{i,m}}\) and ​\(P_{{i,f}}\) represent the positions of the i male and female snake individuals, respectively; \({P_{rand,m}}\)、and\({P_{rand,f}}\)denote randomly selected individual positions from the male and female snake groups, respectively; \({\lambda _2}\) is a constant, typically set to 0.05; \({Q_m}\)and\({Q_f}\) ​represent the foraging abilities of the male and female snakes, respectively, which are calculated as shown in Eqs. (8) and (9):

$${Q_m}={e^{\left( {\frac{{ - {f_{rand,m}}}}{{{f_{i,m}}}}} \right)}}$$
(8)
$${Q_f}={e^{\left( {\frac{{ - {f_{rand,f}}}}{{{f_{i,f}}}}} \right)}}$$
(9)

In the above equations, \({f_{rand,m}}\) ​and \({f_{rand,f}}\) represent the fitness values of the randomly selected male and female snake individuals, respectively, \({f_{i,m}}\) and\({f_{i,f}}\) are the corresponding fitness values of \({P_{i,m}}\) and \({P_{i,f}}\).

If F > 0.25, indicating that food is currently present, and when the temperature is high, if Temp > 0.6, the snakes will move towards the position of the food. The position update formula is shown in Eq. (10):

$${P_{i,j}}(t+1)={P_f} \pm {\lambda _3} \times Temp \times rand \times ({P_f} - {P_{i,j}}(t))$$
(10)

In these formulas, \({P_{i,j}}\) represents the position of the i snake individual, \({P_f}\) is the position of the best individual, and \({\lambda _3}\) is a constant, typically set to 2.

When the food source remains unchanged and the temperature falls below the threshold of 0.6, the snakes become more active, which may result in fighting or mating behaviors. The position update formulas for the fighting mode are shown in Eqs. (11) and (12):

$${P_{i,m}}(t+1)={P_{i,m}}(t) \pm {\lambda _3} \times CM \times rand \times ({P_{best,f}}(t) - {P_{i,m}}(t))$$
(11)
$${P_{i,f}}(t+1)={P_{i,f}}(t) \pm {\lambda _3} \times CF \times rand \times ({P_{best,m}}(t) - {P_{i,f}}(t))$$
(12)

In these formulas, \({P_{i,m}}\)and \({P_{i,f}}\) represent the positions of the i male and female snakes, respectively; \(P{}_{{best,m}}\) and \(P{}_{{best,f}}\) are the best positions within the male and female populations, respectively; and Cm and Cf represent the fighting abilities of the male and female agents, as defined in Eqs. (13) and (14):

$$CM={e^{(\frac{{ - {f_{best,f}}}}{{{f_i}}})}}$$
(13)
$$CF={e^{(\frac{{ - {f_{best,m}}}}{{{f_i}}})}}$$
(14)

In these formulas, \({f_{best,m}}\) ​and \({f_{best,f}}\) denote the best fitness values within the male and female populations, respectively, and fi represents the fitness value in the entire snake population.

When snakes mate, the position update formulas in the mating mode are given by Eqs. (15) and (16):

$${P_{i,m}}(t+1)={P_{i,m}}(t) \pm {\lambda _3} \times {M_m} \times rand \times (F \times {P_{i,f}}(t) - {P_{i,m}}(t))$$
(15)
$${P_{i,f}}(t+1)={P_{i,f}}(t) \pm {\lambda _3} \times {M_f} \times rand \times (F \times {P_{i,m}}(t) - {P_{i,f}}(t))$$
(16)

In these formulas, \({M_m}\) and \({M_f}\) represent the mating abilities of male and female snakes, respectively, as shown in Eqs. (17) and (18):

$${M_m}={e^{\left( {\frac{{ - {f_{i,f}}}}{{{f_{i,m}}}}} \right)}}$$
(17)
$${M_f}={e^{\left( {\frac{{ - {f_{i,m}}}}{{{f_{i,f}}}}} \right)}}$$
(18)

If the eggs hatch, the worst-performing male and female snakes are selected and replaced. The replacement formulas are shown in Eqs. (19) and (20):

$${P_{worst,m}}={P_{\hbox{min} }}+rand \times ({P_{\hbox{max} }}+{P_{\hbox{min} }})$$
(19)
$${P_{worst,f}}={P_{\hbox{min} }}+rand \times ({P_{\hbox{max} }}+{P_{\hbox{min} }})$$
(20)

In these equations, \({P_{worst,m}}\) and \({P_{worst,f}}\)represent the worst individuals in the male and female snake populations, respectively.

Specific improvements to the snake optimization algorithm

The Snake Optimization Algorithm is an evolutionary algorithm based on a dual-population mechanism, where information is shared both within and between populations to drive population evolution. In metaheuristic algorithms, the two most crucial mechanisms are exploration and exploitation behaviors. The exploration phase refers to the algorithm’s ability to search for new solutions in distant regions of the search space, while the exploitation phase denotes its ability to discover new solutions in promising areas already identified. However, the snake algorithm has several disadvantages: it is prone to secondary convergence in the early stages of evolution, it can easily fall into local optima when the number of iterations is insufficient, and it converges slowly in the later stages. Therefore, in this paper, several improvements are proposed based on the snake algorithm. First, the Logistic chaos principle is introduced to enhance the initialization of the snake population. Next, the mechanism in the exploration phase is improved by incorporating the bubble-net mechanism from the Whale Optimization Algorithm, aiming to accelerate early-stage convergence and prevent secondary convergence. Additionally, an adaptive weight factor is introduced to enhance the diversity of position updates in the snake population. As a result, an improved Snake Optimization Algorithm (ISO) is established.

Logistic chaos principle

In this study, the Logistic map was used to initialize the population in the Snake Optimization Algorithm (SO) to increase the randomness and diversity of the population. The choice of an appropriate value for µ is crucial to ensuring the diversity of the population. To generate sufficient randomness and avoid premature convergence, µ = 4 was chosen as the parameter for the Logistic map.

This parameter value has been proven in several classic studies to produce the most chaotic behavior, ensuring that the population initialization has high randomness. µ = 4 is the most typical choice for the Logistic map, and at this value, the system exhibits fully chaotic behavior, causing each new value during the iteration process to be highly unpredictable, thus providing enough exploration space for the subsequent optimization process.

Since µ = 4 has been widely applied and thoroughly validated in many optimization algorithms, and based on the study by Devaney (1989)22where it is stated that “For r = 4, the system exhibits chaotic behavior for almost all initial conditions,” no further comparative experiments are necessary to prove its effectiveness. Zhao23X. Li24and Ganaie M. A25., in their studies, all use µ = 4 as the parameter for the Logistic map to ensure chaotic behavior in the algorithm and enhance the diversity and randomness in the optimization process. This choice has been shown to effectively increase the diversity during the algorithm’s initialization and prevent premature convergence to local optima. Therefore, we consider the choice of µ = 4 as the initialization parameter to be reasonable and well-suited for the optimization needs of the algorithm.

First, the population initialization is improved by introducing the Logistic chaos principle. Chaos has the advantages of both ergodicity and randomness. Here, a chaotic sequence generated by the Logistic chaotic map is used for population initialization. The chaotic sequence is defined as shown in Eq. (21):

$$x\left( {n+1} \right)=\eta \times x\left( n \right) \times \left[ {1 - x\left( n \right)} \right]$$
(21)

Where n denotes the dimensionality; \(\eta \in (0,4)\) and in this paper, \(\eta =4\);\(x \in (0,1)\)

The updated final population initialization formula is shown in Eq. (22):

$${P_i}={P_{\hbox{min} }}+x \times ({P_{\hbox{max} }} - {P_{\hbox{min} }})$$
(22)

Incorporation of Whale optimization mechanism

The Whale Optimization Algorithm (WOA), proposed by Mirjalili et al. in 2016, is another nature-inspired population intelligence optimization algorithm. It mimics the social behavior of whales, which may live solitarily or in groups. Among the social behaviors of whales, the most distinctive feature of humpback whales is their unique spiral hunting behavior, known as bubble-net feeding.

In the snake optimization algorithm, the exploration behavior here represents the influence of environmental factors, such as cold areas and food availability. In this situation, snakes only search for food within their current environment, conducting a local search. Specifically, when the amount of food is less than 0.25, snakes search for food by selecting any random position and updating their locations accordingly. The original position update mechanism is improved by integrating the bubble-net feeding mechanism from the whale algorithm, with the following update formulas executed during the update. For the male snake population, the update formulas are given in Eqs. (23)-(25).

$${a_2}= - 1+t \times \frac{{ - 1}}{{{N_m}}}$$
(23)
$${l_m}=rand \times ({a_2} - 1)+1$$
(24)
$${P_{i,m}}\left( {t+1} \right)={P_{rand,m}}(t)+{\lambda _2}\cdot {Q_m}\cdot rand\cdot {e^{b{l_m}}}\cdot \cos (2\pi {l_m})\cdot (({P_{\hbox{max} }} - {P_{\hbox{min} }})\cdot rand+{P_{\hbox{min} }})$$
(25)

Where \({a_2}\) is a vector that linearly decreases from − 1 to −2.

Similarly, for the female snake population, the position update formulas in the presence of food in the environment are given by Eqs. (26)–(28):

$${a_3}= - 1+t\frac{{ - 1}}{{{N_f}}}$$
(26)
$${l_f}=rand\cdot ({a_3} - 1)+1$$
(27)
$${P_{i,f}}\left( {t+1} \right)={P_{rand,f}}(t)+{\lambda _2}\cdot {Q_f}\cdot rand\cdot {e^{b{l_f}}}\cdot \cos (2\pi {l_f})\cdot (({P_{\hbox{max} }} - {P_{\hbox{min} }})\cdot rand+{P_{\hbox{min} }})$$
(28)

Where \({a_3}\) is a vector that decreases linearly from − 1 to − 2.

Adaptive weight factor

When there is food in the environment where the snake population exists and the temperature is relatively high, the snakes tend to move towards the food position. Especially in the early stage of optimization, the speed of approaching the food is very fast; however, while the speed is high, the precision is low, and it is easy to fall into a local optimum. If the coefficient and maximum velocity parameters are too large, the snake population may skip over the optimal value, resulting in a lack of convergence. On the other hand, during convergence, as all snakes move toward the optimal solution, the population tends to homogenize. At the same time, when the algorithm converges to a certain precision, it can no longer be further optimized, and the achievable accuracy is reduced. Therefore, an adaptive weight factor is introduced to add uncertainty and disturbance to the position update of the snake population, greatly improving the snakes’ ability to adaptively search for food and ensuring that they approach the location with the most food, rather than converging an masse toward a single food source, thus avoiding missing out on more food. The adaptive adjustment method is shown in Eqs. (29) and (30):

$${w_1}=1 - \frac{t}{{{N_m}}}\log (1+{e^{ - 1}})$$
(29)
$${w_2}=1 - \frac{t}{{{N_f}}}\log (1+{e^{ - 1}})$$
(30)

Where \({w_1}\) and \({w_2}\) represent the adaptive factors for male and female snakes as they approach the food source, respectively.

The final updated positions are given by Eqs. (31) and (32):

$${P_{i,m}}\left( {t+1} \right)={P_{rand,m}}(t)+{w_1}\cdot {\lambda _3}\cdot {Q_m}\cdot rand\cdot {e^{b{l_m}}}\cdot \cos (2\pi {l_m})\cdot (({P_{\hbox{max} }} - {P_{\hbox{min} }})\cdot rand+{P_{\hbox{min} }})$$
(31)
$${P_{i,f}}\left( {t+1} \right)={P_{rand,f}}(t)+{w_2}\cdot {\lambda _3}\cdot {Q_f}\cdot rand\cdot {e^{b{l_f}}}\cdot \cos (2\pi {l_f})\cdot (({P_{\hbox{max} }} - {P_{\hbox{min} }})\cdot rand+{P_{\hbox{min} }})$$
(32)

Flowchart of the W-SO algorithm

figure a

Results

Performance verification and testing of the improved snake optimization algorithm

To verify the effectiveness of the improved Snake Optimization Algorithm, this algorithm was applied to standard benchmark problems. The performance of the improved algorithm was compared with six other intelligent optimization algorithms proposed in recent years, as well as the Whale Optimization Algorithm (WOA). The comparison algorithms include: Dung Beetle Optimizer (DBO)26Beluga Whale Optimization (BWO)27Golden Jackal Optimization (GJO)28Snake Optimization (SO), Rat Swarm Optimizer (RSO)29Harris Hawks Optimization (HHO)30and Whale Optimization Algorithm (WOA).

All of the above algorithms were subjected to numerical experiments on the CEC2017 benchmark function test set. Specifically, eight standard test functions were selected from the 30 unconstrained benchmark functions of the CEC2017 set, covering four types: unimodal functions (F1–F3), basic multimodal functions (F4–F10), hybrid functions (F11–F20), and composite functions (F21–F30). The test dimensions included 10D, 30D, 50D, and 100D. In this study, two unimodal functions (F2 was excluded due to an official issue statement), two multimodal functions, two hybrid functions, and two composite functions were selected, for a total of eight benchmark functions. The mathematical definitions of the selected benchmark functions are shown in Table 1 (located in the Tables section).

Table 1 Mathematical models of benchmark test functions.

Eight benchmark functions from the CEC2017 test suite were selected for evaluation. The types, optimal values, and search ranges of these functions are shown in Table 2 (located in the Tables section).All algorithm verification experiments in this section were conducted on a computer equipped with an AMD Ryzen 7 1700 processor (3.0 GHz), 16 GB RAM, running Windows 10 Professional 64-bit operating system and MATLAB 2021b software. The basic parameter settings of the algorithms used in this chapter are shown in Table 3.

Table 2 Basic information and search ranges of the CEC2017cec2017 benchmark test functions.
Table 3 Experimental parameter settings.

As shown in below figure, through experiments with different population sizes, the results indicate that a population size of 30 yields the best performance, and convergence is achieved within 500 iterations. Therefore, the maximum number of iterations is set to 500.

figure b

Due to the stochastic nature of meta-heuristic swarm intelligence algorithms, results may vary with each run. To mitigate randomness, the mean of 10 independent runs is calculated for each algorithm, and the final error convergence curves and box plots are presented in Figs. 1, 2, 3 and 4.

Fig. 1
figure 1

Comparison results on unimodal functions (dimension = 10).

Figure 1 illustrates the comparison results of different algorithms on unimodal functions. It can be observed that the final error of the W-SO algorithm is consistently lower than those of the other algorithms, particularly outperforming BWO, RSO, GJO, and WOA. For the DBO algorithm, although the ISO algorithm shows slower error convergence in the early iterations, it surpasses DBO in the middle and later stages. Referring to the box plot in Fig. 1c, the error distribution of the ISO algorithm is less favorable than that of the standard SO and DBO algorithms, mainly because the error tends to increase in the early stage, resulting in a higher overall error. However, the ISO algorithm avoids local optima and shows an overall downward trend in error, indicating that, unlike the traditional SO algorithm which exhibits a distinct turning point, the improved ISO benefits from the incorporation of the whale mechanism, further demonstrating the effectiveness of the enhancement. In Fig. 1b, the initial value of ISO is significantly smaller than that of SO, and the introduction of the improved mechanism and adaptive weighting factor indirectly ensures better exploration capability. Combined with Fig. 1d, the improved ISO algorithm demonstrates relatively good performance on unimodal functions.

Fig. 2
figure 2

Comparison results on multimodal functions (dimension = 10).

Figure 2 presents the comparison results of different algorithms on basic multimodal functions. According to Fig. 2a and b, the improved ISO algorithm exhibits a faster convergence rate in the early stages of iteration on multimodal functions. Moreover, the snake optimizer as a whole is well-suited for optimizing multimodal functions, with its error convergence generally outperforming other algorithms, especially BWO and RSO. Its performance is particularly prominent in Fig. 2b. Although in Fig. 2a the ISO algorithm’s error convergence is slightly inferior to that of the HHO algorithm, the improved ISO reaches the convergence value first. Overall, the improved ISO algorithm demonstrates greater stability in performance on basic multimodal functions. As shown in Fig. 2c and d, the error values of the improved ISO are more concentrated and minimal. Comparing the snake optimizer before and after the improvement, the error convergence curve of the improved ISO is lower, approaching zero in Fig. 2b, indicating that it is the closest to the optimal value.

Fig. 3
figure 3

Comparison results on hybrid functions (dimension = 10).

Figure 3 shows the comparison results of different algorithms on hybrid functions. As seen in Fig. 3a, the ISO algorithm demonstrates the best convergence overall. Although its early convergence speed is slightly slower than SO, WOA, and DBO, its error convergence in the middle and later stages surpasses both the original snake algorithm and the other compared algorithms. In the error boxplot in Fig. 3c, the ISO algorithm exhibits smaller and more concentrated error values, which are mostly near zero—slightly worse than the WOA algorithm, but better than BWO, GJO, and RSO. Figure 3b indicates that the improved snake algorithm achieves a relatively faster error convergence speed. Thanks to the introduction of the whale mechanism, the algorithm avoids getting trapped in local optima in the early stage, ensuring robust convergence, though its performance in the middle and late stages is slightly inferior to the HHO algorithm. The error boxplot in Fig. 3d visually shows that the ISO algorithm’s errors are minimal, with few outliers and high concentration, significantly outperforming the SO, WOA, BWO, GJO, DBO, and RSO algorithms, though still slightly inferior to the HHO algorithm.

Fig. 4
figure 4

Comparison results on composition functions (dimension = 10).

Figure 4 presents the comparison results of different algorithms on composition functions. According to the results shown in Figs. 4a,b, the performance of the snake optimizer on composition functions is similar to that of the other algorithms, with most of the algorithms’ results nearly overlapping—especially in Fig. 4a, where it is only slightly inferior to the WOA algorithm. As seen in Figs. 4c,d, the ISO algorithm outperforms BWO, RSO, and other algorithms, with overall error convergence superior to the other compared algorithms.

By evaluating the error convergence curves and boxplots of the selected test functions at low dimensionality (D = 10), it can be concluded that the error convergence of the ISO algorithm is generally better than that of the standard SO algorithm and the other compared algorithms. Regarding the error boxplots, the ISO algorithm performs best on multimodal functions, showing a clear advantage over the other algorithms, and performs second best on hybrid functions. Therefore, based on the comparative results on the aforementioned test functions, the improved ISO algorithm is capable of finding more accurate optimal solutions and exhibits better convergence performance than the other algorithms.

Based on the performance of the eight optimization algorithms on the eight test functions, it is evident that both SO and W-SO perform excellently. Therefore, I will further compare the performance of SO and W-SO on two additional typical functions from the CEC2017 dataset.

figure c

The SO algorithm follows a temperature-based descent strategy, gradually converging to the optimal solution. On F4, it achieves a result of 1.07 within 500 iterations, avoiding local optima well when the local minima are not too complex. In contrast, the W-SO algorithm combines SO with WOA, enhancing exploration through whale behavior simulation. On F4, W-SO converges to 0 within 200 iterations, benefiting from WOA’s global search capability. While SO performs well on F4, W-SO finds the global optimum more quickly by combining exploration and exploitation.

figure d

The SO algorithm performs poorly on F10, converging to around 750 after 500 iterations due to its limited exploration capability and susceptibility to local minima. The Rastrigin function’s periodic variations cause further oscillations, trapping SO near a local minimum. In contrast, the W-SO algorithm combines SO with WOA, enhancing exploration and avoiding local optima. On F10, W-SO converges to 0 within 200 iterations, benefiting from WOA’s global search ability. While F10’s complexity challenges SO, W-SO excels with its hybrid exploration and exploitation, effectively finding the global optimum.

High-dimensional performance analysis of W-SO algorithm

In addition to the 10-dimensional (D = 10) experiments conducted in previous sections, we also extended the performance analysis of the improved W-SO algorithm to higher dimensions, specifically 30D and 50D, to better simulate the complexity of real-world optimization problems, such as groundwater resource optimization, which often involves high-dimensional decision variables. The performance of both the original SO algorithm and the W-SO algorithm was tested using the CEC2017 Rastrigin function (F5), which is a well-known benchmark for high-dimensional optimization problems.

figure e
figure f

As seen from the figures, the W-SO algorithm converges significantly faster and has lower error values compared to the original SO algorithm, especially after 200 iterations. While the SO algorithm faces difficulties in converging to the optimal solution, the W-SO algorithm stabilizes quickly and approaches the optimal value, demonstrating its superior performance in high-dimensional optimization. Similarly, for the 50-dimensional experiment, the convergence curves indicate that the W-SO algorithm outperforms the SO algorithm, with faster convergence and higher solution accuracy. As the dimensionality increases, the original SO algorithm encounters greater difficulty in escaping local optima, while the W-SO algorithm, with its enhanced exploration and exploitation mechanisms, still produces good results. These findings suggest that the W-SO algorithm is more robust and efficient in handling high-dimensional optimization problems. It avoids the common early convergence phenomenon seen in the SO algorithm in high-dimensional spaces and exhibits greater adaptability in complex, high-dimensional search spaces.

Statistical test results: t-test and Wilcoxon raznk-sum test

To assess the superiority of the improved Snake Optimization (W-SO) algorithm over the traditional SO algorithm, multiple experiments were conducted on the Rastrigin function (F5) from the CEC2017 test suite, using 30-dimensional data. Ten independent experiments were performed for both the W-SO and SO algorithms, with the optimal objective function value recorded for each trial. The results showed that the W-SO algorithm consistently approached the optimal solution (0) in every experiment, whereas the SO algorithm’s optimal value remained around 350. This significant difference in performance was further validated through statistical testing. The t-test revealed a p-value of < 0.0001, indicating a statistically significant difference in performance between the two algorithms. Similarly, the Wilcoxon rank-sum test, a non-parametric method, confirmed this finding with a p-value of 0.0001, consistent with the t-test results. These statistical analyses provide strong evidence that the W-SO algorithm outperforms the traditional SO algorithm in optimization tasks, with the performance difference being statistically significant.

Time complexity analysis of W-SO algorithm

When evaluating the efficiency of the W-SO algorithm, I compared it with the traditional SO and WOA algorithms. The W-SO algorithm integrates the exploration mechanism of the SO algorithm and the exploitation mechanism of the WOA algorithm, so its time complexity is O(T*N*d), similar to SO and WOA. However, due to the introduction of the mating mechanism and dynamic population adjustment, the computational load per iteration in W-SO is slightly higher than that in SO and WOA, which may lead to a marginal increase in computational cost. In the experiments, the single-run time of W-SO and SO algorithms is similar, with the total runtime of W-SO being slightly higher, but this difference is very small and still within an acceptable range.

Table 4 Experimental parameter settings.

In Table 4, we can observe the comparison of the runtime between the SO and W-SO algorithms. The experimental results show that the single-run time for both the SO and W-SO algorithms is similar, at 0.0002 s. However, the total runtime for the W-SO algorithm is slightly higher, with an average of 0.034211 s, compared to the total runtime of the SO algorithm, which is 0.032898 s. The difference is approximately 0.001313 s, indicating that while the W-SO algorithm incorporates some improvements, the increase in computational cost is minimal and still within an acceptable range.

Improvement of the W-SO algorithm for multi-objective optimization

The hybrid optimization algorithm initially proposed in this study is a fusion of the SO algorithm and WOA, designed to solve single-objective optimization problems. The performance validation tests in Chap. 4 have demonstrated that this algorithm achieves rapid convergence on complex nonlinear objective functions, while also delivering higher accuracy.

However, to address the multi-objective trade-offs required in groundwater extraction problems (such as seeking a Pareto-optimal solution between minimizing yield loss rate and controlling total extraction), this hybrid algorithm has been extended to handle multi-objective scenarios. The main improvements are summarized as follows:

Adjustment of objective function structure

In the algorithm performance validation tests in Chap. 4, eight standard benchmark functions were selected from the 30 unconstrained CEC2017 test functions, all of which are single-objective. In this section, the single-objective test function is replaced with a vector form\(F(x)\), which includes two independent yet related objectives, \({f_1}(x)\)and\({f_2}(x)\).

Lambda: The parameter defining the water consumption ratio for each region is sourced from existing literature. Specifically, the values are taken from the study by Lian Pengda31(2021) titled “Research on Groundwater Utilization Patterns in Shijin Irrigation District Based on Multi-objective Optimization.”

Here, \({f_1}\)represents the yield loss rate and is constructed based on a penalty function for insufficient water supply; \({f_2}\)denotes the ratio of total extraction to total water demand, serving as an indicator of resource utilization intensity. The scheduling period is set to 6 months, and the region is divided into four water source zones (with extraction prohibited in zone 4). xi represents the extraction volume in the i subzone for a given month and is defined as a decision variable. The final optimization problem aims to simultaneously minimize \({f_1}\)and \({f_2}\).

$$x=\left[ {{x_1},{x_2}, \ldots {x_{24}}} \right] \in {R^{24}}$$
(33)

The output formula is defined as follows:

$$Y={Y_{\hbox{max} }} \cdot {\prod\limits_{{m=1}}^{6} {(\hbox{min} (\frac{{{E_m}}}{{{D_m}}},1))} ^{{\lambda _m}}}$$
(34)

Where Y is the actual output (unit output value);\({Y_{\hbox{max} }}=1.2 \times {10^5}\) is the maximum theoretical output; \({E_m}\) is the total extraction in month m; \({D_m}\) is the water demand in month mmm; and\({\lambda _m}\) is the weight of that month in the total output.

The yield loss rate (the first objective function) is defined as follows:

$${f_1}(x)=\hbox{max} (0,1 - \frac{Y}{{{Y_{\hbox{max} }}}})$$
(35)

Let the total water demand be:

$${D_{total}}=\sum\limits_{{m=1}}^{6} {{D_m}}$$
(36)

Then the second objective function is:

$${f_2}(x)=\frac{{\sum\limits_{{i=1}}^{{24}} {{x_i}} }}{{{D_{total}}}}$$
(37)

Modification of solution set evaluation and search strategy

In the single-objective version, the algorithm retains only the current best individual \({x_{best}}\) ​, whereas the multi-objective version must maintain a non-dominated solution archive (Pareto Archive). Therefore, this study adopts a combination of non-dominated sorting and crowding distance mechanisms to jointly control both the diversity and superiority of the solutions.

The core mechanisms from the original W-SO algorithm are retained, including the use of the Logistic chaos principle, which introduces random perturbations during the initialization of the snake population through chaotic mapping, as well as the improvement of the integrated bubble-net mechanism with adaptive weighting factors. However, in the multi-objective version, the environmental selection stage utilizes an elite preservation strategy based on Pareto sorting and crowding distance.

After updating the individuals, the current population is merged with the newly generated solutions. Non-dominated sorting is then performed to identify the Pareto front, and diversity is maintained through crowding distance, thereby constructing the next generation population.

Application of a hybrid Whale and snake optimization algorithm (W-SO) in groundwater planning

With the above extensions, the W-SO algorithm has successfully transitioned from a single-objective structure to supporting multi-objective optimization, gaining the ability to explore Pareto front solutions in non-convex objective spaces. It has been successfully applied to multi-region groundwater regulation problems. To evaluate the applicability of different multi-objective optimization strategies to groundwater scheduling problems, this study constructs optimization frameworks based on the improved whale-snake optimizer fusion algorithm (W-SO), the Non-dominated Sorting Genetic Algorithm II (NSGA-II), and the decomposition-based approach (MOEA/D). The scheduling results and convergence performance of these algorithms are compared under identical constraint conditions and initialization strategies. As illustrated in the following figure:

Fig. 5
figure 5

Comparison results on multi-objective water resources problems.

Figure 5 shows the performance of different multi-objective optimization algorithms. Figure 5a indicates that the MOEA/D algorithm converges to 0.3 after 50 iterations, showing weaker local refinement capabilities. Figure 5c demonstrates that NSGA-II converges to 0.2, slightly better than MOEA/D. Figure 5e reveals that the W-SO algorithm converges quickly to 0.02 after 20 iterations, outperforming the other two algorithms. In Fig. 5b, the Pareto front of MOEA/D is skewed, while Fig. 5d shows NSGA-II achieving balanced but suboptimal results. Figure 5f highlights the W-SO algorithm’s superior performance, with a Pareto front closest to the theoretical optimum and well-balanced solutions.

Table 5 Results of Multi-Objective function Optimization.

The comparative performance of the three algorithms in terms of key optimization indicators is summarized in Table 5. In summary, the W-SO algorithm demonstrates the best overall performance and is well-suited for solving groundwater scheduling problems with high solution accuracy requirements, especially in practical applications where solutions close to the theoretical optimum are needed.

Discussion

This paper proposes an improved snake optimizer to address the traditional short-comings of the standard snake optimization algorithm, such as its tendency to fall into local optima and slow convergence speed. Building on the fundamental principles of the snake optimization algorithm, a dual-population evolutionary strategy is employed and combined with the whale bubble-net spiral predation mechanism, resulting in the W-SO algorithm. The proposed optimizer incorporates the Logistic chaos principle, introducing random disturbances into the initial snake population via chaotic mapping, and further refines the integrated bubble-net mechanism with adaptive weighting factors. This ap-proach assigns larger weighting factors in the early iterations to enhance global search capability and significantly improves the adaptive ability of the optimizer. The W-SO al-gorithm, along with SO and WOA, was applied to groundwater allocation optimization. Comparative experiments demonstrate that the W-SO algorithm exhibits superior overall performance compared to existing algorithms, enabling effective groundwater resource planning and efficient water utilization.