Research on bin packing problem based on improved immune clonal algorithm

. An improved immune cloning algorithm based on clustering competition is proposed, which ensures the diversity of antibody population, effectively improves the convergence speed of the algorithm and avoids immature convergence. The algorithm is applied to packing problem and achieves good results.


Introduction
In the fields of industrial engineering and practical application, many problems can be transformed into bin packing problems.For example, at the dock, containers of different sizes and weights need to be loaded into cargo ships; In a wood or steel plant, several parts of different shapes are cut from a large raw material according to the actual needs and packaged separately; In supermarkets, especially warehouse supermarkets, all kinds of goods need to be classified and placed on different shelves.In all similar applications, how to make the most effective use of container space and place objects according to the required order is the purpose of this kind of problem research.These are the prototype of packing problem.
The problem to be solved in the packing problem is to find an optimal packing scheme to minimize the number of boxes used on the premise of ensuring that all items are loaded into the box, which is actually an optimization problem.Therefore, a natural idea is to apply the optimization theory and method to study the packing problem.However, due to the need to consider different factors such as dimension, shape, constraints and objectives, the packing problem is much more complex than the general NP problem.Many algorithms have been proposed to solve this problem, but most of them are approximate algorithms and heuristic algorithms.The core part of the existing accurate algorithms is mostly the branch and bound method.But there are obvious shortcomings: the exhaustive method has "combined explosion" when the number of boxes is a little large; The heuristic information introduced by heuristic search method depends on personal experience, and there is also a "combination explosion"; The neural network method has obvious effect in solving the packing problem, but it has slow convergence speed and is easy to fall into local optimization.
In this paper, an immune clone algorithm based on clustering and competition is proposed.The clustering competition mechanism is introduced into the process of clone selection, and the algorithm is applied to the packing problem.

Description of the problem
The classical one-dimensional packing problem is described as follows: given a positive number c and a set of numbers 1 { , , } n J a a =  , 0 i a c < ≤ ,find a partition method to divide J into some disjoint subsets i B , so that , and make m the minimum integer to meet this requirement.Intuitively, it refers to the following problems: it is necessary to load n items with a volume of , , 2 1 w w ……, n w , into many boxes (up to n), and the box has a capacity limit, and the capacity of each box is C (C > 0).The problem is to find the best scheme to allocate items to boxes, so that each item is loaded into the box and the number of boxes used is the least.The mathematical model of packing problem is as follows: Where, indicates that the items are loaded in box i , whereas 0 means that the article j is loaded into the box i , whereas 0 = ij x means that the article j is not loaded into the box i .

Algorithm description
The initial antibody group is defined as Ab, the scale is N, the coding length of each antibody is L, and the morphological space of all antibodies can be defined as S, then N L Ab S × ∈ .

Clustering process
The clonal selection mechanism based on clustering competition proposed by this algorithm is to enable the antibodies with high affinity and low concentration in the antibody population to enter the process of clonal selection amplification.At the same time, select the antibody with high affinity and inhibit the antibody similar to or the same from entering the clonal amplification mechanism.The specific steps are: Step 1: set the total number of clustering centers as M; Step 2: select the antibody with the highest affinity from the antibody group Ab as the first cluster center, so that 1 = C ; Step 3: calculate the sum of the distances from the remaining − N C antibodies (non cluster centers) to the C cluster centers, select the antibody with the largest sum of the distances to the C cluster centers as the next new cluster center, make 1 = + C C , judge whether C is equal to M, if yes, execute the next step, otherwise repeat step 3; Step 4: calculate the distance between the remaining N-M antibodies (non cluster centers) and M cluster centers, and classify the antibodies into the cluster represented by the nearest cluster center according to the principle of minimum distance to the cluster center; Step 5: number the antibodies according to the cluster number, and calculate the number of antibodies i D (i=1,2,…,M) contained in each cluster; It can be seen from the above that in order to successfully cluster antibodies, the distance between antibodies must be calculated, and the so-called distance between antibodies essentially refers to the similarity between antibodies.The distance between antibodies should be calculated in different ways according to different coding methods.This algorithm measures the distance between antibodies by introducing information entropy.
Assuming that the character set size adopted by each gene is X, the information entropy ( ) j H N of the j-th gene of all antibodies in the whole antibody group Ab (scale N, coding length L) is defined as: Where {1, 2, , } ∈  j L , ij p is the probability that a character in the character set appears on the J gene of the ith antibody.If the characters of all antibodies in the antibody group are the same at position j, then ( ) 0 = j H N .
According to the definition of entropy, the higher the similarity of two antibodies, the smaller their average information entropy; On the contrary, the lower the similarity between the two, the greater the average information entropy of the two.Therefore, the average information entropy between two antibodies can be used to define the distance uv dis between two antibodies u and V:

Antibody clustering and competition
After clustering, the cluster antibody group t Ab with scale N is obtained.These N antibodies belong to M clusters, namely:

Ab Ab Ab Ab
Where ( 1, 2, , ) =  ti Ab i M represents the i cluster antibody group, and the number of antibodies contained is i D .
The competition mechanism is introduced into each cluster.Firstly, the antibody with the highest affinity in the cluster is selected, and then the antibody representing the cluster center is taken out to form an excellent antibody group e Ab with a scale of T (where T＝ 2M), that is: Ab′ are the antibodies with the highest affinity in the i cluster, ei Ab′′ is the center of the ith cluster, 1, 2, , In this way, similar antibodies will belong to the same cluster after clustering, so only the highest antibody and the antibody representing the cluster center can be selected and enter the process of clonal amplification and affinity maturation, which prevents a few similar individuals with high fitness from filling the whole population after selection and makes the algorithm fall into local optimization.A cluster represents a small local area in the search domain.Using the cluster competitive selection mechanism, the excellent individuals in each cluster (i.e. each small search area) can obtain the opportunity of clonal amplification and affinity maturity.This will greatly improve the diversity of antibody population distribution, make the immune cloning algorithm balance between deep search and wide search, and effectively improve the development and exploration ability of immune cloning algorithm.

Cloning and amplification
Clone and amplify the T excellent antibodies after clustering competition according to the following clone scale function: Where N i is the clone size of the i antibody, round ( ) is the rounding function, and i＝ 1,2,…,T. 1 N is the number of antibodies after cloning, obviously Therefore, the higher the affinity of the antibody, the larger the scale of the clone, and the more the same antibody will be cloned.After cloning, the original t excellent antibodies were expanded into T small antibody groups with the scale of N i (i=1,2,…,T).Then the excellent antibody group Ab e becomes the clonal antibody group Ab c with the scale of N c .Namely: Ab (i＝1,2,…,T) represents the small antibody group formed after cloning and replication of the ith antibody ei Ab (i＝1,2,…,T) in e Ab , and the number of antibodies contained is N i .

Implementation steps of clustering competitive immune cloning algorithm
1) Initialize antibody group Ab and randomly generate N antibodies; 2) Cluster the antibodies in Ab according to the method described in 2.1 to obtain M cluster antibody groups, and then select the antibody with the highest affinity in each cluster and the antibody representing each cluster center to obtain the antibody group e Ab composed of T excellent antibodies.
3) Then clone and amplify the T antibodies according to the method described in 2. 5) The definition of information entropy is used to calculate the distance between antibodies in m Ab .When the distance between two antibodies is less than a certain threshold, the antibody with lower affinity is cleared and the individual with higher affinity is left to obtain antibody groupAb

Summary
In this paper, an improved immune clonal algorithm based on clustering competition is proposed.The diversity of antibodies is ensured by introducing clustering competition mechanism in the process of clonal selection.The distance between antibodies is measured by information entropy.The algorithm has good global convergence and convergence speed, and effectively solves the premature convergence problem of general evolutionary algorithms.
3 to obtain the antibody group c Ab with the scale of c N .4) The antibody in c Ab is recombined and mutated according to the recombination mutation probability, and then cloned and deleted to obtain the antibody group m Ab with the scale of c N .
add them to the antibody group d Ab to obtain the antibody group Ab.7)Judge whether the termination conditions are met.If not, turn to step 2 to continue; If it is satisfied, the calculation is ended and the result is output.