1 Introduction

Optimization is an attempt of receiving the optimal solution of the problem under the given situation. The main objective of the optimization is to reduce the time or increase the desired benefits. Optimization methods can be defined as the process of attaining optimal solutions that respond to the given objective functions. Recently, many algorithms have been brought to solve the problem. Nature-inspired algorithm as swarm intelligence and evolutionary algorithm is an effective algorithm which has been developed and published by many researchers.

Bat algorithm was developed by Yang [1] in 2010. The main idea of the algorithm is derived from the behavior of bats searching for food/prey. There are three important steps of the algorithm as follows: first, bats search the object by using sound reflection to recognize the distance between food/prey and obstacles. In the second step, while flying (in random) it changes frequency, loudness and pulse emission rate which can be adjusted to find food/prey automatically based on the close proximity of the target. The pulse will start from zero and will increase gradually as the bat approach their food/prey. In the last step, loudness will be changed in various ways when approaching food/prey (i.e., change volume of the highest to the lowest).

In recent years, many studies have been developed in applying the bat algorithm for solving topics in various fields. It proves that bat algorithm works efficiently with a typical quick start [2, 12]. Nevertheless, the gap of improvement could be found and presented to solve the optimization problem in several papers as the following examinations.

Yang and Gandomi [3] present a new metaheuristic method which is modified from bat algorithm for continuous optimization problems, such as dealing with highly nonlinear problem efficiently and finding the optimal solutions accurately in comparison to GA algorithm and PSO algorithm. Tsai et al. [4] developed Evolved Bat Algorithm (EBA) by changing the movement process of original bat algorithm. The accuracy of the algorithm is better than the original bat algorithm for solving numerical optimization problem. Ramesh et al. [5] presented the application of bat algorithm based on mathematical modeling for solving the multi-objective optimization problem in a power system. The application was used as a test on two test cases. The result was much better than the ones from the RGA, SGA, Hybrid GA, and ABC algorithm. Musikapun and Pongcharoen [6] presented bat algorithm that was based on a scheduling tool (BAST) for solving muti-stage, multi-machine and multi-product scheduling problems. Mishra et al. [7] proposed on combining the bat algorithm to update the weights of a functional link artificial neural network (BAT-FLANN) for classification. It used the echo location to find the minimum distance to the objects and moved the bat to a new solution. The result of the algorithm is faster than the PSO algorithm. Yılmaz and Küçüksille [8] proposed an enhanced bat algorithm (EBA). It combines the inertia weight modification (IS1), distribution of the population modification (IS2), and hybridization with invasive weed optimization (IS3). The IS1 method modifies the process of velocity and location similarities with PSO. The (IS2) method proposed on modifying the velocity with the equation \(v_{i}^{t} = \omega \left( {v_{i}^{t - 1} } \right) + \left( {x_{i}^{t} - x_{*} } \right)f_{i} \zeta_{1} + \left( {x_{i}^{t} - x_{k}^{t} } \right)f_{i} \zeta_{2}\) from the standard velocity of PSO, and the IS3 method improved the local search capability of bat algorithm with IWO. The paper claims that the EBA provides better results than the standard Bat algorithm. Mehrabian and Lucas [9] presented a novel stochastic optimization model in 2006. The basic properties of the process on colonizing behavior of weeds are the following: a limited number of seeds are spread out over the search area, seeds of plants flowering and seed production was depended on the fitness, and seed production was distributed randomly over the searching area, and new plants were grown. With the propagation of weeds in nature, the stronger weed has the opportunity to grow more than the weaker ones. Reproduction step from invasive weed algorithm generated seeds that are randomly over the search space dimension from a normal distribution. Basak et al. [10] presented the hybrid invasive weed optimization algorithm (IWO) and differential evolution called differential invasive weed optimization (DIWO). The DE/rand/1/bin is used in the seed production step for mutation populations. The paper shows that the performance of DIWO is better than the original invasive weed optimization (IWO) and differential evolution (DE). Zhang et al. [11] illustrated a modified invasive weed optimization with a crossover operation (MIWO) for impeding premature convergence to a local optimum. The procedure of crossover operation starts after a spatial dispersal step of invasive weed optimization. The performance of MIWO is better than the standard invasive weed optimization and particle swarm optimization.

The bat algorithm and the improvement of bat algorithm can solve optimization problem efficiently in the literature especially for low-dimensional functions. However, it still has some drawbacks in dealing with the height dimension function. The performance of the algorithm decreased significantly and is easily trapped in the local optima because it tends to initially converge at a very pace [2, 12]. The IWO algorithm and GA have a strong robustness and a fast global searching ability. They provide the way of reproduction and spatial dispersal in competitive exclusion more and are distinctive than other numerical search algorithms Therefore, the IWO and GA are embedded in the traditional bat algorithm to deal with these weakness points. The reproduction concept from the IWO, mutation crossover, and selection concepts from the GA are applied as local search operator in order to expand the searching area and improve the convergence performance of the original bat algorithm. All details are described in the following section.

Section 2 describes the original bat algorithm (BA). Section 3 presents a proposed algorithm with a description of each step. The experimental results are explained in Sect. 4, and the conclusion is given in Sect. 5.

2 Bat algorithm

The metaheuristic Bat algorithm was developed by Yang in 2010. The algorithm is based on the echolocation behavior of micro-bats with varying pulse rates of emission and loudness. The echolocation idea of the bats can be concluded as follows: Each bat flies randomly with a velocity v i at position (solution) x i with a wavelength and loudness A 0. In the searching area, the bat changes frequency, loudness and pulse emission rate r ∊ [0, 1] to find its prey. The best solution will be selected and the iteration will be continued until the stopping criteria is met (Fig. 1).

Fig. 1
figure 1

Flowchart of the bat algorithm

The structure of bat algorithm consists of the following components:

Step 1:

the NB vectors of initial bat populations are generated. All vectors \( X_{i}^{B} = \left( {x_{1i} , x_{2i} , x_{3i} , \ldots , x_{Di} } \right) \) are randomly produced with uniform distribution between 0 and 1, where \( i = 1, 2, 3, \ldots , NB\); D is the dimension of the target vector and B is refers to Bth generation. After the initial bat population are produced, velocity vector \( V_{i}^{B} = \left( {v_{1i} , v_{2i} , \ldots , v_{Di} } \right) \) is constructed; the maximum frequency (Q max) value and minimum frequency (Q min) value are evaluated. Then pulse rate (r i ) value and loudness \( A_{i}^{B} \) value are randomly generated.

Step 2:

Bat motion step. All bats move from current location, B, to new location, B + 1, and turn to be the new solutions by the equation as follows:

$$Q_{i}^{B} = Q_{\hbox{min} } + \left( {Q_{\hbox{max} } - Q_{\hbox{min} } } \right) \times {\text{rand}}\left( {0,1} \right)$$
(1)
$$v_{i}^{B + 1} = v_{i}^{B} + \left( {x_{i}^{B} - x_{best} } \right) \times Q_{i}^{B}$$
(2)
$$x_{i}^{B + 1} = x_{i}^{B} + v_{i}^{B + 1}$$
(3)

where x best is the best fitness value in the population at generation B.

Step 3:

the local search step. Local search is applied to each solution. Random value will be generated for each solution to be compared with the pulse rate. The solution which has less random number than pulse rate will be selected. Local search modifies the current best solution by the following equation:

$$x_{i}^{B + 1} = x_{\text{best}} + \left( {\varepsilon A_{i}^{B} } \right) \times {\text{rand}}\left( {0,1} \right)$$
(4)

where the factor ɛ is limited the step size of random walks between 0 and 1.

Step 4:

after local search step, the pulse rate \(r_{i}^{B}\) value increases and decreases the loudness \(A_{i}^{B}\) value by the following equation:

$$A_{i}^{B + 1} = \alpha A_{i}^{B}$$
(5)
$$r_{i}^{B + 1} = r_{i}^{B} \left[ {1 - \exp^{{\left( { - \gamma \varepsilon } \right)}} } \right]$$
(6)

where α and γ are constants. The whole process is repeated until the desired number becomes satisfied.

3 Proposed algorithm

In the previous section, it was found that the local search of BA (Step 3) is likely to stick with the local space. To compare with other metaheuristic algorithms, BA is more complicated [13] because each bat is assigned a set of interacting parameters (e.g., position, velocity, pulse rate, loudness, and frequencies) which affect solution quality and time needed to obtain a solution.

This paper proposes a hybrid bat algorithm with an invasive weed optimization algorithm (IWO) and genetic algorithm (GA) which has the ability for a good exploration as a continuous optimization problem. The procedure for creating the proposed model includes the following steps:

  1. Step 1

    initialization of the population. This process is the same as the bat algorithm. It generates the maximum s max and least s min value of the seed. After that, the fitness values of the population are to be evaluated.

  2. Step 2

    the reproduction step from the invasive weed optimization algorithm is applied to calculate the number of seed. After that, the current population will be cloned so that it becomes equal to the number of seed. This is done by the following equation:

    $$N_{\text{seed}}^{i} = \frac{{{\text{fit}}_{i}^{B} - {\text{fit}}_{\hbox{min} }^{B} }}{{{\text{fit}}_{\hbox{max} }^{B} - {\text{fit}}_{\hbox{min} }^{B} }}\left( {s_{\hbox{max} } - s_{\hbox{min} } } \right) + s_{\hbox{min} }$$
    (7)

    where \({\text{fit}}_{i}^{B}\) is the present bat fitness, \({\text{fit}}_{\hbox{max} }^{B}\) and \({\text{fit}}_{\hbox{min} }^{B}\) represent the maximum fitness and minimum fitness of the current population, s max and s min represent the maximum and minimum seeds value of a weed.

  3. Step 3

    genetic algorithm is applied in order to expand the population as the following procedure:

  4. i.

    Mutation operation is carried out on all clone population by the equation:

    $$G_{s}^{B} = x_{i}^{B} + \left( {\exp^{{{{ - j} \mathord{\left/ {\vphantom {{ - j} {\hbox{max} }}} \right. \kern-0pt} {\hbox{max} }}_{k} }} } \right) \times {\text{rand}}\left( {0,1} \right)$$
    (8)

    where \(j = 1, 2, 3, \ldots , { \hbox{max} } _{k}\), max k is the order value of seed from \(N_{\text{seed}}^{i}\) and \(s = 1, 2, 3, \ldots , \ \sum N_{\text{seed}}^{i}\).

  5. ii.

    The roulette wheel selection is applied to select the population and then the crossover operation is performed. As a result, \(\left( {3 \times N_{\text{seed}}^{i} } \right) + 1\) numbers of offspring are generated. Finally, the vector \(R_{c}^{p} ; c = 1, 2, 3, \ldots , \sum \left[ {\left( {3 \times N_{\text{seed}}^{i} } \right) + 1} \right]\) will be produced and the fitness values will be evaluated.

  6. iii.

    After the offspring are created in ii), the new solution will be generated by moving the position from the following equations:

    $$Q_{c}^{p} = Q_{\hbox{min} }^{p} + \left( {Q_{\hbox{max} }^{p} - Q_{\hbox{min} }^{p} } \right) \times {\text{rand}}\left( {0,1} \right)$$
    (9)
    $$v_{c}^{p + 1} = v_{i}^{p} + \left( {x_{c}^{p} - x_{\text{best}}^{M} } \right) \times Q_{c}^{p}$$
    (10)
    $$x_{c}^{p + 1} = x_{c}^{p} + v_{c}^{p + 1}$$
    (11)
    $$x_{\text{best}}^{M} = \left\{ {\begin{array}{*{20}c} {x_{\text{best}}^{p} :\quad {\text{if fit}}_{\text{best}}^{p} < {\text{fit}}_{\text{best}}^{B} } \\ {\,x_{\text{best}}^{B} \quad \quad \quad \quad \quad \quad \quad } \\ \end{array} } \right.$$
    (12)

    where \(x_{\text{best}}^{p}\) is the best population from process ii).

  7. iv.

    The local search step: The local search is applied to each solution. The random value will be generated for each solution to be compared with the pulse rate. The solution which has less random number than pulse rate will be selected by the following specific equation:

    $$x_{c}^{p + 1} = \left\{ {\begin{array}{*{20}c} {x_{\text{best}}^{p} + \left( {\varepsilon A_{i}^{B} } \right) \times {\text{rand}}\left( {0,1} \right)\quad {\text{if}}:x_{\text{best}}^{p} < x_{\text{best}}^{B} } \\ {x_{\text{best}}^{B} + \left( {\varepsilon A_{i}^{B} } \right) \times {\text{rand}}\left( {0,1} \right)\quad \quad \quad \quad \quad \;\;} \\ \end{array} } \right.\;$$
    (13)
  8. Step 4

    after the local search step, the loudness is compared with the new random number in the range [0, 1] if the random value is less than the loudness value and \(f\left( {x_{\text{best}}^{p} } \right) < f\left( {x_{\text{best}}^{B} } \right)\) then accepts the new solutions and increase r i and reduce A i .

  9. Step 5

    the selection operator selects \(X_{i}^{B}\) numbers of individuals from the current generation for progression to the next generation.

All processes will be continued until the stopping condition is met, while the best solution returns.The flowchart of the proposed hybrid algorithm is shown in Fig. 2.

4 Experimental results

The performance of the proposed algorithm is evaluated on 18 benchmark functions from Yao et al. [14] which is demonstrated in Table 1. The benchmark function equations include the continuous unimodal function (functions 1–5), the quartic function (function 7), the discontinuous step function (function 6) and the multimodal function (functions 8–13), and the low-dimensional function (functions 14–18). In evaluating the time and performance of the algorithm, the experiment environments are set in the same way as Jitkongchuen and Thammano [15]. The control parameters in the experiment are presented in Table 2.

Table 1 The benchmark functions
Table 2 The parameters used in the experiments

The first part of the experiment was to evaluate and compare the computational time employed by the proposed algorithm and other comparative algorithms over 10 runs, using tenfold cross-validation method. The computational time including the maximum time (Max), minimum time (Min), average of computational time (Avg. time) and standard deviation (SD) values of the proposed algorithm are presented in Table 3. The table claims that the proposed algorithm spent just only few computational times to obtain the solution in each function. More significantly, the proposed algorithm able to reduce the computational time in ten benchmark functions (function f 1, f 3, f 4, f 5, f 6, f 7, f 8, f 9, f 10, f 11 and f 15) is shown in Table 4 where the average time of DE and Evo-DE algorithms are taken from Jitkongchuen and Thammano [15], and all minimum computational times of each algorithm are shown in bold. Because the expansion of population from the reproduction steps from IWO algorithm, permutation and crossover methods from GA can provide an effective searching area. As a result, the algorithm spent a few computational time to be converged into the best solution.

Table 3 The computational time of the proposed algorithm
Table 4 The computation time of the proposed algorithm in comparison with other algorithms
Fig. 2
figure 2

Flowchart of the proposed hybrid algorithm

The second part of the experiment intends to evaluate the performance of the proposed algorithm in comparison with other algorithms. The results of the comparative algorithms in Table 5 are taken from Brest et al. [16], Zhou et al. [17], and Jitkongchuen and Thammano [15]. In Table 5, the best results of each problem are presented in bold. The computational results in Table 5 show that the algorithm attains the global minimum of zero in function f 1, f 2, f 3, f 4, f 5, f 6, f 9 and f 11. The results are produced in the same value as the Self-adaptive differential evolution algorithm [15], while traditional DE, JDE and IMDE algorithms provide the global minimum of zero for some of these functions. For the functions f 13, and f 15f 18, the proposed algorithm produces the same results with all of the other algorithms. More essentially, the results follow by * in Table 5 indicate that the proposed algorithm performs with better results than all of the other algorithms for the functions of f 7, f 10 and f 12.

Table 5 The experimental results of the proposed algorithm in comparison with other algorithms

From the computational results, there is an indication that the proposed algorithm works efficiently especially for the continuous unimodal function, the quartic function, the multimodal function, and the discontinuous step function.

5 Conclusions

This paper presents a hybrid bat algorithm with natural-inspired algorithms for continuous optimization problem. In order to improve the performance of the bat algorithm, the searching area is expanded by the reproduction step from the IWO algorithm. To increase a larger coverage area of the search space, the mutation, crossover and selection from GA are applied to the population which is produced by the reproduction method of IWO. After that, each individual from the population will be calculated with the new position and velocity. The ‘\(X_{i}^{B}\) best individuals’ from this step will be selected and sent to the next step. All processes will be continued until the stopping condition is met, while the best solution returns. The experimental results claim that the proposed algorithm obtains the optimal and minimal solutions in all eighteen tested functions.