An Improved Meerkat Clan Algorithm for Solving 0-1 Knapsack Problem

Meerkat Clan Algorithm (MCA) is a nature-based metaheuristic algorithm which imitates the intelligent behavior of the meerkat animal. This paper presents an improvement on the MCA based on a chaotic map and crossover strategy (MCACC). These two strategies increase the diversification and intensification of the proposed algorithm and boost the searching ability to find more quality solutions. The 0-1 knapsack problem was solved by the basic MCA and the improved version of this algorithm (MCA-CC). The performance of these algorithms was tested on low and high dimensional problems. The experimental results demonstrate that the proposed algorithm had overcome the basic algorithm in terms of solution quality, speed and gained optimality with low dimensional problems. Furthermore, in high dimensional problems, it has competitive results in comparison with the other algorithms.


Introduction
Several problems springing up in applications are NP-hard, which means getting optimality in polynomial time is troublesome. Therefore, to practically solve this kind of problem, metaheuristic algorithms are utilized for getting approximate solutions in an acceptable time ISSN: 0067-2904 [1]. Some examples of the most widespread metaheuristic algorithms are Ant Colony Optimization (ACO), Artificial Bee Colony (ABC), and Particle Swarm Optimization (PSO). Metaheuristic algorithms have proven their superiority in solving various optimization problems. However, these algorithms may be trapped into local optima due to their stochastic behavior. Consequently, many improvements for metaheuristic algorithms were applied to overcome their limitations [2]. Recently, in numerous studies, chaos and metaheuristics were blended to exhibit the chaotic behaviors within the metaheuristic algorithms [3]. Chaos, which is defined as the simulation of the dynamic behavior of nonlinear systems, was utilized to overcome the barriers of metaheuristics and boost its performance [2]. The knapsack problem was classified as an NP-hard optimization problem. It has a variety of applications such as production planning problems, project selection, cutting stock problems, and resource allocation. 0-1 knapsack problem (0-1 KP) is one of the knapsack problems which consists of many items with its profits and weight to be involved in a knapsack. It aims to maximize the selected profit of the items without exceeding the knapsack capability [4]. Meerkat Clan Algorithm (MCA) is a nature-stimulated metaheuristic algorithm that was recently developed by Al-Obaidi, Abdullah, and Ahmed [5] for optimization problems. This novel algorithm mimics the intelligent behavior of the Meerkat (Suricata suricatta) animal in desert traversal to seek nourishment. This paper presents an improved version of the MCA to solve the knapsack problem. The rest of the paper is organized as follows: Section 2 presents some related work. Section 3 offers a brief description of basic MCA. In Section 4, the proposed MCA-CC is presented. The application of the 0-1 KP is described in Section 5. The experimental results are detailed and compared with other optimization techniques in Section 6. In the last section, the conclusions of the paper are drawn.

Related Works
The problem of 0-1 KP has been considered by several researchers on different topologies to evaluate its performance and validate its effectiveness in solving this type of problem. Below are some of these recent studies. In [6], parallel simulated annealing on CPU with GPU by using the CUDA platform for handling 0-1 KP was introduced. The parallel method is faster than the single ones and has the capability of delivering a good quality solution in both low and medium dimensional problems. The experiments demonstrated the parallel method has superiority over the sequential one. In [7], a hybridized PSO and greedy strategy that depended on the penalty factor was presented for tackling 0-1 KPs. The results obtained by this approach were competitive in comparison with other algorithms on large scale instances. In [8], a hybrid approach called cuckoo search algorithm with a global harmony search was suggested to solve 0-1 knapsack problems. This hybridization method overcomes the shortcomings of the cuckoo search algorithm by adapting the mutation operation to prop the search ability and population diversity. The efficiency and the effectiveness of the method have been demonstrated in tackling the low and high dimensional problem and it has the distinction compared with different optimization algorithms. In [9], a binary monkey algorithm was presented to solve the 0-1 knapsack problems. The local search ability of the proposed algorithm was reinforced by using the greedy strategy. The modified somersault process and adapted cooperation process were introduced to escape from the local optimum and speed up the convergence rate. The proposed algorithm showed efficiency in solving various data instances of the problem. In [10], the complex-valued encoding and the greedy algorithm with the wind-driven optimization were considered for enhancing its performance for solving 0-1 KPs in terms of exploration and the exploitation. The computational results show that the proposed algorithm is convenient for the different scales of the problem's instances. In [11], an improved binary chicken swarm optimization algorithm was proposed for solving the 0-1 knapsack problem. Greed and mutated strategies were applied to promote the quality and feasibility and increase the possibility of preventing the local minima. The comparison results proved that the proposed algorithm has sublimity in terms of quality of solution, stability, and convergence rate. In [12], the monarch butterfly optimization with Opposition-Based Learning (OBL) strategy and Gaussian perturbation was presented. The Gaussian perturbation was conducted on a portion of the individuals with deficient fitness in each generation to take out from the local optimum. Besides, the OBL method was performed on half of the population to speed up the convergence rate. The experimental results demonstrated the effectiveness of the proposed method in solving large-scale 0-1 KP problems. In [13], ten approaches based on the binary moth search algorithm were proposed for tackling a discounted 0-1 knapsack problem. In addition to the basic moth search algorithm, nine algorithms with diverse mutation operators based on the global harmony search were suggested. The experimental results demonstrated the prominent performance of the nine proposed methods in both solution quality and computational efficiency compared to the basic moth search. In [14], Fitness switching genetic algorithm was applied for solving the 0-1 knapsack problem by employing three distinctive methods; fitness leveling, fitness switching, and simple local search. The developed algorithm investigated the benefit of the fitness switching genetic algorithm for solving problems with many feasible solutions as well as problems with rare ones. The experiments demonstrated that the algorithm has an effective search ability, and it is tailored to solve these kinds of problems. In [15], a Binary version of the Flower Pollination Algorithm (BFPA) was proposed for solving the 0-1 knapsack problem. Since standard FPA is used for the continuous optimization, BFPA used a sigmoid function to convert the realvalued generated from FPA into one or zero. The computational results show that BFPA has better performance in large-scale KPs compared to other algorithms.

Meerkat Clan Algorithm
Meerkat clan algorithm (MCA) is a recent nature-based metaheuristic algorithm presented in [5]. It mimics the Meerkat animals' behavior in their coexistence and nutrition. Meerkats are animals that live in social groups from five to thirty members. These animals share both lavatories and parental care responsibility due to their sociability. Each gang has a leading alpha male and leading alpha female. Each gang has its region, and they move from one place to another in the absence of food or when forced by a more violent gang. In case they are forced to leave, the less violent gang will have to extend by another tactic or remain until they become more vigorous and retrieve their lost burrow. Each gang has someone who guards over it called a 'sentry'. This sentry guards the gang if there is a danger and warns them to avoid the risks. Given the meerkat behavior, the MCA can be outlined as the pseudocode shown in algorithm-1 [5]. MCA assumes that there is a clan with size n of meerkat(s) (solution) where each meerkat in the clan at the initialization phase is generated randomly. The best meerkat selected from the generated clan is defined as 'sentry', and the remainder of meerkats in the clan are separated into two groups, foraging group with size , and care group with size ( ). In the foraging group, each meerkat acquires the best neighbor to be its next position. Then, a fraction of the worst meerkats is swapped with the best ones in the care group. A fraction of the worst meerkats in the care group is discarded and replaced by random ones. The best meerkat in the foraging group becomes the sentry if it has superiority over the sentry obtained so far.

The Proposed Algorithm
Meerkat Clan Algorithm based on chaotic map and crossover operation (MCA-CC) is an improved version of the basic MCA algorithm, which is proposed in this paper to enrich the searching behavior of the basic MCA algorithm for finding the optimal solution. The pseudocode of the proposed MCA-CC algorithm is shown in algorithm-2. In MCA-CC, the initial solutions were generated using chaos instead of a random generation in the basic algorithm. This modification is proposed based on the characteristic of chaos which has been utilized to overcome the limitations of randomness. Furthermore, it considerably enhances the exploration ability of the algorithm. In MCA-CC, the well-known logistic map is employed to generate the initial solution via iterating one step of the equation (1) starting from a random initial value at the first iteration. The logistic map equation is described in equation 1 [16]: where ( ) is between 3.57 and 4 for fulfilling the chaotic behavior. Additionally, at every generation, after each meerkat in the foraging group updates its position with a neighbouring search using (2-opt) a number of the best meerkats are selected as an elite. These meerkats are used with the sentry for producing a new solution by 2-point crossover operation. The 2-point crossover operation is performed on the two selected parents in the proposed algorithm; it takes sentry solution as parent 1 and one solution in the elite as parent 2 to create one child ( ). This operation selects two crossover points randomly and combines the parents at the crossover points to create the child or offspring solution. Thereby, the genes between the two points are copied from the parents 1 into the child and other genes are taken from parent 2. Figure 1 shows an example of this operation. After performing the crossover operation and producing , one of the foraging group solutions is selected randomly ( ( ) ), and it is compared with the , if the is better than ( ), replace ( ) by . This method is suggested to provide proposed algorithm with an ability for using the experiences of the Clan members for creating a promising solution. Furthermore, the crossover operator used is to make the offspring inherit its parent attributes and promote the search ability of the proposed algorithm for finding a global optimum.   For the proposed algorithm, the chaotic map, on one hand, is utilized to produce uniformly distributed meerkats to improve the quality of the initial population rather than random production of the initial population in the basic MCA to overcome the lack of randomness. On the other hand, the local best regions of the solution space that is found in each generation, which is not taking into consideration in the basic MCA, is employed by crossover strategy. This can make the MCA-CC algorithm proceed with searching in promising areas, thereby raising the probability of finding global optimal or near to optimal solution and speed up the convergence rate.

MCA-CC for Solving the Knapsack Problem
In The 0-1 knapsack problem, there are n of items to be included in the knapsack, where each item has a profit and a weight , and maximum weight capability . clarifies if the item is included or not in the Knapsack. The objective of this problem is to maximize the items profit so that total weights do not exceed the limited weight capability of the knapsack [15]. 0-1 knapsack problem may be described as in equations 2 and 3: Consequently, to solve the 0-1 knapsack Problem by the MCA-CC algorithm, first, an initial clan of n binary solutions (meerkats) S i is generated using equation (1). Each meerkat has a dimension m which represents the number of items available in the Knapsack Problem. The basic steps of the initialization phase can be described as follows: Furthermore, Solution quality is evaluated by the fitness function, which is calculated as the gathering of the profits for all items selected in the knapsack. To retain the feasibility of the solution, the total weights of the packed items must not exceed the capacity of the knapsack so that the knapsack constraint is not contradicted. If the solution contradicts the knapsack constraint it means this is not a feasible solution. It is repaired by using the proposed repair algorithm which is illustrated in algorithm-3 to be a feasible solution.

. Experimental Results
The 0-1 knapsack problem was used to measure the performance of the basic and improved version of the meerkat clan algorithm (MCA and MCA-CC respectively) and these algorithms were conducted with MATLAB R2018b and run using Intel(R) Core i7 CPU Q740, 1.73GHz with 4GB memory capacity computer. The parameter settings for MCA and MCA-CC algorithms are presented in Table 1. The datasets used for the 0-1 Knapsack problem were obtained from [17]. These datasets were classified into two categories (low and high) depending on the dimension of the problems. The data types were classified into four categories; Low Dimensional Uncorrelated Data Instances (LD-UD), High Dimensional Uncorrelated Data Instances (HD-UD), High dimensional Weakly Correlated Data Instances (HD-WC), and High Dimensional Strongly Correlated Data Instances (HD-SC) due to their variance within the correlation of the data instances. To test the algorithms performance, 10 independent runs were made for the MCA and MCA-CC algorithms on the Low-dimensional and high-dimensional 0-1 Knapsack problem. The best-obtained solution and the error rate (ER) of each algorithm for the variant dimension of the problem are presented in Table 2 and Table 3. The error rate is calculated using equation 5: where ( ) is the optimal value and ( ) is the best value of the algorithm.  The experimental results showed, in Table 2, that in the low dimensional problems for the basic MCA and the proposed MCA-CC have obtained the optimal solution. Whereas, in high dimensional problems, the MCA algorithm outperforms the basic MCA algorithm in terms of solutions quality for all instances. Thereby, it produced a more quality solution with less error rate. Otherwise, in Table 4 and Table 5, the iteration number (iter) of the proposed algorithm is less than the basic algorithm. It has been observed that, in most of the low-dimensional datasets, the MCA-CC finds the optimum solution at the initialization phase of algorithm 2 due to the effectiveness of the chaos in the initialization phase. Furthermore, the MCA-CC algorithm has superiority over the basic MCA algorithm in finding a more quality solution with lower number of iterations in most of the high dimensional datasets.    [17], and Cohort Intelligence (CI) [18]) on low dimension test datasets. This comparison is illustrated in Table 6. Additionally, on high dimension test datasets, the comparison between the results gained by the MCA-CC algorithm and other algorithms (SA, GSA, and BB [17]) are shown in Table 7. Furthermore, from the comparison results, it is observable that MCA-CC has the minimum error rate for all tested datasets means the proposed algorithm has the superiority over all tested data on the low dimension. Whereas, on the high dimension, MCA-CC has superiority in most of the tested data. To decide the statistical contrasts between the MCA-CC and the comparison algorithms with the low and the high problems' scale, the Friedman test was set. The results are presented in Table 8 and Table 9. It can be seen from the Friedman test results that the distinctions among the calculations of the algorithm are statistically significant with 99% assurance on the low and the high problems scale. The MCA-CC obtains the best overall rank.  The data bold stylistic means the best results among the comparison algorithms The data bold style means the best results among the compared algorithms

Conclusions
The meerkat clan algorithm is a promising metaheuristic algorithm for solving optimization problems. In this paper, we presented an improved version of basic MCA based on a chaotic map and crossover (MCA-CC) for solving the 0-1 Knapsack problem. In MCA-CC, the initialization of the solutions is done using a chaotic map instead of randomization. This enhancement provides the proposed algorithm with more diversity in the clan (population). Moreover, the crossover operation is performed on the best solution attained so far which is called 'sentry' and the set of the best solution found in the foraging group which is called elite. These solutions are suggested to be a promising solution for producing better solutions that increase the ability of the proposed algorithm for finding the global optimum solution and speed up the convergence rate. The experimental results demonstrate that the basic MCA and MCA-CC have reached the optimal solution; however, the MCA-CC algorithm finds the optimal solution in less iterations than basic MCA in the low-dimensional tested problems. In the large-dimensional tested problems, the MCA-CC outperforms the basic MCA in terms of solution quality in all tested problems and finds better solutions in less iterations in most of them. Furthermore, in comparison with other algorithms, the proposed algorithm gained competitive solutions in all tested problems.