Introduction

Knapsack problem (KP) is one of the most important problems in the combinatorial optimization. It appears in a broad variety of applications, including scheduling problems, portfolio optimization, investment decision-making, project selection, resource distribution, and so on. Unfortunately, KP is non-polynomial (NP) hard, the complete problem [1]. Thus, solving this problem using the gradient methods is inappropriate because this problem may fall in local optima for large-scale problems. Also, these methods are time-consuming, and they achieve one of the closest local optima to initial random solution. Meanwhile, the metaheuristic algorithms have the ability to overcome these drawbacks and proved to be a robust alternative to solve complex optimization problems.

Recently, metaheuristic algorithms are one of the significant stochastic research topics in optimization that imitate natural phenomena. The features of the metaheuristic algorithms are the avoidance of local optima; generate multiple solutions for each run which assist to produce good-quality solutions quickly and no dependence on derivative information [2].

In recent decades, there have been extensive works based on metaheuristic algorithms to solve 0–1 KP. Liu and Liu [3] introduced an evolutionary algorithm based on schema-guiding to solve 0–1 KP. Martello et al. [4] proposed a survey of different approaches to solving 0–1 KP. Shi [5] proposed a modified version of the ant colony optimization (ACO) to solve 0–1 KP. Lin [6] solved the KP in the fuzzy environment through imprecise weight using a genetic algorithm (GA). Li and Li [7] presented a binary particle swarm optimization using a multi-mutation mechanism to solve KP. Zhang et al. [8] introduced amoeboid organism algorithm to solve 0–1 KP. Bhattacharjee and Sarmah [9] proposed a shuffled frog-leaping algorithm to solve 0–1 KP. Kulkarni and Shabir [10] proposed Cohort intelligence algorithm for solving 0–1 KP. In addition, many algorithms have been flourished for solving the 0–1 KP such as genetic algorithm (GA), particle swarm optimization (PSO), artificial fish-swarm algorithm (AFSA), harmony search algorithm (HS), chemical reaction optimization based on greedy strategy (CROG), genetic mutation bat algorithm (GMBA), monarch butterfly optimization and hybrid cuckoo search based on harmony search [11,12,13,14,15,16,17,18,19]. Owing to the importance of the knapsack problem in the academic area and practical applications, developing new algorithms with more promising performance to solve large-scale types of the knapsack problem applications undoubtedly becomes a true challenge.

Bat algorithm (BA) is one of the recent metaheuristic algorithms that are inspired by the echolocation behavior of micro-bats [20]. During flying, bats emit short and ultrasonic pulses to the environment and record their echoes. The recorded information from the echoes helps the bats to build an airtight image of their surroundings and locate precisely the distance, shapes and prey’s position. The ability of such echolocation of micro-bats is charming, as these bats can find their prey and distinguish different types of insects even in complete darkness [20]. The earlier applications showed that BA could solve different optimization problems and proved that its efficiency and robustness compared to different algorithms such as GA and PSO [20,21,22]. A new trend in bat algorithms is focusing on hybridizing BA with different strategies [23,24,25,26,27,28,29,30,31]. Fister et al. [23] developed a hybrid BA based on various evolution strategies for solving optimization tasks, while Baziar et al. [24] proposed a modified BA based on adaptive self-strategy. A hybrid BA based on harmony search for solving optimization problems was proposed by Wang and Guo [25]. Yilmaz and Kucuksille [26] developed an improved BA using some modifications, while Wang et al. [27] presented a modified BA through adjusting the flight speed and the flight direction adaptively. Fister et al. [28] introduced a new version of BA based on self-adaptation of control parameters. Further, binary versions of BA were developed in [29,30,31]. Mirjalili et al. [29] introduced a binary version of BA by employing a V-shaped transfer function to overcome the drawback of the sigmoid transfer function which keeps the positions unchanged during the iterations of the algorithm. In [30], authors developed an integrating version of the binary BA based on Naïve Bayes classifier for feature selection problem. In [31], a binary vision of BA is established based on the sigmoid transfer function for solving different optimization problems. Due to continuous nature of BA, it is still in its infancy for solving combinatorial optimization problems, so this is also the motivation behind this study.

This paper is motivated by several features. First, incorporating the rough set with bat algorithm to solve large-scale 0–1 KP has not been yet studied. Second, many optimization algorithms suffer from entanglement in local optima when solving large-scale problems. Last, solving large-scale knapsack problems have not received adequate attention yet. Hence solving large-scale knapsack problems to optimality undoubtedly becomes a true challenge.

In this paper, we propose a novel binary bat algorithm (NBBA) to solve 0–1 knapsack problems. In contrast to the binary version of BA in [29], the multi-V-shaped transfer function for generating the solutions, the inclusion of the rough set scheme (RSS) as a local search strategy (LSS) and updating the solution through one-to-one strategy are introduced. The proposed algorithm combines two important phases: binary bat algorithm (BBA) and local search scheme (LSS). The bat algorithm enables the bats to enhance exploration capability while LSS aims to boost the exploitation tendency and, therefore, it can prevent the BBA–LSS from the entrapment in the local optima. Moreover, the LSS starts its search from BBA found so far. By this methodology, the BBA–LSS enhances the diversity of bats and improves the convergence performance. The proposed algorithm is tested on different size instances from the literature. Computational experiments show that the BBA–LSS can promise alternative for solving large-scale 0–1 knapsack problems.

The main contributions of this approach are to (1) introduce a novel binary bat algorithm (NBBA) for solving large-scale 0–1 knapsack problems, (2) integrate intelligently the merits of two phases, namely binary bat algorithm (BBA) and rough set scheme (RSS) as a local search scheme, so it can avoid the sucking in the local optima, (3) improve the exploration capabilities of the BBA phase to seek the overall search space while incorporating RSS phase as a counterpart to enhance the exploitation tendencies, (4) implement the injective (one-to-one) strategy for updating mechanism between the two phases such that the fit ones among two phases replace the worst ones based on feasibility rule and (5) to integrate BBA and RSS to improve the quality of solutions and speed up the convergence to the global solution.

On the other hand, the proposed algorithm is effectively applied for small- , medium- and large-size problems. The experimental results demonstrated the superiority of the proposed algorithm in achieving a high quality of solutions. The simulation results affirm that the application of RSS may be an effective scheme to improve the performances of optimization algorithms.

The novelty of the proposed approach is cleared regarding proposing the multi-V-shaped transfer function for generating the solutions in the BBA phase, and then this can provide more explorations in the search space. Further, adopting the RSS as a local search scheme and introducing the injective (One-to-One) strategy can pick the fit solutions quickly and avoid the running of the algorithm without any improvement in the solutions.

The rest of this paper is organized as follows: In Sect. 2, we describe the preliminaries of the 0–1 knapsack problems. In Sect. 3, the basics of both BA and rough set theory (RST) are reviewed. The proposed algorithm is explained in detail in Sect. 4. The numerical experiments are given in Sect. 5 to show the superiority of the proposed algorithm. Section 6 gives the conclusions and the further work.

Preliminaries

Problem description

There are N items and the knapsack capacity is \(C\cdot w_{j}\) is the weight of the jth item, \(p_{j}\) is the profit of the jth item. Then solve which items are let into the knapsack to make the total weight of the items no more than capacity of the knapsack and get the maximum total of the profit.

Mathematical description

The mathematical description of the 0–1 knapsack problem can be formulated as follows:

0–1 KP:

$$\begin{aligned}&\text {Max} {f}(\mathbf{x})=\sum _{j=1}^N p_{j} x_{j}, \nonumber \\&\text {s.t}.:\left\{ \begin{array}{l} \sum \nolimits _{j=1}^N w_{j} x_{j} \le C, \\ x_{j} =\{0,1\}, j=1,2,\ldots ,N \\ p_{j}>0,\ w_{j} \ge 0,\ C>0 \\ \end{array}\right\} \end{aligned}$$
(1)

The binary decision variables \(x_{j}\) are used to determine whether the item j is put in the knapsack or not.

In large-scale instances, the total weights of the items that can be packed in the knapsack may violate the constraint, and this violation is unacceptable and must be handled. The prominent way to handle the constraint is the penalty function method. It imposes the penalty on unfeasible solutions and, therefore, it can evolve the unfeasible solutions until they move to candidate feasible regions. By use of penalty function, the 0–1 KP can be reformulated as follows:

0–1 KP:

$$\begin{aligned}&\text {Max} f(\mathbf{x})=\sum _{j=1}^N p_j x_j -\lambda \left( \max \left\{ 0, \sum _{j=1}^N w_j x_j -C\right\} ^{2}\right) \nonumber \\ \\&\text {s.t.}: \left\{ \begin{array}{l} x_j =\{0,1\},j=1,2,\ldots ,N \\ p_j>0, w_j \ge 0,C>0, \\ \end{array}\right\} \nonumber \end{aligned}$$
(2)

where \(\lambda \) defines the penalty coefficient where it is set to \(10^{10}\) for all test instances.

Overview of bat algorithm (BA) and rough set theory (RST)

This section is devoted to describing the basics of bat algorithm (BA) and rough set theory (RST).

Real behavior algorithm

Bat algorithm was established based on echolocation process of bats. In the echolocation process, pulses will be created by bats which are alive for 8–10 ms at a constant frequency and corresponding wavelength as given in Fig. 1. The features of bats which are exhibited for the development of bat algorithm are as follows: (i) Even without visibility, bats can sense and estimate the distance between food and the obstacles behind them, (ii) the bats are associated with velocity, position, fixed frequency, varying loudness and wavelength when they start flying to find their food and (iii) many strategies are attributed to change in values of loudness from a small constant value to a maximum positive value.

Fig. 1
figure 1

Real behavior of bats

Bat algorithm (BA)

Velocity and position

BA starts with the random initial population of bats in a n-dimensional search space where the position of the bat i denoted by \(x_{i}^{t}\) and its velocity denoted by \(v_{i}^{t}\) at time t. Therefore, the new positions \(x_{i}^{t+1}\) and new velocities \(v_i^{t+1}\) at time step \(t+1\) can be determined by

$$\begin{aligned}&\alpha _i =\alpha _{\min } +(\alpha _{\max } -\alpha _{\min } )\beta \end{aligned}$$
(3)
$$\begin{aligned}&v_{i}^{t+1}=v_{i}^{t}+(x_{i}^{t} -x^{\mathrm{{best}}})\alpha \end{aligned}$$
(4)
$$\begin{aligned}&x_{i}^{t+1}=x_{i}^{t}+v_{i}^{t+1}, \end{aligned}$$
(5)

where \(\beta \) is a random number in [0, 1] and \(x^{\mathrm{{best}}}\) represents the current global optimal solution. \(\alpha _{i}\) represents the pulse frequency emitted by bat iat the current moment, and \(\alpha _{\min }\) and \(\alpha _{\max }\) represent the minimum and maximum values of pulse frequency, respectively. Initially, the pulse frequency is assigned randomly for each bat which is elected uniformly from \([\alpha _{\max }, \alpha _{\min }]\).

In this scenario, a bat is chosen randomly from the bat population, and then the corresponding position of this bat is updated according to Eq. (6). This random walk can be comprehended as a process of local search that generates a new solution by the selected solution.

$$\begin{aligned} x_{\mathrm{{new}}}=x_{\mathrm{{old}}}+\varepsilon A^{t} \end{aligned}$$
(6)

where \({x}_{\mathrm{{old}}}\) represents a random solution chosen from the current best solutions, \(A^{t}\) is the loudness and \(\varepsilon \) is a random vector that is drawn from [−1, 1].

Loudness and pulse emission

It is worth noting that loudness (A(i)) and pulse rate (r(i)) are responsible for balancing the combination between the local and global moves, where the loudness is strong, and pulse emission is small at the beginning of the search process. Once the bat has got its prey, the loudness decreases while pulse emission gradually increases. A(i) And r(i) are updated according to Eqs. (7) and (8):

$$\begin{aligned}&r^{t+1}(i)=r^{0}(i)\times [1-\mathrm{e}^{-\gamma t}]\end{aligned}$$
(7)
$$\begin{aligned}&A^{t+1}(i)=\delta A^{t} (i), \end{aligned}$$
(8)

where both \(\delta \) and \(\gamma \) are constants. \(A(i)=0\) means that the bat has just found its prey and temporarily stopped emitting any sound. For any \(0<\delta <1\) and \(\gamma >0\), we have

$$\begin{aligned} A^{t}(i)\rightarrow 0,\quad r^{t}(i)\rightarrow r^{0}(i),\qquad \mathrm{as}\ t\rightarrow \infty \end{aligned}$$
(9)

The implementation steps of bat algorithm

Step 1: Set the basic parameters: population size (PS), attenuation coefficient of loudness \(\delta \), increasing coefficient of pulse emission \(\gamma \), the maximum loudness \(A^{0}\) and maximum pulse emission \(r^{0}\) and the maximum number of iterations T.

Step 2: Define objective function \(f(x_{i}),i=1,2,\ldots ,\text {PS}\).

Step 3: Initialize pulse frequency \(\alpha _i \in [\alpha _{\min }, \alpha _{\max }]\);

Step 4: Initialize the bat population x and v.

Step 5: Start the main loop. If \(\hbox {rand}<r_i\), generate new solutions by updating process for both velocity and current position by using Eqs. (4) and (5). Otherwise, generate new position of bat by making a random disturbance, and go to step 5.

Step 6: If \(\hbox {rand}<A_i\) and \(f(x_{i})<f(x^{\mathrm{{best}}})\), accept the new solutions and fly to the new position.

Step 7: If \(f(x_{i})<f_{\min }\), replace the best bat and adjust A(i)and r(i)according to Eqs. (7) and (8).

Step 8: Evaluate the bat population, and return the best bat and its position.

Step 9: If the termination condition is met (i.e., satisfy the search accuracy condition or reach a maximum number of iterations), go to step 10; else, go to step 5, and perform the next search.

Step 10: Get the output (i.e., global solution and the best fitness).

where, rand is a uniform distribution in [0, 1].

Rough set theory (RST)

The fundamental concept of the RST is the indiscernibility relation, which is produced by the information of interested objects [32]. Because of discerning knowledge is lacking, one cannot identify some objects based on the available information. The indiscernibility relation relies on the granules of indiscernible objects as a fundamental basis. Some relevant concepts of the RST are as follows [32, 33]:

Definition 1

(Information system) An information system (IS) is denoted as a triplet \(T=(U,A,f)\), where U is a non-empty finite set of objects and A is a non-empty finite set of attributes. An information function f maps an object to its attribute, i.e., \(f_a:U\rightarrow V_a \) for every \(a\in A\), where \(V_a \) is the value set for attribute a. A posteriori knowledge (denoted by d) is denoted by one distinguished attributed. A decision system is an IS with the form \(\text {DT}=(U,A\cup \{d\},f)\), where \(d\notin A\) is used as supervised learning. The elements of A are called conditional attributes.

Definition 2

(Indiscernibility) For an attribute set \(B\subseteq A\), the equivalence relation induced by B is called a B-indiscernibility relation, i.e., \(\mathrm{{IND}}_\mathrm{T} (B)=\{(x,y)\in U^{2} | \forall a\in B, f_a (x)=f_a (y)\}\) The equivalence classes of the B-indiscernibility relation are denoted as \(I_B(x)\).

Definition 3

(Set approximation) Let \(X\subseteq U\) and \(B\subseteq A\) in an IS, the B-lower approximation of X is the set of objects that belongs to X with certainty, i.e., \({\underline{B}}X=\{{x\in U | I_B (x)\subseteq X}\}\). The B-upper approximation is the set of objects that possibly belongs to X, where \(\bar{{B}}X=\{{x\in U | I_B (x)\cap X\ne \phi }\}\).

Definition 4

(Reducts) If \(X_{\mathrm{{DT}}}^1,X_{\mathrm{{DT}}}^2,\ldots ,X_{\mathrm{{DT}}}^r \) are the decision classes of \(\text {DT}\), the set \(\text {POS}_B (d)=\underline{B}X^{1}\cup \underline{B}X^{2}\cup \cdots \cup \underline{B}X^{r}\) is the B-positive region of \(\text {DT}\). A subset \(B\subseteq A\) is a set of relative reducts of \(\text {DT}\) if and only if \(\text {POS}_B (d)=\text {POS}_C (d)\) and \(\text {POS}_{B-\{b\}} (d)\ne \text {POS}_C (d), \forall b\in B\). In the same way \(\text {POS}_B (X)\), \(BN_B (X)\) and \(\text {NEG}_B (X)\) are defined below (refer to Fig. 2).

  • \(\text {POS}_B (X)={\underline{B}}X\Rightarrow \) certainly member of X

  • \(\text {NEG}_B (X)=U-\bar{{B}}X\Rightarrow \) certainly nonmember of X

  • \(BN_B (X)={\bar{B}}X-{\underline{B}}X\Rightarrow \) possibly the member of X.

Fig. 2
figure 2

Definitions regarding rough set approximations

The proposed algorithm (IBBA-RSS)

In this section, we present the injective binary bat algorithm based rough set scheme (IBBA-RSS) to solve the KP. Different from the conventional BA, first, a discrete binary string is adopted to represent a solution; second the updating process of position using Eq. (4) cannot be used to handle the binary space directly; therefore, a new transfer function is introduced to map velocity values to probability values for updating process of the position; third the RSS is adopted to exploit the neighborhood in search process; fourth, after the binary BA procedures, the updating mechanism is implemented based on the injective (one-to-one) strategy, where the fit one replaces the worst one based on feasibility rule. By this methodology, the IBBA-RSS enhances the diversity of bats and improves the convergence performance. The details of the proposed algorithm are given below.

Binary position scheme

In this step, each bat of the population is a solution to the KP, where each bat is represented by the n-bit binary string, where n is the number of decision variables (items) in the KP. For example, considering that \(x_{i}\) represents the bat bits, then its jth bit \(x_{ij} =(x_{i1},x_{i2},\ldots ,x_{in})\) is a binary variable, 0 or 1.

Binary velocity scheme

In bat algorithm, the velocity of the bat is responsible for updating the position. To update the position, the transfer function is introduced to force bat to fly in a binary space. Therefore, the transfer function is responsible for the switching between “0” and “1” values. The traditional transfer function that has been used for binary particle swarm optimization (PSO) is defined as Eq. (10) and Fig. 3 [34].

$$\begin{aligned} \hbox {Sig}(v_i^k (t))=\frac{1}{1+\mathrm{e}^{-v_i^k (t)}}, \end{aligned}$$
(10)

where \(\hbox {Sig}\) denotes the Sigmoid transfer function and \(v_i^k (t)\) denotes the velocity of the bat i in kth dimension at iteration t. After calculating the transfer function values, the new position updating equation is necessary to update particles’ position as follows [34]:

$$\begin{aligned} \mathbf{x}_i^k (t+1)=\left\{ \begin{array}{ll} 0 &{} \quad \hbox {if rand}<S(v_i^k (t+1)) \\ 1 &{} \quad \hbox {if rand}\ge S(v_i^k (t+1)), \end{array}\right. \end{aligned}$$
(11)

where \(x_i^k (t)\) indicates the position and \(v_i^k (t)\) indicates the velocity of ith the bat at iteration t in kth dimension. But the drawback of the sigmoid transfer function is that the particles’ positions remain unchanged when their velocity values increase. To overcome this drawback, a multi V-shaped transfer function (see Fig. 4) is introduced to oblige the bats with high velocity to diverse their positions. A multi V-shaped transfer function and the new position are stated as in Eqs. (12) and (13), respectively.

$$\begin{aligned}&V(v_i^k (t))=\left| {\frac{2}{\pi }\arctan \left( \frac{\pi }{2}v_i^k (t)\right) } \right| ^{Q}\end{aligned}$$
(12)
$$\begin{aligned}&\mathbf{x}_i^k (t+1)=\left\{ \begin{array}{ll} {(\mathbf{x}_i^k (t){)}'} &{}\quad \hbox {if rand}<V(v_i^k (t+1)) \\ {\mathbf{x}_i^k (t)} &{}\quad \hbox {if rand}\ge V(v_i^k (t+1)), \end{array}\right. \end{aligned}$$
(13)

where \(Q=0.1\sim 3\), \(\mathbf{x}_i^k (t)\) is the position and \(v_i^k (t)\) is the velocity of the ith bat at iteration t in kth dimension and \((\mathbf{x}_i^k (t){)}'\) is the complement of \(\mathbf{x}_i^k (t)\).

Fig. 3
figure 3

Sigmoid transfer function [34]

Fig. 4
figure 4

Proposed multi V-shaped transfer function

Evaluation

The distance estimation of the bat is related to objective function (fitness function). In this step, the fitness function is evaluated based on finding the maximum profit as in the Eq. (2). Therefore, the best estimation source with the highest fitness \(\mathbf{x}_{\mathrm{best}}\) is determined as follows:

$$\begin{aligned} \mathbf{x}_{\mathrm{best}}=\arg (\text {Max}\{f(x_i)\}_{i=1}^{\mathrm{{PS}}}) \end{aligned}$$
(14)

Rough set scheme (RSS)

In this step, the RSS is introduced to reduce the redundant bits. In this regard, the obtained population is assumed as an information system consisting of bats’ solutions where each bat is represented by a set of condition attributes and one decision attribute. For the bat \(i,x_{ij}\) the condition attribute illustrates the selected item j, and the decision attribute demonstrates the feasibility of this bat. The term feasibility means that the candidate bat satisfies the knapsack capacity. When the candidate bat is feasible, the decision attribute takes one value; otherwise it takes 0 value. After that, all solutions are formulating as augmented matrix consisting of the condition and decision attributes \([{x_{i1},x_{i2},\ldots ,x_{in}|{\{D\}}}]_{i=1}^{\mathrm{PS}}\), where D denotes decision attribute that takes 1 or 0 value. Therefore, D splits the population into two classes: members that picked value of one in D and members that picked value of zero in D. Let U be the set of objects (solutions) and \(X\subseteq U\) that contains the one values of D and \(B=\{x_1,x_2,\ldots ,x_n\}\) is the set of condition attribute in an IS. Then according to Definition 4, the redundant items are eliminated where \({\underline{B}}X,{\bar{B}}X\) \(BN_B (X)\) and \(\text {NEG}_B (X)\) of X are obtained based on the process of attribute reduction.

Afterward, the population is updated by putting one value for items that belong to the \(\underline{B}X\), picking zero value for items that included in \(\text {NEG}_B (X)\) and picking random value whether 0 or 1 for items that included in \(BN_B (X)\). If we have an empty \(BN_B (X)\) or zero values for D, then mutation strategy can be implemented by generated N neighbors around each solution as follows: for each string generated N-solutions randomly, K bits are selected randomly from \(\mathbf{x}_i \) of bat i; then the selected K bits are inverted. Figure 5 illustrates an example for this step with \(N=3\) and \(B=2,\) and the colored bits denote the selected ones.

Fig. 5
figure 5

An illustration of mutation process

Fig. 6
figure 6

Flowchart of the proposed IBBA-RSS approach

Table 1 The parameters, dimension and optimum of ten test instances
Table 2 Comparisons of the small sizes KP
Table 3 The parameters, dimension and optimum of ten test problems
Table 4 Comparison results for the medium sizes KP (KP\(_{11}\)–KP\(_{20})\)
Table 5 Comparisons of the large-size KP

Injective updating based on feasibility rule

Now the feasibility rule must be carried out to obtain a new population. In this step, the population is updated based on injective scheme (one-to-one), where the solution after implementing the rough set scheme is compared with corresponding one obtained by the bat procedures. The winner solution is selected for updated process based on the feasibility rule that was introduced by Deb [35]. These rules are defined as follows:

  1. 1.

    Through comparing two feasible solutions, the chosen is the one that has a better objective.

  2. 2.

    Through comparing a feasible and an infeasible solution, the chosen is the feasible one.

  3. 3.

    Through comparing two infeasible solutions, the chosen is the one with the lower sum of constraint violation.

The sum of constraint violation for a solution given by

$$\begin{aligned} \text {CV}(x)=\max \left( \sum _{j=1}^N w_j x_j -C,0\right) \end{aligned}$$
(15)

The flowchart of the proposed IBBA-RSS algorithm is shown in Fig. 6, where the changes are highlighted.

Experimental results and analysis

In this section, the performance of the IBBA-RSS algorithm is extensively investigated by a large number of experimental studies. Ten low-dimensional, ten medium size and twelve large-scale instances are considered to validate the robustness of the proposed IBBA-RSS algorithm. The algorithm is coded in MATLAB 7, running on a computer with an Intel Core I 5 (1.8 GHz) processor and 4 GB RAM memory and Windows XP operating system.

Low-dimensional 0–1 knapsack problems

In this section, the performance of proposed algorithm is investigated to solve ten low-dimensional 0–1 knapsack problems, where these instances are taken from [36, 37]. The required information about test instances such as dimension and parameters is listed in Table 1. The maximum number of iterations is set to 400 iterations for each instance with 30 bats for the population size, where each instance is tested with 30 independent algorithm runs. To completely evaluate the IBBA-RSS performance statistical measures such as success rate (SR) among all runs in reaching the appointed Optima, “Best”, “Median”, “Worst”, “Mean” and standard division (Std.) are calculated.

On the other hand, the performance of the proposed IBBA-RSS algorithm is compared with six different algorithms that are reported in [37]: NGHS1 [36], SBHS [37], BHS [38], DBHS [39], ABHS [40] and ABHS1 [41]. Table 2 shows the comparisons between the proposed algorithm and six algorithms, where best results are highlighted in bold. The obtained results showed that the proposed algorithm could achieve the optima for the low-dimensional knapsack problems, where the proposed IBBA-RSS algorithm is competitive with SBHS, ABHS and DBHS and outperforms BHS, NGHS1 and ABHS1.

Medium size 0–1 knapsack problems

This section is devoted to investigate the performance of the proposed algorithm to solve medium size 0–1 knapsack problems. Ten instances are taken from [42], where sizes of these instances include 30, 35, 40, 45, 50, 55, 60, 65, 70 and 75 items. The information about these instances such as dimension, parameters and optimum solution are listed in Table 3. Extensive experimental tests were carried out to adjust the maximum numbers of iterations. Based upon these tests, the maximum numbers of iterations are accordingly set to 400 iterations for KP\(_{10}\)–KP\(_{15}\) and 500 iterations for KP\(_{16}\)–KP\(_{20}\). The proposed IBBA-RSS is run 30 times for each instance with 30 bats for the population size.

To demonstrate the effectiveness and robustness of the proposed IBBA-RSS, it is implemented and compared with the BBA phase. The statistical measures for the each instance is obtained using BBA and IBBA-RSS and reported in Table 4 where best results are highlighted in bold. The statistical measures such as the best, median, worst, mean values and standard deviations are determined.

The proposed IBBA-RSS is compared with BBA, Cohort Intelligence (CI) and Branch and Bound method (B&B) as in Table 4. From these Tables, we can see that the proposed IBBA-RSS is statistically superior to other algorithms for the most KP instances and similar for the some KP instances. It can be perceived from Table 4 that the proposed IBBA-RSS is competent to obtain very competitive solutions with other algorithms. For KP15, KP16, KP18, KP19 and KP20 the solutions of the proposed IBBA-RSS demonstrate that it is capable of outperforming the BBA phase. The solutions of the proposed IBBA-RSS are also superior to the results of the other evaluated techniques in the most of the test cases.

Further, the convergence behavior for each instance is depicted in Fig. 7, where the KP11 is depicted in Fig. 7a, the KP12 is depicted in Fig. 7b and so on. As shown in theses graphs the proposed IBBA-RSS gives better results than BBA, and consequently, the profit for each instance is improved.

Large-scale 0–1 knapsack problems

To further prove the proficiency of the proposed IBBA-RSS algorithm, twelve large-scale 0–1 knapsack instances were utilized. The sizes of these instances include 100, 200, 300, 500, 700, 1000, 1200, 1500, 1800, 2000, 2600 and 3000 items. Each large-scale KP (KP\(_{11}\)–KP\(_{22})\) is generated as follows: the volume of each item is randomly chosen from 0.5 and 2 and its corresponding profit is randomly set between 0.5 and 1. The maximal volume capacity of the knapsack is limited to 0.75 times of the sum volumes of the items generated following the above procedure. It is worth noting that these instances are created only once using a random generator and kept constant for all the experiments. Extensive experimental tests were carried out to adjust the maximum numbers of iterations. Based upon these tests, the maximum numbers of iterations are accordingly set to 300, 600, 600, 1000, 1800, 1800, 2500, 10,000, 10,000, 16,000, 18,000 and 18,000 respectively. The proposed IBBA-RSS is run 30 times for each instance with 30 bats for the population size.

The proposed IBBA-RSS and BBA phase are compared with the V-shaped binary bat algorithm (V-BBA) which was developed in [29]. The statistical measures for each instance using the proposed IBBA-RSS and other comparative algorithms are presented in Tables 5 and 6 while best results are highlighted in bold. The statistical measures such as the best, median, worst, mean values and standard deviations are determined where the success rate (SR) results are not reported because the optimal profits of KP\(_{21}\)–KP\(_{32}\) are unknown.

The proposed IBBA-RSS is compared with 16 different algorithms as in Tables 5 and 6. From these tables, we can see that the proposed IBBA-RSS outperforms the other algorithms for all KP instances (KP\(_{21}\)–KP\(_{32}\)). Also, the proposed algorithm saves the commotional time, where it is consumed a small number of iterations compared with the other algorithms [37].

Further, the convergence behavior for each instance is depicted in Fig. 8, where the KP21 is depicted in Fig. 8a, the KP22 is depicted in Fig. 8b and so on. As shown from these graphs, the proposed IBBA-RSS achieves better simulation results than the BBA phase and V-BBA. Consequently, the profit for each instance has improved significantly. The improved ratio for each instance is equivalent to 1.4313, 1.0708, 1.2748, 1.1861, 0.4242, 0.6764, 0.3515, 0.3498, 0.3656, 0.3742, 0.4306 and 1.9425%, respectively, when comparing IBBA-RSS with BBA phase, while the improved ratio obtained by comparing IBBA-RSS with V-BBA is equivalent to 5.4714, 6.6404, 2.4526, 2.6791, 1.7067, 1.7673, 2.2394, 0.9915, 0.5675, 1.6160, 1.4548 and 3.2288%, respectively. Further, comparing BBA with V-BBA achieves the following improved ratio as follows: 4.0988, 5.6298, 1.1929, 1.5108, 1.2879, 1.0983, 1.8945, 0.6439, 0.2027, 1.2467, 1.0287 and 1.3117%, respectively. Although these ratios seem small for some instances, it is very significant from the practical point of view for large-scale problems. Based on the above-improved ratios, it can be concluded that proposed IBBA-RSS algorithm has better ratios. Therefore, the proposed IBBA-RSS is robust approach and has powerful searching quality.

Regarding overall results on Tables 2, 4, 5 and 6, amongst the evaluated optimizers, IBBA-RSS could achieve the best performance. The main reason for the superior performance of the proposed IBBA-RSS lies behind the multi-V-shaped transfer function. The multi-V-shaped transfer function helps the proposed algorithm to preserve the diversity of the solutions and thus refine the convergence rate of the proposed algorithm. Also incorporating of RSS-based approximations can efficiently redistribute the search bats to enhance their diversity and to the emphasis on more explorative steps in case of convergence to the local optimum. The new transfer function and RSS strategies have improved the searching capacities and quality of the solutions of the proposed algorithm. Therefore, these strategies can assist the proposed algorithm to switch between exploration and exploitation behaviors more effectively.

Fig. 7
figure 7

The Convergence behavior for medium KP (KP\(_{11}\)–KP\(_{20})\)

Table 6 Comparisons for the large sizes KP (continued)

Performance assessment

Regarding the assessment, the performance of the proposed algorithm is investigated through using the Wilcoxon signed ranks (WSRs) test for a better comparison [43]. WSRs test is a nonparametric test that utilized in a hypothesis testing situation involving a design with two samples [42]. It is a pair-wise test that aims to find out significant differences between the behaviors of two algorithms. WSRs test is working as follows: First, the difference between the scores of the two algorithms on ith of n problems and the differences are ranked according to their absolute values. Second \(R^{+}\) and \(R^{-}\) are determined, where \(R^{+}\) is the sum of positive ranks, while \(R^{-}\) is the sum of negative ranks; then the minimum of \(R^{+}\) and \(R^{-}\) is obtained. If the result of the test is returned in \(p<0.05\) (i.e. p-value is the probability of the null hypothesis being true) indicates a rejection of the null hypothesis, while \(p>0.05\) indicates a failure to reject the null hypothesis.

Therefore, we apply the WSRs test for the proposed IBBA-RSS algorithm against the different algorithms that appear in Table 2 and the obtained results for WSRs test is reported in Table 7. Also, the WSRs test is employed for the results of the medium size KP instances that depicted in Table 4, where obtained results for WSRs test for the medium size instances are reported in Table 8. Also the WSRs test is employed for the results of the large-scale KP instances that depicted in Tables 5 and 6, where obtained results for WSRs test for the large-scale instances are reported in Table 9. From Tables 7, 8 and 9, it can be concluded that the proposed IBBA-RSS has superior characteristics both in the high quality of the solution and robustness of the results. Also, it can keep a significant balance between the global exploration and the local exploitation.

Most of the p values reported in Tables 7, 8 and 9 are less than 0.05 (5% significance level) which is a robust evidence against the null hypothesis, concluding that the obtained results by the proposed approach are statistically better and they have not happened by chance.

Convergence analysis

To analyze the convergence analysis of the proposed algorithm, statistical measures, Wilcoxon signed ranks (WSRs) test and improvement ratio were developed. Tables 2, 4, 5 and 6 demonstrated the superiority of the proposed approach regarding optimality. Further, the nonparametric WSRs is employed to offer the winner algorithm, where Tables 7, 8 and 9 show that the proposed algorithm outperforms the other comparative algorithms regarding the obtained p value. Also, the improvement ratio for the large-scale test instances is recorded as 1.4313, 1.0708, 1.2748, 1.1861, 0.4242, 0.6764, 0.3515, 0.3498, 0.3656, 0.3742, 0.4306 and 1.9425%, respectively, when comparing IBBA-RSS with BBA phase, while the improved ratio obtained by comparing IBBA-RSS with V-BBA is equivalent to 5.4714, 6.6404, 2.4526, 2.6791, 1.7067, 1.7673, 2.2394, 0.9915, 0.5675, 1.6160, 1.4548 and 3.2288%, respectively. Further, comparing BBA phase with V-BBA achieves the following improved ratio: 4.0988, 5.6298, 1.1929, 1.5108, 1.2879, 1.0983, 1.8945, 0.6439, 0.2027, 1.2467, 1.0287 and 1.3117%, respectively. Based on the above-improved ratios, it can be concluded that proposed IBBA-RSS algorithm has better ratios. From the practical point of view for large-scale problems, these ratios are very significant. Despite the high dimensionality of the KP problems, it is noteworthy that the proposed algorithm is competent to provide very significant results in a small number of iterations compared to the other algorithms. Regarding presented analyses, it can be concluded that the inherent characteristic of this improvement is contained in incorporating the RSS as a local search strategy that accelerates the convergence behavior and avoids the systematic running of the algorithm without any improvements in the outcomes. It can be concluded that the proposed IBBA-RSS has a significant performance and that the immature convergence inaccuracies of BBA phase are mitigated, efficiently.

In this subsection, a comparative study has been carried out to evaluate the performance of the proposed IBBA-RSS algorithm concerning the binarization strategy and hybridization. In this respect, a new strategy is introduced based on the multi-V-shaped transfer function that has effective exploration than the sigmoid transfer function. On the one hand, hybridization mechanism is implemented through incorporating the RSS as a local search step can avoid the trapping on undesirable values. Also, this hybridization can accelerate the convergence and also preserve its searching efficiency and effectiveness. On the other hand, the proposed algorithm is highly competitive when comparing it with the other methods regarding calculating the statistical measures and Wilcoxon signed ranks test. So the use of the hybrid approach has a great potential for solving large-scale knapsack problems. Moreover, it can be recognized from the obtained results on 32 test instances that the proposed IBBA-RSS is capable of attaining satisfactory solutions with an appropriate exploitation potential. The reason is that the proposed RSS-embedded mechanisms can stimulate the exploitation tendency of the BBA phase, effectively.

Fig. 8
figure 8

The Convergence behavior for large scale KP (KP\(_{21}\)–KP\(_{32})\)

Table 7 Wilcoxon test for comparison results in Table 2
Table 8 Wilcoxon test for comparison results in Table 4
Table 9 Wilcoxon test for comparison results in Tables 5 and 6

Careful observation will reveal the following achievements of the proposed IBBA-RSS algorithm:

  1. (a)

    IBBA-RSS performs better on all large-scale KP problems while the other algorithms often miss the better results.

  2. (b)

    IBBA-RSS can obtain a relatively stable and better result on the whole regarding the statistical measures.

  3. (c)

    IBBA-RSS combines the merits of the BBA and RSS to obtain an elevated performance.

  4. (d)

    IBBA-RSS gives a promising improvement in the problem profit and can avoid the trapping in local optima.

  5. (e)

    The proposed methodology opens up numerous research directions for solving the different variants of KP problems such as multi-dimensional KP and quadratic KP.

Conclusions and future work

This paper presented a novel injective binary bat algorithm-based rough set scheme (IBBA-RSS) for solving 0/1 knapsack problems. To overcome the BBA’s problem of being converged to local optima and to improve its exploration and exploitation tendencies, it is hybridized with the RSS phase. Furthermore, the survival process of bats is achieved based on the injective (one-to-one) strategy, where the fit one replaces the worst one based on feasibility rule. The performance of the proposed algorithm has been extensively investigated through using small-scale, medium- scale and large-scale instances of 0–1 KP. The proposed algorithm is compared with several algorithms from the literature. Based on statistical measures, the proposed algorithm can explore/exploit better-quality solutions, and it outperforms as the best amongst the other compared algorithms. Convergence trend for average best results for IBBA-RSS is preferable to equivalent curves for BBA. Also, non-parametric statistical tests also affirm that the optimality of solutions is enriched, significantly. The results reveal that IBBA-RSS is competent to provide very competitive results compared to BBA and other investigated algorithms. Regarding presented analyses, it can be concluded that IBBA-RSS has a desirable performance and the immature convergence inaccuracies of the BBA phase is mitigated, efficiently.

For future works, it is possible to investigate the proposed IBBA-RSS algorithm to solve different forms of KP problems like multi-dimensional KP and quadratic KP. Further research on using other metaheuristic algorithms such as krill herd, monarch butterfly optimization (MBO), earthworm optimization algorithm (EWA), elephant herding optimization (EHO) and moth search (MS) algorithm need to be developed to solve different forms of KP problems. Finally, I hope to design a new version of KP that is bi-level KP.