Optimization of Selective Assembly for Shafts and Holes Based on Relative Entropy and Dynamic Programming

Selective assembly is the method of obtaining high precision assemblies from relatively low precision components. For precision instruments, the geometric error on mating surface is an important factor affecting assembly accuracy. Different from the traditional selective assembly method, this paper proposes an optimization method of selective assembly for shafts and holes based on relative entropy and dynamic programming. In this method, relative entropy is applied to evaluate the clearance uniformity between shafts and holes, and dynamic programming is used to optimize selective assembly of batches of shafts and holes. In this paper, the case studied has 8 shafts and 20 holes, which need to be assembled into 8 products. The results show that optimal combinations are selected, which provide new insights into selective assembly optimization and lay the foundation for selective assembly of multi-batch precision parts.


Introduction
The demand for precision instruments in various industries is increasing. The assembly accuracy of precision instruments is strict, which is at the level of a micron, or even a nanometer. At present, the assembly accuracy of precision instruments is guaranteed by two aspects: controlling the machining accuracy of parts through tolerance analysis and adjusting the assembly process as per monitoring data. Due to the limitations of machining ability and cost, it is impossible to guarantee assembly accuracy by unboundedly improving machining accuracy. Thus, adjustment of the assembly process is an effective method to ensure the assembly accuracy of precision machinery.
Adjustment of the assembly process includes adjustment position, repair method, and selective assembly. In detail, the adjustment position method is used to adjust the relative position between parts, such as assembly angle; the repair method is to ensure the assembly accuracy by secondary processing, such as manual grinding, scraping, and filing; the selective assembly refers to the selection of appropriate parts in the key assembly process [1]. Among them, the selective assembly has good effect and low cost, and is widely used in actual assembly. Selective assembly is the method of obtaining high precision assemblies from relatively low precision components. The traditional selective assembly mainly includes the direct matching method, the grouping selection method, and the composite matching method. For precision instruments, the geometric error on mating surface is an important factor affecting assembly accuracy [2]. According to ASME Y14. 5-2009 [3],  For precision mechanical systems, geometric errors on mating surfaces directly affect the position of the part during assembly and change the contact state between the parts [4]. If the distribution of the geometric error is uniform, the assembly error is small and the contact state will be stable-as shown in case (c) in Figure 2. Furthermore, for shafts and holes of precision mechanical systems, the size and uniformity of assembly clearance will affect the assembly accuracy and stability. Therefore, the geometric error on mating surface must be considered in the selective assembly process, instead of simply using traditional selective assembly methods. Considering the characteristics of precision shafts and holes, such as small size, high rigidity, high machining precision, and good surface quality, this paper focuses on the influence of shape deviation on assembly.

Related Works
At present, researchers have mainly achieved optimization of selective assembly from two aspects: evaluation index and optimization algorithm. The appropriate evaluation index is the premise to determining the optimization objective.
There has been some work done on evaluation index, such as Taguchi's mass loss function, square loss function, and process capability index, among others. Using Taguchi's mass loss function as evaluation index, Kannan et al. searched the optimal grouping of selective assembly [5]. On this basis, the quality loss function of Taguchi theory is used as a characterization tool to build a customized product matching model by Tu Zhenyin [6]. Matsuura et al. extended the square loss function to the convex loss function and established the optimal grouping [7]. Based on process capability index, Lin et al. constructed an optimization model of matching parts assembly [8]. To solve the remanufacturing optimization matching problem, an assembly success rate and a remanufacturing resource utilization rate were presented as the assembly quality evaluation indexes [9]. Sun et al. considered the effect of closed loop on the fitted position and put forward three methods to improve selective assembly [10]. Asha et al. proposed a grouping selection method suitable for high-precision components, aiming at minimizing the fluctuation of assembly clearance and minimizing the remaining parts [11]. Xingyu et al. developed a new selective assembly method optimization for remanufactured machinery. Considering assembly accuracy, utilization of parameters. Assembly errors are caused by form deviations, profile, orientation, waviness, and roughness. As Figure 1 shows, four parts with identical flatness produce completely different assembly effects, due to their different geometric shapes and spatial distribution. Figure 2 illustrates the assembly of an ideal part using these four surface types, and it can be seen that when P2 mates with P1, the assembly errors for four cases give different results.  For precision mechanical systems, geometric errors on mating surfaces directly affect the position of the part during assembly and change the contact state between the parts [4]. If the distribution of the geometric error is uniform, the assembly error is small and the contact state will be stable-as shown in case (c) in Figure 2. Furthermore, for shafts and holes of precision mechanical systems, the size and uniformity of assembly clearance will affect the assembly accuracy and stability. Therefore, the geometric error on mating surface must be considered in the selective assembly process, instead of simply using traditional selective assembly methods. Considering the characteristics of precision shafts and holes, such as small size, high rigidity, high machining precision, and good surface quality, this paper focuses on the influence of shape deviation on assembly.

Related Works
At present, researchers have mainly achieved optimization of selective assembly from two aspects: evaluation index and optimization algorithm. The appropriate evaluation index is the premise to determining the optimization objective.
There has been some work done on evaluation index, such as Taguchi's mass loss function, square loss function, and process capability index, among others. Using Taguchi's mass loss function as evaluation index, Kannan et al. searched the optimal grouping of selective assembly [5]. On this basis, the quality loss function of Taguchi theory is used as a characterization tool to build a customized product matching model by Tu Zhenyin [6]. Matsuura et al. extended the square loss function to the convex loss function and established the optimal grouping [7]. Based on process capability index, Lin et al. constructed an optimization model of matching parts assembly [8]. To solve the remanufacturing optimization matching problem, an assembly success rate and a remanufacturing resource utilization rate were presented as the assembly quality evaluation indexes [9]. Sun et al. considered the effect of closed loop on the fitted position and put forward three methods to improve selective assembly [10]. Asha et al. proposed a grouping selection method suitable for high-precision components, aiming at minimizing the fluctuation of assembly clearance and minimizing the remaining parts [11]. Xingyu et al. developed a new selective assembly method optimization for remanufactured machinery. Considering assembly accuracy, utilization of For precision mechanical systems, geometric errors on mating surfaces directly affect the position of the part during assembly and change the contact state between the parts [4]. If the distribution of the geometric error is uniform, the assembly error is small and the contact state will be stable-as shown in case (c) in Figure 2. Furthermore, for shafts and holes of precision mechanical systems, the size and uniformity of assembly clearance will affect the assembly accuracy and stability. Therefore, the geometric error on mating surface must be considered in the selective assembly process, instead of simply using traditional selective assembly methods. Considering the characteristics of precision shafts and holes, such as small size, high rigidity, high machining precision, and good surface quality, this paper focuses on the influence of shape deviation on assembly.

Related Works
At present, researchers have mainly achieved optimization of selective assembly from two aspects: evaluation index and optimization algorithm. The appropriate evaluation index is the premise to determining the optimization objective.
There has been some work done on evaluation index, such as Taguchi's mass loss function, square loss function, and process capability index, among others. Using Taguchi's mass loss function as evaluation index, Kannan et al. searched the optimal grouping of selective assembly [5]. On this basis, the quality loss function of Taguchi theory is used as a characterization tool to build a customized product matching model by Tu Zhenyin [6]. Matsuura et al. extended the square loss function to the convex loss function and established the optimal grouping [7]. Based on process capability index, Lin et al. constructed an optimization model of matching parts assembly [8]. To solve the remanufacturing optimization matching problem, an assembly success rate and a remanufacturing resource utilization rate were presented as the assembly quality evaluation indexes [9]. Sun et al. considered the effect of closed loop on the fitted position and put forward three methods to improve selective assembly [10]. Asha et al. proposed a grouping selection method suitable for high-precision components, aiming at minimizing the fluctuation of assembly clearance and minimizing the remaining parts [11]. Xingyu et al. developed a new selective assembly method optimization for remanufactured machinery. Considering assembly accuracy, utilization of remanufactured parts, and assembly efficiency, Taguchi quality loss function (QLF) and cost function of remaining parts were both employed [12].
In terms of optimization algorithm, Asha et al. believed that each quality characteristic will fall in different groups in selective assembly, and used the non-dominated sorting genetic algorithm to find the best combination [13]. On this basis, selective group combinations for assembling the mating parts was obtained using particle swarm optimization (PSO) by Kannan [14]. However, the algorithm was demonstrated only for linear assembly, which consists of three components having equal dimensional distributions. Dong Z proposed a new selective assembly model used in multi-dimension chains and an improved PSO algorithm [15]. Liu et al. combined assembly accuracy and assembly rate to form a new optimization objective function, and studied the application of ant colony algorithm in computer aided selection assembly [16]. Ren Shuiping et al. proposed a selective assembly method based on Pareto and genetic algorithm to solve the problem of selecting mechanical products with multiple quality requirements [17].
The studies aforementioned merely focused on the assembly dimension chain and tolerance analysis, and take quality loss, assembly accuracy, and assembly rate as optimization objectives. However, the influence of non-uniform distribution of geometric error on mating surface is not addressed. In fact, due to the importance of assembly clearance when selecting shafts and holes, the uniformity of the assembly clearance needs to be taken as an optimization objective, which has not been fully considered in current researches. Therefore, this paper proposes an optimization method of selective assembly for shafts and holes based on relative entropy and dynamic programming. The relative entropy is used to evaluate the uniformity of assembly clearance, while dynamic programming is used to calculate the optimization results. Through this method, the optimal selective assembly plan can be obtained, which can provide guidance for the actual assembly. Besides, the influence of geometric error on assembly accuracy is reduced, and the final assembly accuracy and performance of products can be improved.
Our work is described in this paper, which is structured as follows. Related works are given in Section 2. Then, the method-where relative entropy has been used for evaluation and dynamic programming has been used as an optimization algorithm-is detailed in Section 3. A case is described in Section 4; results and discussion are shown in Section 5. Our conclusions and concepts for future work are presented in the final section.

Selective Assembly Optimization Model for Shaft and Hole
A selective assembly optimization model, intended to select the shaft and hole with uniform clearance, is proposed. In the model, the process has been broken down into two steps-evaluation and optimization-as illustrated in Figure 3.
In the first step, a series of measuring points characterizing geometric errors are measured using a coordinate measuring machine (CMM). The tactile CMM with high measurement accuracy (measurement uncertainty of 0.6 + L/600 µm) is selected in our work, according to the characteristics of small size and high machining accuracy for precision shaft and hole. The mating surface of shaft and hole is cylindrical, thus, on the premise of sampling theorem, several circles are measured along the axial direction, with dozens of points per circle.
After data processing, the radial distribution of geometric errors for shaft and hole is calculated. The radial distribution represents the ratio of the radius at a certain measurement point to the sum, which can be regarded as probability distribution. Relative entropy is an index to judge the difference between two probability distributions. The smaller its value, the smaller the difference, that is, the more uniform the clearance between shaft and hole. Therefore, the relative entropy is used to evaluate the assembly clearance uniformity of each pair of shaft and hole.  In the first step, a series of measuring points characterizing geometric errors are measured using a coordinate measuring machine (CMM). The tactile CMM with high measurement accuracy (measurement uncertainty of 0.6 + L/600 μm) is selected in our work, according to the characteristics of small size and high machining accuracy for precision shaft and hole. The mating surface of shaft and hole is cylindrical, thus, on the premise of sampling theorem, several circles are measured along the axial direction, with dozens of points per circle.
After data processing, the radial distribution of geometric errors for shaft and hole is calculated. The radial distribution represents the ratio of the radius at a certain measurement point to the sum, which can be regarded as probability distribution. Relative entropy is an index to judge the difference between two probability distributions. The smaller its value, the smaller the difference, that is, the more uniform the clearance between shaft and hole. Therefore, the relative entropy is used to evaluate the assembly clearance uniformity of each pair of shaft and hole.
In the second step, the dynamic programming has been used as an optimization algorithm. The average uniformity of all clearances is taken as the optimization objective, and the premise is that there is no interference between shaft and hole. Finally, the optimal pairing combinations are output for batch of shafts and holes.

Clearance Uniformity Evaluation of Shaft and Hole Based on Relative Entropy
Some studies have shown that entropy-which represents the average uncertainty of random events, and has been widely employed in control theory, image reconstruction, biology, and medicine, among others [18][19][20]-is more suitable for describing data uncertainty [21]. Preliminary research using information entropy to evaluate geometric errors on plane has been conducted [2,3,22,23]. The plane has been divided into a lattice with an m × n grid, zi,j represents the height of grid point (Pij), and the relative height at each point is hij = zij − zmin, where zmin = min{zij, i = 1, 2…, m; j = 1, 2, …, n}. The sum of the relative heights is therefore as shown in Equation (1) The ratio ( ij h ) of the height at a certain point to the sum is given as shown in Equation (2): In the second step, the dynamic programming has been used as an optimization algorithm. The average uniformity of all clearances is taken as the optimization objective, and the premise is that there is no interference between shaft and hole. Finally, the optimal pairing combinations are output for batch of shafts and holes.

Clearance Uniformity Evaluation of Shaft and Hole Based on Relative Entropy
Some studies have shown that entropy-which represents the average uncertainty of random events, and has been widely employed in control theory, image reconstruction, biology, and medicine, among others [18][19][20]-is more suitable for describing data uncertainty [21]. Preliminary research using information entropy to evaluate geometric errors on plane has been conducted [2,3,22,23]. The plane has been divided into a lattice with an m × n grid, z i,j represents the height of grid point (P ij ), and the relative height at each point is h ij = z ij − z min , where z min = min{z ij , i = 1, 2 . . . , m; j = 1, 2, . . . , n}. The sum of the relative heights is therefore as shown in Equation (1): The ratio (h ij ) of the height at a certain point to the sum is given as shown in Equation (2): If h ij is regarded as a sample of the random variable X, and h ij is regarded as sample probability, then information entropy can be used to reflect grid point height distribution.
The following is a brief introduction to the principle of information entropy, which applies to the two subsequent levels of entropy evaluation. Assume that a set of discrete random variables X = {x 1 , x 2 , . . . , x n }, and its probability distribution p i = p[X = x i ] = {p 1 , p 2 , . . . , p n }; that is: Information entropy, H(X), characterizes the uncertainty of random events.
E( ) indicates the mathematical expectation, and r is the base of the logarithm, which can take 2, e or 10. In our study, we use e as the base-allowing Equation (4) to be rewritten as shown in (5).
For the plane, the ratio of the height at a certain point to the sum is taken as the sample probability, and the information entropy is used to reflect the height distribution of measurement points. Similarly, for the cylindrical surface of shaft and hole, the ratio of the radius at a certain point to the sum can be taken as the sample probability, and the radial distribution of measurement points can be also reflected by entropy. Thus, Equations (1) and (2) can be rewritten as follows: where m and n represent the number of measurement points in the axial and radial directions, respectively. r i,j represents radius of measurement point, and the relative radius at each point is R ij = r i,j − r min , where r min = min{ r i,j , i = 1, 2 . . . , m; j = 1, 2, . . . , n}. R ij represents the ratio of the radius at a certain point to the sum. Relative entropy is an index to judge the difference between two probability distributions on the basis of information entropy. The smaller its value, the smaller the difference, that is, the more uniform the clearance between shaft and hole.
If the probability distribution of shaft and hole are recorded as p(r) and q(r), respectively, then the relative entropy of the shaft and hole is given as shown in Equation (8): Notice, KL(p q) KL(q p).

Optimization Algorithm Based on Dynamic Programming
Relative entropy can be used to evaluate the assembly clearance of a pair of shaft and hole. However, there are several assembly options for batch of shafts and holes. Therefore, it is necessary to consider the comprehensive optimization objectives. Suppose a batch of shafts and holes are assembled; the number of shafts is M; the number of holes is N; there are L combinations of shafts and holes; D k i,j indicates whether the i-th shaft and j-th hole are involved in the k-th combination, yes is 1, no is The constraint condition is that each part can be used for assembly at most once, and the quantity of each part must meet the assembly quantity. The mathematical description of the selective assembly optimization is as follows.
The optimization objective is to minimize the average relative entropy of all shafts and holes. Assuming that relative entropy of k-th combination is f (D k i,j ), the optimization objective is shown in Equation (11): Based on the above analysis, selective assembly of shaft and hole is essentially a kind of 0-1 programming problem, in which the variable either takes 0 or 1. Dynamic programming is suitable for solving such a problem. Through the optimization principle of dynamic programming, the multi-stage process is transformed into a series of single-stage problems. Based on the decision of the previous stage, the optimal scheme can be selected under the conditions of different stages, which can determine the optimal value [24]. Based on the idea of dynamic programming, there are many intelligent optimization algorithms, such as genetic algorithm, ant colony algorithm, simulated annealing algorithm, and so on. The cellular bat algorithm (CBA) [25] is used in our work, which can accelerate optimization speed and improve the ability of global optimization.
The cellular bat algorithm consists of input module, initialization module, evaluation module, iteration module, and output module, as shown in Figure 4.   The specific steps are as follows: (1) Construct cellular automata and initialize parameters. The number of shafts, holes, and products to be assembled are M, N, and L, where L ≤ min(M, N); The number of bat population is n; the position of the i-th bat is x i , and its dimension is L. x i includes the assembly combination of L products. id_hole and id_axis, respectively, show the index of holes and shafts. The initialization method of x i is as follows: where, j = 1, 2, . . . , L, id_hole ∈ {1, 2, . . . , N}, id_axis ∈ {1, 2, . . . , M}. Equation (12) shows that in the zero iteration (the initialization stage), the j-th product is assembled by id_hole and id_shaft.
(2) Calculate the fitness of each bat in the initial population, and initialize the global optimal solution x best . The fitness represents the assembly evaluation of L products, which can be calculated by Equations (8) and (11).
(3) Update the position of each bat. 1 Calculate the evolution coefficient s and all neighbors x neighbors of current bats by Equations (13) and (14). s = fitness i − fitness min fitness max − fitness min (13) x neighbors = x count_dif(x, where fitness i is the fitness of the i-th bat; fitness min and fitness max , respectively, show the min and max value of all fitness. In Equation (14), count_dif counts the number of different items in two equal-length vectors. This means that the neighbor bat and the current bat have only one item different from each other, and the other items are the same. 2 If s < rand(), the current bat evolves into the optimal solution in x neighbors with a certain probability, or is replaced by a solution in x neighbors randomly. Where s and rand( ) range in [0, 1]. 3 If s ≥ rand(), the current bat is replaced with new generated bat randomly.
(4) Recalculate the fitness of each bat and update the global optimal solution x best . (5) Judge whether the termination condition is met. If so, output the global optimal solution; otherwise, turn to step (4). The termination condition is that the number of iterations is equal to the maximum number.

Case Study
In this case, there are 8 shafts and 20 holes, which need to be assembled into 8 products. The explicit views of the parts-to-be-assembled with tolerances and dimensions are shown in Figure 5. The designed diameters of shafts and holes are 6 mm, and cylindricity error is 0.006 mm and 0.008 mm, respectively. The material of parts is beryllium alloy for aviation applications, which requires properties such as being lightweight, good stiffness, and stability. The material properties of beryllium alloy are listed as Table 1. In this case, the shaft-hole connection is under magnetic levitation. There is no direct contact between the assembly surfaces of the shaft and hole; and good coaxiality is required. Thus, no interference and clearance uniformity are regarded as optimization criterions. Their mating surfaces are measured using a tactile coordinate measuring machine (Leitz PMM866 of HEXAGON, measurement uncertainty of 0.6 + L/600 µm, measurement system of PC-DMIS). For each mating surface, 5 circles are measured along the axial direction, with 37 points per circle. The maximum and minimum radii of shafts and holes after the parts are numbered are listed in Table 2.
properties such as being lightweight, good stiffness, and stability. The material properties of beryllium alloy are listed as Table 1. In this case, the shaft-hole connection is under magnetic levitation. There is no direct contact between the assembly surfaces of the shaft and hole; and good coaxiality is required. Thus, no interference and clearance uniformity are regarded as optimization criterions. Their mating surfaces are measured using a tactile coordinate measuring machine (Leitz PMM866 of HEXAGON, measurement uncertainty of 0.6 + L/600 μm, measurement system of PC-DMIS). For each mating surface, 5 circles are measured along the axial direction, with 37 points per circle. The maximum and minimum radii of shafts and holes after the parts are numbered are listed in Table 2.    The cylindricity of each part as per measurement data of shafts and holes is shown in Table 3.

Results and Discussion
According to Equations (6) to (8), the relative entropy of each pair of shaft and hole is calculated; the results are shown in Table 4. (-) indicates that the maximum radius of the shaft is greater than the minimum radius of the hole, so it is not a clearance fit. Using the optimization algorithm based on dynamic programming, the optimal combinations of selective assembly are listed in Table 5; average relative entropy is 0.1184. In the cellular bat algorithm, the larger the bat population, the greater the probability of obtaining the global optimal solution; the larger the maximum times of iteration, the longer the calculation time. Considering the optimization effect and time, this case uses the following parameters: the number of bat population is 100 and the maximum times of iteration is 200. For comparison, the traditional direct matching method based on tolerance is adopted. According to the cylindricity of holes shown in Table 3, eight holes with better cylindricity are selected and sorted from small to large, according to the minimum radius. At the same time, eight shafts are sorted from small to large, according to the maximum radius. Match shafts and holes by sorting, and check the interference of each pairing. Table 6 shows the matching results based on the direct matching method. The average relative entropy is 0.2330. The comparison result of optimal selective assembly and traditional direct selective assembly is shown in Figure 6. The smaller the relative entropy, the more uniform the clearance between shaft and hole. The relative entropy of the seven products obtained by the two methods is same, but the average relative entropy of the eight products obtained by optimal selective assembly is smaller. Although direct selective assembly is effective to some extent, it cannot provide the best matching combination for eight products. The comparison shows that the global optimal result is obtained by the optimization method explained in this paper.

Conclusions and Future Work
This paper describes a selective assembly optimization method for shafts and holes based on relative entropy and dynamic programming. A selective assembly optimization model for shafts and holes was developed, including the evaluation and optimization process. Relative entropy is used to evaluate the assembly clearance uniformity of the shaft and hole. The average uniformity of all clearances is taken as the optimization objective, and dynamic programming has been used as an optimization algorithm. The proposed method is tested using 8 shafts and 20 holes. The proposed method was able to reflect the clearance uniformity between shafts and holes considering geometric errors, and could supplement traditional selective assembly.
In the future, the proposed method will be applied to the assembly of precision mechanical systems, such as inertial navigation systems and precision optical systems. The comprehensive optimization method of multi-batch assembly will be further considered, and the evaluation index of overall optimal assembly will be established to realize the optimal assembly accuracy of multi parts.