Dichotomous Binary Differential Evolution for Knapsack Problems

Differential evolution (DE) is one of the most popular and powerful evolutionary algorithms for the real-parameter global continuous optimization problems. However, how to adapt into combinatorial optimization problems without sacrificing the original evolution mechanism of DE is harder work to the researchers to design an efficient binary differential evolution (BDE). To tackle this problem, this paper presents a novel BDE based on dichotomous mechanism for knapsack problems, called DBDE, in which two new proposed methods (i.e., dichotomous mutation and dichotomous crossover) are employed. DBDE almost has any difference with original DE and no additional module or computation has been introduced. The experimental studies have been conducted on a suite of 0-1 knapsack problems and multidimensional knapsack problems. Experimental results have verified the quality and effectiveness of DBDE. Comparison with three state-of-the-art BDE variants and other two state-of-the-art binary particle swarm optimization (PSO) algorithms has proved that DBDE is a new competitive algorithm.


Introduction
The knapsack problems, as one of the classical NP-hard combinational optimization problem, have a lot of immediate applications in project selection, resource distribution, investment decision-making, financial management, and so on.The 0-1 knapsack problem and multidimensional knapsack problem are the most common and important in the family of knapsack problems and have been extensively studied [1].In recent decades, evolutionary algorithms, such as genetic algorithms (GA) [2][3][4], particle swarm optimization (PSO) [5,6], and differential evolution (DE) [7,8], have been well-adopted for solving the knapsack problems.Although many knapsack problems have been tackled by these approaches, some new and more difficult knapsack problems (such as high dimension knapsack problems) hidden in the real world have not been properly solved [9,10].So the research on them is still important and necessary.DE, proposed by Storn and Price [11], has drawn the attention of many researchers all over the world.As one of the most popular and powerful optimization techniques, DE has many advantages, for example, fast, simple, easy to use, and efficient for the real-parameter global continuous optimization problems.Initially, DE was designed as an optimization technique for used in real-number spaces.As the emergence of DE, many researchers around the world study from different aspects and proposed a lot of improved DE variants [12][13][14][15][16][17].However, many combinational optimization problems are set in a space featuring binary and the classical DE is not suitable for it.Therefore, a number of binary versions of DE (BDE) have been proposed.Some work is mainly dedicated to design a mapping from continuousspace to binary space.For example, in the early days of BDE research, Pampara et al. [18] proposed an angle modulated DE (AMDE), in which a trigonometric function was employed as a bit string generator.Thus AMDE can operate in binary spaces without deviating from the basic search mechanism of the classical DE.Hota and Pat [7] proposed an adaptive quantum-inspired DE (AQDE), in which mutation operator is similar to that of classical DE and operates directly on the Q-bit () where  is defined in [0, 2].Besides the abovementioned methods, many attempts as well focused on operating on binary space directly.For example, He and Han [19] first use logical operators to replace the original operations of the mutation mechanism in DE, and thus the individual can be evolved directly using binary string.Gong and Tuson [20] proposed binary-adapted DE operators based on forma analysis to directly manipulate bit strings.Additionally, some BDE variants with new binary mutation operators, such as MBDE [21], NMBDE [8], and BLDE [22], are proposed one after another.However, we have noted that it is a challenging task to design an efficient BDE.If the BDE still evolves in the real-number spaces, the expensive computational cost of transforming the real-coded individuals into binary strings is a hard problem.Moreover, if the BDE evolves in the binary spaces directly, the weak exploration ability of directly operating bit-stings has definitely hindered the BDE to solve the difficult and high-dimensional knapsack problems.
In psychology, dichotomous thinking, also known as "black or white thinking," is a tendency to only see extremes.Based on dichotomous thinking, the result of executing XOR operation on any two binary strings can be divided into two types, that is, common and difference, and the mutation and crossover operations of BDE can also be divided into two types.If the result is common then we can perform one operation, else if it is difference then we can perform another heterogeneous operation.Motivated by these observations, we proposed a novel dichotomous binary differential evolution (DBDE), in which dichotomous mechanism is fused into the mutation and crossover operations.As the main contribution in DBDE, dichotomous mechanism is learning from the dichotomous thinking of psychology.The primary idea of dichotomous mechanism is that each of the two features (i.e., 0 and 1) after the XOR operation corresponds to two different strategies, the result increases the diversity of population and enhances the exploration ability in the binary search space.Comprehensive experiments have been conducted on a suite of 0-1 knapsack problems and multidimensional knapsack problems to verify the effectiveness and efficiency of the proposed approach.
The rest of the paper is organized as follows.In Section 2, the 0-1 knapsack problems and multidimensional knapsack problems are introduced.Section 3 gives a brief review of the DE algorithm.Our proposed DE variant, called DBDE, is described in Section 4. The analysis of solution quality of DBDE is presented in Section 5. Experimental results and discussions are presented in Section 6.Finally, the work is concluded in Section 7.

Knapsack Problems
The knapsack problem is one of typical NP-hard combinatorial optimization problems in operation research, which includes a variety of knapsack problems such as the 0-1 knapsack problems and multidimensional knapsack problems.
2.1.The 0-1 Knapsack Problems.Generally, in an instance of the 0-1 knapsack problem, given a set of  items, each item  having an integer profit   and an integer weight   , the task is to maximise the sum of profits of items packed in the knapsack without exceeding a given capacity .
Mathematically, the 0-1 knapsack problem can be formulated as follows: where   = 1 or 0 is used to indicate whether item  is included in the knapsack or not.It may be assumed that all profits and weights are positive, and that all weights are smaller than the capacity  but the total weight of all items exceeds .

The 0-1 Multidimensional Knapsack
Problems.The 0-1 multidimensional knapsack problem is similar to 0-1 knapsack problem, but where a set of knapsack constraints are satisfied rather than one.Therefore, it is more complex and more difficult to be solved.A comprehensive overview of practical and theoretical results for the 0-1 multidimensional knapsack problem can be found in [10].The 0-1 multidimensional knapsack problem can be formulated as follows: where  is the number of knapsack constraints with maximum capacities.

DE Algorithm
Since the emergence of DE algorithm, much effort has been made to improve the performance and these works can be classified into three categories.The first is hybridization with other techniques [23][24][25], the second is modification of the mutation strategy [26][27][28], and the third is adaptation of mutation strategy and parameter settings (i.e., NP, , and CR) [29][30][31].Additionally, some comparative study has shown that the performance of DE and its variants is better than the PSO variants over a wide variety of problems [16,32].As a very competitive form of evolutionary algorithm, DE has been successfully applied to diverse fields such as electrical power systems [33,34], bioinformatics [35,36], pattern and recognition, and image processing [37,38].Recently, Das et al. [16,17] presented a comprehensive survey on the state-ofthe-art of DE variants, so more information can be referred to it.
DE is a population-based heuristic search algorithm which maintains a population with NP floating-point encoded individuals  1, ,  2, , . . .,  NP, , where NP is the population size,  is the generation number, and each member represents a candidate solution, randomly sampled from the search space.It starts with an initial population  1,0 ,  2,0 , . . .,  NP,0 and then conducts mutation, crossover, and selection operators to improve its population generation by generation until the preset stopping criterion, that is, target error accuracy level () or maximum number of function evaluates (MaxFEs), is satisfied.
At each generation , DE executes mutation operation firstly.The mutant vector  , for each individual  , (or, namely, target vector) will be created by the mutation strategy.The well-known and widely used DE mutation strategies "DE/rand/1" are shown as follows: where  = 1, 2, . . ., NP, 1, 2, and 3 are different indices randomly chosen from the set {1, 2, . . ., NP} and all are different from .The control parameter  is a scale factor that amplifies the vector difference.
Then, DE commonly conducts binomial crossover operator to recombine the target vector  , and mutant vector  , .The trial vector  , is generated as follows: where  = 1, 2, . . ., ,  rand ∈ {1, 2, . . ., } is a randomly selected integer, rand  ∈ [0, 1] is a uniformly distributed random number for the th dimension, and the control parameter CR ∈ [0, 1] is the crossover probability.Finally, the selection operator is used to choose the better one among the target vector  , and the trial vector  , in terms of their fitness value to enter the next generation: To alleviate the classical DE cannot be directly applied to binary-valued optimization problem, many versions of BDE were put forward around the world; especially logical operations were first introduced by He and Han [19] to replace the original operations of the mutation mechanism in DE and the binary mutation equation as follows: where ⊗ denotes the AND operator, ⊙ denotes the OR operator, and ⊕ denotes the XOR operator.

Dichotomous Binary Differential Evolution
Dichotomous binary differential evolution (DBDE) as proposed in this paper is based on both binary string representation and the dichotomous mechanism.The details are as follows.
4.1.Dichotomous Mutation.The idea of using logical operations to replace the original operations of the mutation, such as subtraction, multiplication, and addition, was first introduced by He and Han [19].This approach can evolve the bit string individual directly.However, by using the binary strings, there are only two different codes "0" and "1" in the population; the differential of two individuals on the same location is too negligible to operate the complicated mutation like the real coding individuals.The novel binary mutation mechanism developed in this paper is based on XOR logical operation mainly.As we all know, the bit coded as "0" after the XOR operation represents the common between the two selected bits; otherwise the "1" represents difference.
According to the common and difference feature patterns of two randomly selected individuals, dichotomous mutation executes difference operations and the new mutation equation is as follows: where !denotes the NOT operator.In dichotomous mutation, the scale factor  disappeared and we no longer have to worry about its value.If the bits between  1,, and  2,, are difference, then the mutation value is randomly chosen from "0" or "1"; otherwise, if the bits between  1,, and  2,, are common, then the mutation value is determined by the value of  1,, .As a simple example, as depicted in Figure 1, two individuals  1, and  2, are randomly selected at generation  for th individual  , to execute the dichotomous mutation.Then a binary string ( 1, ⊕  2, ) is produced after the XOR operation of  1, and  2, .On this basis, the mutation binary string  , is obtained by the dichotomous mutation mechanism.In Figure 1,  , composes rand,  1,1, , rand, and  1,, on the 1st, 2nd, 3rd, and th location, respectively, in which "rand" represents that the value is randomly chosen from "0" or "1" with equal probability.

Dichotomous Crossover.
The new binary crossover operator, that is, dichotomous crossover, is used to produce the trial individual  , by mixing the target individual  , and mutant individual  , .The trial individual  , can be obtained according to the following equation: where  = 1, 2, . . ., .The mechanism of dichotomous crossover is similar to the crossover of the original DE, but there exists a main difference between them.That is, dichotomous crossover uses two crossover probabilities, that is, CR1 and CR2, rather than only one CR in classical DE.For th bit of the trial individual, if the bits between  1,, and Input: Infeasible individual ; Weights   of each item ; Capacity  of a knapsack (1) while  is infeasible do (2)  = ratio-greedily select an item from the knapsack; (3) Return ; (6) end if (7) end while Output: Feasible individual  Algorithm 1: Ratio-greedy repair. 2,, are common, then CR  is equal to CR1; otherwise, if the bits between  1,, and  2,, are difference, then CR  is equal to CR2.As demonstrated in Figure 2, the elements of trial individual  , come from mutate individual V , and target individual  , with difference crossover probabilities.From Figure 2, we can find that the decisions of the crossover operation for the 1st, 2nd, 3rd, and th bit of  , are based on CR1, CR2, CR1, and CR2, respectively.

DBDE for Knapsack Problems.
Handling the constraint in the knapsack problems and considering some empirical results indicate that repair method is the most efficient for the knapsack problems [3,4].Thus, only repair method with ratio-greedy manner is used in this paper to tackle the knapsack problem.The steps of the ratio-greedy repair are described in Algorithm 1, in which if the solution  is infeasible, we sort the items according to the descending order of the corresponding profit-to-weight ratios firstly and then choose an item with the smallest ratio and remove it from the knapsack, and the program will loop continuously until a feasible one is generated.The framework of DBDE for knapsack problem is described in Algorithm 2. Compared to the original DE, there is merely two major differences in the DBDE.One is the using of ratio-greedy repair for the infeasible solution after the new individual generated.Another is that the new dichotomous mutation and dichotomous crossover replace the old one.

Analysis of Solution Quality of DBDE
In this section, we analyze the solution quality of DBDE on the 0-1 knapsack problem in terms of the approximation ratio [39,41].In DBDE, the dichotomous mutation, dichotomous crossover, and selection are performed one by one at each generation to guide the population to the global optimum.From the demonstration of truth table in Table 1, we can observe that the probabilities of bit "1" and bit "0" generated by dichotomous mutation are equal to 0.5.Meanwhile, based on dichotomous crossover probabilities CR1 and CR2 the mutant bit will be accepted as a trial bit in the trial vector and the probabilities of using CR1 and CR2 are equal to 0.5.Thus, dichotomous mutation and crossover flip bit from "0" to "1" with a probability 0.5 * 0.5 * (CR1 + CR2) and the same as from "1" to "0".For the purposes of simplification, let  = 0.5 * 0.5 * (CR1 + CR2).Theorem 1.For any constant  ∈ (0, 1), the DBDE needs Ω( − ) running time to find -approximation solution in the worst case.
Input: Population size, NP; Crossover probability, CR1 and CR2; Maximum number of objective function evaluations, MaxFEs (1) Randomly initialize population  0 with NP individuals (2) for  = 1 : NP do (3) if  ,0 is an infeasible individual then (4) Execute Algorithm 1 for ratio-greedy repair (5) end if (6) Evaluate the objective function value ( ,0 ) (7) end for (8) FEs = NP (9) while FEs < MaxFEs do (10) for  = 1 : NP do (11) Randomly select two individuals  1, and  2, from population   (12) Execute the dichotomous mutation to generate a mutate individual  , (13) Execute the dichotomous crossover to generate a trial individual  , (14) if  , is an infeasible individual then (15) Execute Algorithm 1 for ratio-greedy repair (16) end if (17) Evaluate the objective function value ( , ) (18) if ( , ) > ( , ) then (19)  , =  , (20) end if (21)  Proof.According to the definition of an evolutionary approximation algorithm (see [41] for a detailed exposition), it suffices to consider the instance of the 0-1 knapsack problem, which is described in Table 2.In Table 2,  is a large positive integer for a sufficiently large .As seen, the global optimum for the instance is (10 ⋅ ⋅ ⋅ 0), (10 ⋅ ⋅ ⋅ 0) =  and the global optimum is unique.A local optimum is Notice that the local optimum is the second largest objective function value among feasible solution.The ratio of fitness between the local optimum and the global optimum is Suppose that the DBDE starts at the local optimum (01 ⋅ ⋅ ⋅ 10 ⋅ ⋅ ⋅ 0).For the individual   , the dichotomous mutation and crossover operators are conducted and a trial vector  , is generated.At the same time, the greedy selection operator with the ratio-greedy repair will prevent  , from entering into the next generation unless the trial vector is the global optimum itself.Thus, the event happens only if the first bit of   is flipped from  1 = 0 to  1 = 1 and −1 one-valued bits are flipped into zero-valued ones while other zero-valued bits remain unchanged.The probability of this event is From the above analysis, we now deduce that the expected runtime to reach the global

Experimental Study
6.1.Experimental Setting.Two types of knapsack problems, that is, 0-1 knapsack and multidimensional knapsack problems, are used in the following experimental studies to extensively investigate the performance of the proposed DBDE algorithm.Meanwhile, DBDE compares with five other stateof-the-art binary evolutionary algorithms, including three binary DE variants, that is, BLDE [22], BinDE [20], and AQDE [7], and two binary PSO variants, that is, BPSO [40] and MBPSO [6].For all the contestant algorithms, the control parameter settings are the same as their original literature, but the MaxFEs is set to 100 *  and NP = 100 for fairness consideration.The parameters are used in DBDE, that is, CR1 = 0.2 and CR2 = 0.5.The details of the control parameters of these contestant algorithms are summarized in Table 3.
All the experiments are done on a computer with 2.8 GHz Dual-core Processor and 4 GB RAM under Windows 7 platform and all algorithms are implemented in Matlab 2010b.Thirty independent runs are carried out for each algorithm on each instance.The best results are shown in boldface.
In order to have statistically sound conclusions, Wilcoxon's rank sum test at a 0.05 significance level is conducted on the experimental results.

0-1 Knapsack Problem.
A suite of twenty randomly generated 0-1 knapsack problems is used to verify the efficacy of DBDE.An algorithm for generating the instances is available from http://www.diku.dk/∼pisinger/generator.c.The detailed descriptions of these instances are summarized in Table 4.The optimum solutions of these instances are not known.These instances can be divided into four groups, including uncorrelated, weakly correlated, strongly correlated, and subset-sum data instances.In all instances, the weights   are randomly distributed in [1, 𝑅].The profits   are expressed as a function of the weights   , yielding the specific properties of each group and as follows: (1) uncorrelated data instancesthe profits   are randomly chosen in [1, 𝑅], there is no correlation between the profit and the weight of an item; (2) weakly correlated data instances-  randomly distributed in [  − /10,   + /10] such that   ≥ 1.Despite their name, weakly correlated instances have a very high correlation between the profit and weight of an item.Typically, the profit differs from the weight by only a few percent; (3) strongly correlated data instances-profits are set to   =   + 10; and (4) subset-sum data instances-the profit of each item is equal to the weight, that is,   =   .The number of items  is set to 100, 200, 300, 500, and 1000, respectively, to test the algorithms with different problem scales.Moreover, the used 0-1 knapsack instances in this paper are available at https://github.com/whuph/KPdata, so that readers are able to test these instances in their algorithms.Table 5 presents the mean maximum profit achieved by DBDE and other five competitive algorithms over 30 runs on each 0-1 knapsack instance.At the bottom of the table, Wilcoxon's rank sum test results between DBDE and others are summarized as "//", which means that DBDE wins in  functions, ties in  functions, and loses in  functions.Based on the results, our algorithm achieves better results than others on the majority of test instances.However, on   the subset-sum data instances all of the competitors get the same results.Because subset-sum instances are generally easy to solve, the maximum sum of weight indicates the optimal solution.A statistical view in terms of Wilcoxon's rank sum test in the last line of Table 5 is more appropriate to see the superiority of DBDE over other five competitors.We observe from that DBDE is significantly better than BPSO, MBPSO, BLDE, BinDE, and AQDE on 7, 13, 15, 15, and 12 test instances, respectively, but only worse than BPSO and AQDE on 2 and 1 test instances, respectively.Figure 3 shows the convergence curves of the six contestant algorithms on nine representative 0-1 knapsack instances.
Apart from the above analysis, one may come up with a question: what are the differences of computational cost between DBDE and other competitive algorithms on 0-1 knapsack problems?In order to respond to this, beside the maximum profit results, the runtime was also recorded to compare the computational cost of six algorithms on the test suite.Each algorithm is run 30 times per test instance and the mean runtime is recorded.Table 6 presents the statistical results of runtime.At the bottom of the table, the total runtime on all test instances is summarized.
From Table 6, we can see that the runtime of DBDE is higher than BinDE, but this difference is slight.In addition to this, DBDE is significant faster than BPSO, MBPSO, BLDE, and AQDE.The possible reasons are as follows.First, as pointed out in Algorithm 2, the DBDE almost have any difference with classical DE and no additional module or computation has been introduced.Second, to benefit from dichotomous mutation and crossover, the rate of producing feasible individuals is much higher than other competitors.So the computation cost of repairing infeasible individual is less than others.Taking into account these experiments and analyses, we can conclude that DBDE is effective and efficient for 0-1 knapsack problems.

Multidimensional Knapsack Problem.
Three groups of well-known multidimensional knapsack instances selected from OR-library [42] are used in the experimental studies to verify the performance of DBDE.The detailed descriptions of these multidimensional knapsack instances are summarized in Table 7.The optimum solutions of these instances are known.The first group with 2 multidimensional knapsack instances corresponds to "sento" [43], which is characterized by large constraints and the number of constraints is 30.In contrast to the first group, the second group with 8 multidimensional knapsack instances corresponds to "weing" [44], which is characterized by small constraints.The last group with 30 multidimensional knapsack instances corresponds to "weish" [45], which is a moderate test suit.Among the "weish" multidimensional knapsack instances, the number of constraints is 5 and the number of items ranges between 20 and 90.The used parameters are the same as in Section 6.1.
The results of the mean maximum profit achieved by the   (SR) are recorded in Table 9.The stopping criterion is that each algorithm is terminated when the optimum solution is found or the number of FEs reaches to its maximum value (100 * ).As seen, it is clear that DBDE is more reliable than other competitors as successful rate (SR) for DBDE reaches 100 on 22 multidimensional knapsack instances out of 40. Figure 4 shows the average successful rates of the six contestant algorithms on the multidimensional knapsack problems.Moreover, DBDE shows faster convergence speed on the majority of multidimensional knapsack instances.Although, from Table 9, the MFEs of Weing1, Weing4, Weish1, Weish3, Weish4, Weish5, Weish6, Weish8, Weish9, Weish17, Weish18, Weish23, Weish24, Weish26, Weish27, and Weish29 achieved by DBDE are not the best, but DBDE exhibits the best SR on this test multidimensional knapsack instances among the six algorithms.From the last row of Table 9, DBDE costs the lowest average MFEs to reach the threshold and gets the highest average SR.Therefore, the above experimental results and analysis verify the superior performance of DBDE on multidimensional knapsack problem.

Validity of Population Size and Crossover Probability
Settings.In order to investigate the validity of population size (NP) and crossover probability (CR1 and CR2) settings on the performance of DBDE, three scalable tests of DBDE have been carried out on the multidimensional knapsack problems with different NP, CR1, and CR2 values.The test suit of multidimensional knapsack problem is the same as Section 6.3 used.The experimental results of DBDE with different NP, CR1, and CR2 values are summarized in Tables 10, 11, and 12, respectively.
In the case of different NP values, experiments have been done on NP = 50, 100, 150, and .It is clear from Table 10 that the performance of NP = 100 is significantly better than that of others.When NP = 100, DBDE achieved best SR results (boldface).These observations demonstrate that NP = 100 is efficient and suitable.
As shown in Table 11, for the CR1 test, CR1 is set to 0.1, 0.2, 0.3, 0.4, and 0.5.By carefully examining the results, we find that value 0.2 gets best results.Therefore, on the whole, CR1 = 0.2 is the best choice for DBDE.In similar circumstances, observed from Table 12, CR2 = 0.5 also is the best option for DBDE.

Conclusion
DE is a powerful population-based random optimization algorithm.However, its operators are based on floating-point representation only and are not suitable for the combinational optimization problems.In order to solve these problems, a novel binary DE with dichotomous mechanism (DBDE) is proposed, in which dichotomous mutation and dichotomous crossover are employed to enhance the exploration ability of DE in the binary search space.Dichotomous mechanism is learned from the dichotomous thinking of psychology.The primary idea of dichotomous mechanism is that each

Figure 3 :
Figure 3: Convergence curves of the six contestant algorithms on nine representative 0-1 knapsack instances.

Figure 4 :
Figure 4: The successful rates of six algorithms on the multidimensional knapsack problems.

Table 1 :
Truth table of dichotomous mutation.

Table 3 :
Parameter settings for the contestant algorithms.

Table 4 :
The detailed information of the 0-1 knapsack instances.

Table 5 :
Experimental results of DBDE and other five competitors on twenty 0-1 knapsack instances.

Table 6 :
Runtime (in seconds) of DBDE and other five competitors on twenty knapsack instances.

Table 7 :
The detailed information of the multidimensional knapsack problems.

Table 8 :
Results of mean maximum profits on the multidimensional knapsack problems.Overall, the performance of DBDE on the multidimensional knapsack instances is better than that of the five competitors.In order to compare the convergence rate of different algorithms, the mean number of FEs required to converge to the optimum solution (MFEs) and the successful rate

Table 9 :
Results of mean number of FEs and successful rate on the multidimensional knapsack problems.