1 Introduction

In the last 2 decades, many metaheuristic algorithms have been proposed by researchers due to their advantages like flexibility, bypassing local optima, and they did not need gradient information [1]. Metaheuristics algorithms have gained huge attention and a significant interest as they can solve real-world optimization problems by mathematically simulating physical/biological phenomena. They have been applied to many problems [2, 3]. These algorithms can be divided into four major categories: l(EAs), Swarm Intelligence-based algorithm (SI-based), physics & chemistry algorithms, and Human-based Algorithm. The first category (evolutionary algorithms) contains algorithms inspired by natural evolution. In EAs, there is a randomly generated population at first to start. Then, all individuals are evaluated over a generation to produce new individuals using crossover and mutation processes. This category includes genetic algorithms (GA) [4], evolution simulation strategy (ES) [5], genetic programming (GP) [6], and biogeography-based optimizer (BBO) [1].

The second category is SI-based algorithms inspired by swarms’ social behavior [7], a collection of living beings in nature. Examples of SI algorithms are particle swarm algorithm (PSO) [8], ant colony optimization [9], Harris hawks optimizer (HHO) [10], virus colony search [11], slime mould algorithm (SMA) [12], Hunger games search (HGS) [13], and Runge–Kutta (RUN) optimizer [14]. The third class includes algorithms that simulate physical or chemical phenomena. Examples of this class are simulated annealing (SA) [15], and gravitational search algorithm (GSA) [16]. The last class includes algorithms, which are inspired by human behavior like teaching learning-based optimization (TLBO) [17] and tabu (Taboo) search (TS) [18]. In addition to engineering optimization problems [19, 20], these stochastic methods have found their applications and contributions in more complex problems and attracted many works in science and engineering fields such as medical data classification [21,22,23,24], scheduling problems [25, 26], feature selection [27,28,29], wind speed forecast [30], engineering design problems [31,32,33]. Furthermore, potential of metaheuristics is not limited to such problems and still much room to discover in the fields of hard maximum satisfiability problem [34, 35], bankruptcy prediction [36, 37], parameter optimization [38,39,40], PID control [41,42,43], detection of foreign fiber in cotton [44, 45], surveillance [46], service ecosystem [47, 48], micro-expression spotting [49, 50], and prediction problems in educational ground [51, 52].

WOA is a recent algorithm developed by the author in [53] that has gained huge attention due to its simple code and high similarity with grey wolf optimizer (GWO). This algorithm can outperform many state-of-the-art algorithms such as GSA, PSO, and GA. This algorithm is based on the humpback special hunting behavior, which is called the bubble net method. WOA has received huge interest and global attention since its inception, as it shows a good performance in handling many optimization tasks. Consequently, some modifications have been made by many researchers. In [54], they proposed a binary version of WOA using two transfer functions. The new versions applied to solve travel salesman problem (TSP). In [55], Aljarah et al. used WOA to find the optimal connecting weights in a neural network. Also, Elaziz et al. [56] developed a hyper-heuristic algorithm by using DE to improve the initial WOA population. In [57], Emary et al. tried to study the impact of levy flight in WOA and SCA. Likewise, Oliva et al. [58] proposed a new version of WOA using chaotic maps and applied it to estimate photovoltaic cell parameters. In [59], Xiong et al. proposed an improved version of WOA by developing two prey search strategies. In [60], Chen et al. proposed two strategies based on Lévy flight and chaotic local search to have a good balance between the core capacities. Also, authors in [61] introduced a hybrid version of WOA and SA by embedding SA in WOA as a local search strategy. In [62], Abdel-Basset et al. designed a new version of WOA and used it in Cryptanalysis in Merkle–Hellman Cryptosystem. Another hybrid version between WOA and GWO called WGC is introduced to cluster data [63]. Agrawal et al. [64] applied embedded quantum operators in WOA and used it in the feature selection problem. Authors in [65] proposed a new version using an opposition-based technique to prevent the basic whale method on from getting trapped in local optima. Also, in works of [66, 67], the proposed approach was applied to the feature selection problem. In [68], Hemasian-Etefagh et al. tried to prevent the classical WOA from trapping into local optima by introducing a new version called group WOA (GWOA), in which the population was divided into many groups based on their fitness value. In [69], Hassib et al. proposed a novel classification framework for big data using the WOA. To solve job shop scheduling problems (JSSP), [70] tried to solve it by introducing a hybrid algorithm called (WOA-LFDE) in which differential evolution (DE), and Lévy flight are hybridized with WOA. Also, in [71], Jiang et al. introduced an enhanced WOA by embodying two approaches: introducing an armed force program and adjusting beneficial strategy. In [72], Guo et al. used a modified version of WOA by using the adaptive strategy of the neighborhood to forecast the demand for water resources. Also, in [73], Got et al. introduced an enhanced multi-objective version of WOA called guided population archive WOA (GPAWOA) to solve multi-objective problems.

WOA has been applied to many medical applications. Authors in [39] developed a chaotic multi-swarm WOA version called CMWOA using a support vector machine (SVM) and applied it to perform feature selection to many well-known and common medical diseases problems such as breast cancer, erythemato-squamous, and diabetes. Also, in [74], Abdel-Basset et al. integrated the basic WOA with TS and employed it to solve the quadratic assignment problem (Locating departments of the hospital). In [75], Tharwat et al. used WOA with SVM to be able to classify the biotransformed toxicity effects of hepatic drugs. Also, in [76], Zhao et al. mixed SVM kernel function with WOA to classify colorectal cancer diagnosis.

Gharehchopogh and Gholizadeh listed all WOA variants and applications with details in a comprehensive survey [77]. Despite the original WOA success, many works showed that its performance might degrade when solving some optimization tasks.

On the other hand, another recent metaheuristic called virus colony search (VCS) was developed [11]. VCS simulates viruses diffusion and infection behavior in attacking cells. VCS has been applied to many power optimization problems such as unit commitment [78], resource allocation [79], and distributed generators placement [80].

In this study, a new enhanced WOA-based algorithm is designed that embedded the core mechanisms of VCS into the main method. It aims to overcome these limitations by revisiting the WOA based on the core components of the Gaussian walk, CMA-ES, and evolution strategy that appeared in the VCS. This could prevent WOA from getting trapped into local optima by maintaining a better balance among the exploration and exploitation capabilities. To evaluate the resulted framework, 30 benchmark cases from IEEE CEC2017 were employed in addition to four different constrained engineering problems. Besides, the enhanced WOA-based variant has been applied to image segmentation, where eight images are utilized, and they are compared with various WOA variants. The attained results show that the new structure has alleviated the central shortcomings of WOA, and we saw a significant performance for the proposed VCSWOA compared to other peers.

This paper is organized as follows. Sections 2 and 3 give a detailed description and mathematical equations to the WOA and VCS, respectively. Sections 4 and 5 show the proposed method and results discussions. Section 6 concludes the paper.

2 Whale optimization algorithm

In this section, we present the basics of the WOA by describing its main components, such as inspiration, its mathematical model, and how it deals with exploration and exploitation. The WOA [53] introduced by Mirjalili et al. in 2016, which mimics the foraging of humpback whales. Whales are beautiful creatures that have a special hunting technique called bubble-net feeding or 9-shape. Then, other agents attempt to change their location vector to attain the best position according to Eq. (1).

$$\begin{aligned} \mathbf {D}= & {} |\mathbf {C}.\mathbf {X}^{*}(t)-\mathbf {X}(t)| \end{aligned}$$
(1)
$$\begin{aligned} \mathbf {X(t+1)}= & {} \mathbf {X}^{*} (t+1)-\mathbf {A}.\mathbf {D} \end{aligned}$$
(2)

where t denotes the counter of iteration, \(\mathbf {C}\) and \(\mathbf {A}\) are coefficient vectors, \(\mathbf {X}^{*}\) means the position vector of the best agent, and \(\mathbf {X}\) is the location vector. \(\mathbf {A}\) and \(\mathbf {C}\) values are obtained from the following rules:

$$\begin{aligned} \mathbf {A}= & {} 2.\mathbf {a}.\mathbf {r}-\mathbf {a} \end{aligned}$$
(3)
$$\begin{aligned} \mathbf {C}= & {} 2.\mathbf {r}, \end{aligned}$$
(4)

where a is linearly decreased from 2 to 0 over iterations and r randomly bounded in [0,1]. To mathematically simulate the exploitation phase, we have two approaches (1) Shrinking encircling: attained by decreasing a value’s with regard to Eq. (4). Note that \(\mathbf {A}\) is a random value between \([-a,a]\). (2) Spiral updating: this phase realizes the distance between the whale and the prey. Equation (5), calculates the spiral that mimics the helix-shaped movement as follow:

$$\begin{aligned} \mathbf {X}(t+1)=\mathbf {D}^{l}e^{bl}.\cos (2\pi l))+\mathbf {X}^{*}(t), \end{aligned}$$
(5)

where b is constant, l is a random number in \([-1,1]\). To select either spiral moves or shrinking encircling phase, a chance of 50% is assumed as follow:

$$\begin{aligned} \mathbf {X}(t+1)=\left\{ \begin{array}{ll} \mathbf {X^{*}}(t)-\mathbf {A}.\mathbf {D}& if\; p<0.5\\ \mathbf {D^{l}}.e^{bl}.\cos (2\pi l)+\mathbf {X^{*}}(t)& if\; p\ge 0.5, \end{array}\right. \end{aligned}$$
(6)

where p is a random number in a uniform distribution. In other hand side, in exploration (diversification) stage, \(1\prec A\prec -1\) is used to force the solution to move away from this location. Equations (7) and (8), represent the mathematical for exploration phase as follow:

$$\begin{aligned} \mathbf {D}= & {} |\mathbf {C}.\mathbf {X}_{rand}-\mathbf {X}| \end{aligned}$$
(7)
$$\begin{aligned} \mathbf {X}(t+1)= & {} X_{rand}-\mathbf {A}.\mathbf {D} \end{aligned}$$
(8)

The general pseudo-code steps of WOA are presented in Algorithm 1.

figure a

3 Virus colony optimization algorithm

Virus colony search (VCS) is a novel population algorithm inspired by nature, which simulates infection and diffusion techniques. VCS mainly depends on three strategies: (1) Gaussian walk, (2) CMA-ES, and (3) evolution strategy.

The population is divided into two groups: \(V_{pop}\) which refers to virus colony, and \(H_{pop}\), which refers to host cell colony. A host cell is infected by one virus. Then, the virus must obtain nutrients by destroying the host cell to be able to reproduce. Finally, the few best viruses remain in the next generation, and the other viruses are evolved. The following subsections simulate these steps mathematically.

3.1 Viruses diffusion

A random walk is needed in this phase to simulate virus moving. Gaussian random walk (GRW) is used since it has a good performance as given in Eq. (9).

$$\begin{aligned} V pop_{i}=\text {Gaussian}(G^{g}_{best},\tau )+(r_{1}. G^{g}_{best}-r_{2}.V_{pop_{i}}), \end{aligned}$$
(9)

where i refers to a random value and equals \({1,2,3, \ldots ,N}\) where N is the size of the population, \(r_{1} \& r_{2}\) are random variables and falls in the interval [0, 1], and \(\tau\) refers to the standard deviation and can be calculated as follows:

$$\begin{aligned} \tau = \log (g)/g . (V_{pop_{i}} - G^{g}_{best}). \end{aligned}$$
(10)

In Eq. (9), the term \((r_{1}. G^{g}_{best}-r_{2}.V_{pop_{i}})\) is used as a search direction in order to prevent direction from getting trapped in a local optimum. Also, the term log(g)/g is used to decrease Gaussian jump size over generations to improve the local search performance.

3.2 Host cells infection

In this stage, the virus invades the host cell and tries to destroy it until its death. Then, the virus interacts with the host cell by absorbing essential nutrition and metabolizing harmful substances. Then, the host cell will be converted into a new virus. This process is used to improve the capabilities of the exploration process and observe the exchange of information. Hence, covariance matrix adaptation evolution strategy (CMA-ES) can be used to model derivative-free and stochastic optimization. The main steps to mathematically simulate this stage is as follows:


Step 1: \(H_{pop}\) updating process using Eq. (11).

$$\begin{aligned} H pop_{i}^{g}= \left( \frac{\sum _{i}^{N}V_{pop_{i}}}{N}\right) +\sigma _{i}^{g} \times N_{i}(0, c_{g}) \end{aligned}$$
(11)

where \(N_{i}(0, c_{g})\) refers to the normal distribution with mean \(0 \text { and }\)D\(\times D\) covariance matrix \(c_{g}\). D refers to problem dimension, g refers to the current iteration.

Step 2: Selection of the best \(\lambda\) from the previous stage as a parental vector. The selected vector center can be calculated as follow:

$$\begin{aligned} \begin{aligned} X^{g+1}_\mathrm{{mean}}&=\frac{1}{\lambda }\sum _{i=1}^{\lambda }w_{i} Vpop^{\lambda best}_{i}|wi=\ln (\lambda +1) \\&\quad \times \left( \sum _{j=1}^{\lambda }(\ln (\lambda + 1)- \ln (j))\right) , \end{aligned} \end{aligned}$$
(12)

where \(\lambda\) can be calculated as \({\lfloor }{\frac{N}{2}}{\rfloor }\), i refers to the individual index, \(w_{i}\) refers to recombination weight. Here, two evolution paths can be computed to track the population mean changes with an exponential decay of the past.

$$\begin{aligned}&\begin{aligned} p^{g+1}_{\sigma } =(1-c_{\sigma })p^{g}_{\sigma }+\sqrt{c_{\sigma }(2-c_{\sigma })\lambda _{w}} \\ \frac{1}{\sigma ^{g}}(c^{g})^{-1/2}(X^{g+1}_\mathrm{{mean}}-X^{g}_\mathrm{{mean}}) \end{aligned} \end{aligned}$$
(13)
$$\begin{aligned}&\begin{aligned} p^{g+1}_{c} =(1-c_{c})p^{g}_{c}+h_{\sigma }\sqrt{c_{c}(2-c_{c})\lambda _{w}} \\ \frac{1}{\sigma ^{g}}(X^{g+1}_\mathrm{{mean}}-X^{g}_\mathrm{{mean}}) \end{aligned} \end{aligned}$$
(14)

where \(\lambda _{w}^{-1}=\sum _{i=1}^{\lambda } w_{i}^{2}\), \(c_{\sigma }=(\lambda _{w}+2)/ (N+\lambda _{w} + 3)\), \(c_{c}=4/(N + 4)\), \(h_{\alpha }=1\) if \(||p_{\sigma }^{g+1}||\) is large.

Step 3: Updating the step size

\(\sigma ^{g+1}\) can be updated using Eq. (15).

$$\begin{aligned} \sigma ^{g+1}=\sigma ^{g} \times \exp \left( \frac{c_{\sigma }}{d_{\sigma }}\left( \frac{||p_{\sigma }^{g+1}||}{E||N(0,I)||}-1\right) \right) \end{aligned}$$
(15)

Also, covariance matrix \(c^{g+1}\) is constructed using Eq. (16).

$$\begin{aligned} \begin{aligned} c^{g+1}&=(1-c_{1}-c_{\lambda })c^{g}+c_{1}p_{c}^{g+1}(p_{c}^{g+1})^\mathrm{{T}}\\&\quad +c_{\lambda }\sum _{i=1}^{\lambda }w_{i}\frac{vpop_{i}^{\lambda best}-X_\mathrm{{mean}}^{g}}{\sigma ^{g}}.\frac{(Vpop_{i}^{\lambda best} - X_\mathrm{{mean}}^{g})^\mathrm{{T}}}{\sigma ^{g}} \end{aligned} \end{aligned}$$
(16)

where \(c_{1}, c_{2}\) have

$$\begin{aligned} d_{\sigma }= & {} 1+ c_{\sigma }+2\max {\{0,(\sqrt{\lambda _{w}-1}/\sqrt{N+1})-1}\} \end{aligned}$$
(17)
$$\begin{aligned} c_{1}= & {} \frac{1}{\lambda _{w}}\left( \left( 1-\frac{1}{\lambda _{w}}\right) \min \left\{ 1,\frac{2\lambda _{w}-1}{(N+2)^{2}+\lambda _{w}}+\lambda _{w}\right\} \right. \nonumber \\&\left. +\frac{1}{\lambda _{w}}.\frac{2}{\lambda _{w}} (N+\sqrt{2})^{2} \right) \end{aligned}$$
(18)
$$\begin{aligned} C_{\lambda } & = (\lambda _{w} - 1) C_{1} \end{aligned}$$
(19)

3.3 Immune response

According to the host cell immune influence system, only the highest performance virus will retain its properties to the next generation and the others are killed by the immune system. Hence, following steps are used to model the virus evolution.

Step 1: Performance rank evaluation

\(Pr_{rank(1)}\) can be calculated as follow.

$$\begin{aligned} Pr_{rank(1)}=\frac{(N-i+1)}{N} \end{aligned}$$
(20)

Step 2: Evolution of individuals

$$\begin{aligned} \begin{aligned} \left\{ \begin{array}{ll} Vpop_{i,j}=Vpop_{k,j}-rand \times \\ (Vpop_{h,j} - Vpop_{i,j})&{} r > Pr_{rank(i)}\\ \\ Vpop_{i,j}=Vpop_{i,j}&{} {\text {otherwise}} \end{array} \right. \end{aligned} \end{aligned}$$
(21)

where the 3 variables kih are chosen randomly from \([1, 2, 3, \ldots , N]\) such that \(i \ne k \ne h\), and \(j \in 1, 2, 3, \ldots , d]\) and rand and r are the random values \(\in\) [0, 1].

4 Proposed algorithm

In this section, the structure of the proposed WOA-based method is explained in detail, as given in Fig. 1. The basic WOA has some core limitations, especially in solving complex problems, mainly the multimodal functions and high dimensional ones. The main WOA’s limitations are dropping into local optima and the problem of the slow convergence.

VCSWOA aims to overcome these limitations by revisiting the WOA based on the core components of Gaussian walk, CMA-ES, and evolution strategy that appeared in the VCS. These ideas are to enhance the convergence speed and local optima avoidance of the WOA method. Here, the components of the VCS algorithm are devoted to performing intensification drifts to make the WOA algorithm more capable of avoiding local optima, which will reflect an improvement in exploitation abilities. On the other hand, the conventional cores of the WOA are utilized to handle exploratory patterns we need during a well-organized searching around the regions of the feature domain. In this way, we can reach a well-harmonized balance between exploitation and exploration procedures.

The pseudo-code of VCSWOA is shown in Algorithm , and it works as follows: An initial whale population is generated randomly at the initial state. Then, the three phases of Gaussian walk, CMA-ES, and evolution strategy are performed to further evolve the immature population: i.e., viruses diffusion, host cell infection, and immune response in VCS. After that, the updating phase of each search agent’s position is done based on p and |A| values.

figure b
Fig. 1
figure 1

The flowchart of the proposed method

5 Experiment

In this section, many experiments have been performed to prove the efficiency of the proposed algorithm: benchmark functions, Engineering problems, and image segmentation problems.

5.1 Benchmark functions

Thirty functions from the IEEE CEC2017 benchmark have been used. Table 1 defines these functions and their type including unimodal, multimodal, hybrid, and composite. VCSWOA has been compared with other eight WOA variants namely: chaotic WOA (CWOA) [81], Opposition learning-based WOA (OBWOA) [82], A-C parametric WOA (ACWOA) [83], Enhanced associative learning-based exploratory WOA (BMWOA), improved WOA (IWOA) [84], Balanced WOA with levy flight and chaotic local search (BWOA) [60], Multi-strategy boosted mutative WOA (CCMWOA) [], and Levy flight-based WOA (LWOA) [57]. The parameter settings for each algorithm are given in Table 2. The number of individuals, number of dimensions, and the maximum number of function evaluations (MaxFEs) are given in Table 3. We used same conditions as per fair comparisons settings in artificial intelligence community [85, 86].

Table 4 shows the experiment results in terms of average (mean), standard deviation (std), best (min), and worst (max). From this table, it can be noticed that VCSWOA ranked first in all unimodal functions (F1–F3) in Avg and Std values. However, in multimodal ones, VCSWOA has ranked first in avg at five functions (F4, F6, F8, F9, and F10), and ranked second in the other 3 functions. For both composite and hybrid functions, VCSWOA achieved the highest value in 7 functions and the second highest in other 8 functions. Also, Table 5 shows the Wilcoxon signed-rank [87] results in which VCSWOA has considered superior compared with other algorithms with a p value smaller than 5%. Figure 2 shows the convergence curve for 10 selected functions.

Table 1 CEC2017 benchmark functions
Table 2 The parameter settings for the algorithms
Table 3 The parameter settings
Table 4 The comparison results of all algorithms over 30 functions
Fig. 2
figure 2

Unimodal and multi-modal functions convergence curve

Table 5 The calculated p values from the signed-rank test

5.2 Engineering problems

In this subsection, four different engineering problems have been used: pressure vessel design problem, welded beam design problem, tension/compression spring design problem, and cantilever beam design problem.

5.2.1 Pressure vessel design problem

Pressure vessel design problem is considered as a one of the wide engineering design problems which aims to find the lowest materials cost of the pressure vehicle. It’s consist of 4 parameters(Shell thickness \(T_{s}\), Cylindrical length L, head thickness \(T_{k}\) and Radius R). The mathematical design can be formulated as:

Minimize: \(f(x)=0.6224{{x}_{1}}{{x}_{3}}{{x}_{4}}+1.7781{{x}_{2}}x_{3}^{2}+3.1661x_{1}^{2}{{x}_{4}}+19.84x_{1}^{2}{{x}_{3}}\)

Subject to: \({{g}_{1}}\left( x \right) =-{{x}_{1}}+0.0193x\)

\({{g}_{2}}\left( x \right) =-{{x}_{2}}+0/00954{{x}_{3}}\le 0\)

\({{g}_{3}}\left( x \right) =-\pi x_{3}^{2}{{x}_{4}}-\left( {4}/{3}\; \right) \pi x_{3}^{3}+1,296,000\le 0\)

\({{g}_{4}}\left( x \right) ={{x}_{4}}-240\le 0\)

Variable Range \(0\le {{x}_{i}}\le 100,\quad \quad i=1,2\)

\(0\le {{x}_{i}}\le 200,\quad \quad i=3,4\)

Table 6 shows the results of VCSWOA compared with SMA, WOA, GWO, MFO, ACO, HPSO, and BA. It’s obvious that the proposed algorithm has less cost.

Table 6 Optimization results for pressure vessel design problem

5.2.2 Welded beam design problem

This problem has 4 parameters: bar length(l), bar height(t), Thickness of welded(h), and thickness of bar(b). Its mathematical equations can be shown as below:

Minimize:

\({{f}_{1}}(x)=1.10471*x{{\left( 1 \right) }^{2}}*x\left( 2 \right) +0.04811*x\left( 3 \right) *x\left( 4 \right) *\left( 14.0+x\left( 2 \right) \right)\)

Subject to:

\({{g}_{1}}\left( x \right) =\tau -13,600\)

\({{g}_{2}}\left( x \right) =\sigma -30,000\)

\({{g}_{3}}\left( x \right) =x\left( 1 \right) -x\left( 4 \right)\)

\({{g}_{4}}\left( x \right) =6000-p\)

Variable Range

\(0.125\le {{x}_{1}}\le 5\)

\(0.1\le {{x}_{2}}\le 10\)

\(0.1\le {{x}_{3}}\le 10\)

\(0.125\le {{x}_{4}}\le 5\)

Table 7 Optimization results for welded beam design problem

The results in Table 7 shows that VCSWOA has reach the most near optimal solution against many metaheuristic algorithms.

5.2.3 Tension/compression spring design problem

The third problem used is Tension/Compression Spring problem which has 3 parameters :coil diameter(D), wire diameter(d), and number of active soils(N). The mathematical formulation is shown below:

Minimize:

\(f(x)=\left( {{x}_{3}}+2 \right) {{x}_{2}}x_{1}^{2}\)

Subject to:

\({{g}_{1}}\left( x \right) =1-\left( {x_{2}^{3}{{x}_{3}}}/{71}\;,785x_{1}^{4} \right) \le 0\)

\({{g}_{2}}\left( x \right) =\left( 4x_{2}^{2}-{{{x}_{1}}{{x}_{2}}}/{12,566\left( {{x}_{2}}x_{1}^{3}-x_{1}^{4} \right) }\;+\left( {1}/{5108x_{1}^{2}}\; \right) \right) -10\le 0\)

\({{g}_{3}}\left( x \right) =1-\left( {140.45{{x}_{1}}}/{x_{2}^{2}{{x}_{3}}}\; \right) \le 0\) \({{g}_{4}}\left( x \right) ={\left( {{x}_{2}}+{{x}_{1}} \right) }/{1.5-1}\;\le 0,\)

Variable Range

\(0.05\le {{x}_{1}}\le 2.00\)

\(0.25\le {{x}_{2}}\le 1.30\)

\(2.00\le {{x}_{3}}\le 15.00\)

The statistical results to this problem are shown in Table 8 in which the proposed algorithm is compared with GA, WOA, MVO, GSA, PSO and MFO and it’s noticed that VCSWOA has the best result.

Table 8 Optimization results for the Tension/compression design problem

5.2.4 Cantilever beam design problem

The last engineering problem introduced in this subsection is the Cantilever beam design problem which consists of 5 square hollow cross-sections. It intends to dwindle the Cantilever beam mass. The problem formulation is shown as follows:

Minimize:

\(f(x)=0.6224(x_{1}+x_{2}+x_{3}+x_{4}+x_{5})\)

Subject to:

\(G(x)=61/x_{1}^{3}+37/x_{2}^{3}+19/x_{3}^{3}+7/x_{4}+1/x_{5}^{3}\)

Variable Range

\(0.1\le {{x}_{i}}\le 100,\qquad i=1,2,3,4,5\)

Table 9 Optimization results for cantilever beam problem

Table 9 compares VCSWOA with many algorithms MFO, SOS, CS, MMA, and GCA. It is seen that VCSWOA achieved the best result. As per results, we can find the potential of the proposed WOA-based method is not limited to these cases and it can be applied to more complex cases such as image classification [95, 96].

5.3 Image segmentation

In literature, many techniques are existed to segment images such as Otsu [97], Kapur [98], etc which are used to divide image histogram to different groups based on threshold values. Figure 3 shows the flowchart of Berkeley image segmentation(MIS) for 241,004. Here, to validate our algorithm VCSWOA, 8 images from BSDS500 are used namely: 291,000, 38,092, 86,068, 170,057, 61,060, 175,032, 223,061, and 19,021. Figure 4 shows these images and their 2D histogram. Different metaheuristic algorithms are used in order to compare their results with VCSWOA: WOA, BA, CS, CBA, SCA, BLPSO, IGWO, IWOA, and SCADE. Finally, Peak Signal to Noise Ratio (PSNR) [99], Structural Similarity Index (SSIM) [100], and Feature Similarity Index (FSIM) [101] are used to evaluate image segmentation results. PSNR, SSIM, FSIM can be calculated from the following equations:

$$\begin{aligned} \text {PSNR}=20 \log _{10} \left( \frac{255}{\sqrt{\frac{\sum _{i=1}^{n}\sum _{j=1}^{m}(I_{i,j}-I_{\text {seq}})^{2}}{N.M}}}\right) \end{aligned}$$
(22)

where I and \(I_{\text {seg}}\) refers to the original image and segmented one. \(I_{i,j}\) refers to image gray level at (ij)th pixel

$$\begin{aligned} \mathrm{{SSIM}}(I, I_\mathrm{{seg}})=\frac{(2\mu _{I}\mu _{I_\mathrm{{seg}}}+c_{1})(2\sigma _{I,I_\mathrm{{seg}}}+c_{2})}{(\mu _{I}^{2}\mu _{I_\mathrm{{seg}}}^{2}+c_{1})(\sigma _{I}^{1}+\sigma _{I_\mathrm{{seg}}}^{2}+c_{2})} \end{aligned}$$
(23)

\(\mu _{I}\) and \(\mu _{I_\mathrm{{seg}}}\) refers to image mean intensity of I and \(I_\mathrm{{seg}}\) , respectively and, \(\sigma _{I}\) and \(\sigma _{I_\mathrm{{seg}}}\) refers to the standard deviation of I and \(I_\mathrm{{seg}}\), respectively.

$$\begin{aligned} \mathrm{{FSIM}}=\frac{\sum _{x \in \Omega }S_{L}(x) . \mathrm{{PC}}_{m}(x)}{\sum _{x \in \Omega } \mathrm{{PC}}_{m}(x)} \end{aligned}$$
(24)

where \(\Omega\) refers to the spatial domain of the whole image and \(S_{L}(x)\) and \(\mathrm{{PC}}_{m}\) can be calculated as follows:

$$\begin{aligned} S_{L}(x)=[S_\mathrm{{PC}}(x)]^{\alpha }[S_{G}(x)]^{\beta } \end{aligned}$$
(25)

where \(\alpha , \beta\) refers to PC and GM relative important parameters and \(S_{G}(x)\) can be calculated as follows:

$$\begin{aligned} S_{G}(x)= & {} \frac{2 G_{1}(x) . G_{2}(x) + T_{2}}{G_{1}^{2}(x) . G_{2}^{2}(x) + T_{2}} \end{aligned}$$
(26)
$$\begin{aligned} S_\mathrm{{PC}}= & {} \frac{2\mathrm{{PC}}_{1}(x).\mathrm{{PC}}_{2}(x)+ T_{1}}{\mathrm{{PC}}_{1}^{2}(x).\mathrm{{PC}}_{2}^{2}(x)+ T_{1}} \end{aligned}$$
(27)
Fig. 3
figure 3

Flowchart of MIS for 241,004

Fig. 4
figure 4

Three-dimension view about 2D histograms of 19,021 and 291,000

Furthermore, Figs. 5 and 6 respectively show the average PSNR for each threshold level and all threshold levels. Figures 7 and  8 respectively show the average SSIM for each threshold level and all threshold levels. Figures 9 and  10 respectively show the average FSIM for each threshold level and all threshold levels. And, Tables 1011121314, and 15 and Figs. 11, 12, 13, 14, 15, 16, 171819, 20 and 21 show the results of VCSWOA compared with other metaheuristics algorithms.

Also, Tables 1617 and 18 show the ranking of compared algorithms. It can be noticed that the proposed algorithm ranked first in almost all images.

As said by our findings, the developed WOA-based technique has obtained enhanced results based on its core exploitative patterns in engineering and image processing tasks. Hence, we suggest the application of our WOA variant to problems on the evaluation of human lower limb motions [102], Lunar impact crater detection and age estimation [103], social recommendation and QoS-aware service composition [104,105,106], shape registration [107], and regression tasks [108]. Also, its continuous and binary variants can be applied to gate resource allocation [109, 110], and shape analysis [111, 112]. Also, we need to apply this variant of WOA to more real-world problems and investigate its full explorative features based on more cases such as brain function prediction [113, 114], covert communication system [115,116,117], epidemic prevention and control [118, 119], large scale network analysis [120], energy storage planning and scheduling [121], medical diagnosis [95, 122,123,124], pedestrian dead reckoning [125], image dehazing [126,127,128], and feature selection [129,130,131].

Table 10 The PSNR comparison results of VCSWOA and other methods
Table 11 The PSNR comparison results of VCSWOA and other methods
Table 12 The SSIM comparison results of VCSWOA and other methods
Table 13 The SSIM comparison results of VCSWOA and other methods
Table 14 The FSIM comparison results of VCSWOA and other methods
Table 15 The FSIM comparison results of VCSWOA and other methods
Table 16 The PSNR comparison results of VCSWOA and other methods
Table 17 The SSIM comparison results of VCSWOA and other methods
Table 18 The FSIM comparison results of VCSWOA and other methods
Fig. 5
figure 5

Average of PSNR at each threshold level

Fig. 6
figure 6

Average of PSNR for all threshold levels

Fig. 7
figure 7

Average of SSIM at each threshold level

Fig. 8
figure 8

Average of SSIM for all threshold levels

Fig. 9
figure 9

Average of FSIM at each threshold level

Fig. 10
figure 10

Average of FSIM for all threshold levels

Fig. 11
figure 11

Threshold values of 291,000 obtained by each algorithm at level 6

Fig. 12
figure 12

Threshold values of 223,061 obtained by each algorithm at level 6

Fig. 13
figure 13

Threshold values of 175,032 obtained by each algorithm at level 6

Fig. 14
figure 14

Threshold values of 170,057 obtained by each algorithm at level 6

Fig. 15
figure 15

Threshold values of 86,068 obtained by each algorithm at level 6

Fig. 16
figure 16

Threshold values of 61,060 obtained by each algorithm at level 6

Fig. 17
figure 17

Threshold values of 38,092 obtained by each algorithm at level 6

Fig. 18
figure 18

Threshold values of 19,021 obtained by each algorithm at level 6

Fig. 19
figure 19

Convergence curves of Kapur’s entropy at threshold value 18

Fig. 20
figure 20

Segmented results of 61,060 obtained by each algorithm at threshold value 18

Fig. 21
figure 21

Samples of the segmented images

6 Conclusion and future works

As there are some core shortcomings for WOA, such as immature convergence and stagnation, we proposed an enhanced VCSWOA method with two active cores of the WOA and VCS optimizers as a new structure. We considered a set of functions from the IEEE CEC2017 competition, and four different engineering problems are utilized to validate the efficacy of the developed VCSWOA. Also, the VSCWOA has been verified in dealing with image segmentation problems over many threshold values. We observed that the VSCWOA achieves the best results than other WOA-based algorithms, namely CWOA, OBWOA, ACWOA, BMWOA, IWOA, BWOA, and CCMWOA. The proposed approach is also applied to several well-known methods of image cases. The results indicate the convergence speed and quality of searching has enhanced significantly based on the better balance amongst the essential diversification and intensification trends.

For future works, we intend to develop the binary and multi-objective version of the WOA-based method. Applying this variant to the training of neural networks is another valuable direction that is in line with the higher exploratory power of the VCSWOA.