#### Abstract

This study focuses on the -level batching problem with a hierarchical clustering structure. Clustering is the task of grouping a set of item types in such a way that item types in the same cluster are more similar (in some sense or another) to each other than to those in other clusters. In hierarchical clustering structure, more and more different item types are clustered together as the level of the hierarchy increases. -level batching is the process by which items with different types are grouped into several batches passed from level 1 to level sequentially for given hierarchical clustering structure such that batches in each level should satisfy the maximum and minimum batch size requirements of the level. We consider two types of processing costs of the batches: unit processing cost and batch processing cost. We formulate the -level batching problem with a hierarchical clustering structure as a nonlinear integer programming model with the objective of minimizing the total processing cost. To solve the problem optimally, we propose a multidimensional dynamic programming algorithm with an example.

#### 1. Introduction

According to Wikipedia, clustering problem is the task of grouping a set of item types in such a way that item types in the same cluster are more similar (in some sense or another) to each other than to those in other clusters. It is the main task of exploratory data mining and a common technique for statistical data analysis, used in many fields, including machine learning, pattern recognition, image analysis, information retrieval, bioinformatics, data compression, and computer graphics. Hierarchical clustering (also called hierarchical cluster analysis or HCA) is a method of cluster analysis which seeks to build a hierarchy of clusters. Strategies for hierarchical clustering generally fall into two types: agglomerative clustering and divisive one. Agglomerative clustering is a bottom-up approach: that is, each observation starts in its own cluster, and pairs of clusters are merged as one moves up the hierarchy. To the contrary, divisive clustering is a top-down approach: that is, all observations start in one cluster, and splits are performed recursively as one moves down the hierarchy. In general, the merges and splits are determined in a greedy manner. The results of hierarchical clustering are usually presented in a dendrogram.

The hierarchical clustering problem has been studied for several decades in a wide range of fields including manufacturing, biotechnology, information technology (IT), logistics and transportation, financial, and postal industries. In the manufacturing sector, hierarchical clustering has been used to form manufacturing cells and processing batches. Vakharia and Wemmerlöv [1] investigated the performance of seven hierarchical agglomerative clustering techniques and eight dissimilarity measures in the context of cell formation in the cellular manufacturing system. Chen et al. [2] proposed a constrained agglomerative clustering algorithm for the single batch processing machine scheduling problem often encountered in semiconductor manufacturing and metal heat treatment. Hierarchical clustering is one of the most commonly used methods in biotechnology for classification. Cheng et al. [3] suggested hierarchical model-based clustering of DNA sequences by upgrading Bayesian model-based clustering. Cameron et al. [4] proposed hierarchical clustering of gene expression patterns consistent with the lineage of differentiating excitatory neurons during early neocortical development. Saunders et al. [5] used Markov clustering and hierarchical clustering to classify protein families of rust pathogens and rank them according to their likelihood of being effectors. Barzinpour et al. [6] proposed a spectral approach to community detection, where the multiplex is mapped onto Euclidean Space (using the top few eigenvectors) and applied -mean clustering. See Andreopoulos et al. [7] for a review of the clustering algorithms applied in bioinformatics.

Clustering is one of the most important techniques for image segmentation and data analytics in the IT industry. Arifin and Asano [8] presented a histogram thresholding algorithm using hierarchical cluster analysis for image segmentation. Nunez-Iglesias et al. [9] proposed an active machine learning approach for performing hierarchical agglomerative clustering from superpixels to improve segmentation of 2D and 3D images. See Zaitoun and Aqel [10] for a survey of image segmentation techniques. In relation to data analytics, Bouguettaya et al. [11] proposed a set of agglomerative hierarchical clustering methods, and Costa et al. [12] proposed a hierarchical approach for clustering XML documents with multiple forms of structural components. Hierarchical clustering also has been successfully applied to the logistics and transportation sector. Özdamar and Demir [13] proposed a multilevel clustering algorithm that groups demand nodes into smaller clusters at each planning level for coordinating vehicle routing in large-scale postdisaster distribution and evacuation activities. Zhu and Guo [14] extended the traditional hierarchical clustering method by generalizing flows to different hierarchical levels to aggregate and map large taxi flow data in an urban area. The hierarchical clustering problem arises in the postal industry as well. Lim et al. [15] studied the three-level presorting loading problem which occurs in the commercial bulk mail service. They considered the problem as a three-level hierarchical clustering problem and proposed an optimal solution algorithm. For the financial sector application, Aghabozorgi and Teh [16] suggested a novel three-phase clustering model to categorize companies based on the similarity in the shape of their stock markets. See Murtagh and Contreras [17] for an extensive survey on the agglomerative hierarchical clustering algorithms.

In this study, we consider an* N*-level batching with agglomerative hierarchical clustering structure in which the highest possible level of the hierarchy is . -level batching is the process by which items with different types are grouped into several batches passed from level 1 to level sequentially for a given hierarchical clustering structure such that batches in each level of the hierarchy should satisfy the maximum and minimum batch size requirements of the level. We assume that types of items that can be clustered together are given in each level (i.e., hierarchical clustering structure). Also, we assume that there exist the maximum and minimum batch size requirements at each level of the hierarchy. We consider two kinds of costs for processing batched items: batch processing cost and unit processing cost. If items in a batch are closely related, they can be processed as a batch simultaneously; hence, a batch processing cost occurs to the batch. On the other hand, if items in a batch are loosely related, they have to be processed separately; hence, a unit processing cost occurs to process each item in the batch. The objective of the problem is to minimize the total cost for processing all items.

#### 2. -Level Batching Problem with Hierarchical Clustering Structure

Now we describe the -level batching problem (NLBP) with agglomerative hierarchical clustering structure considered in this study. The paper develops an integer nonlinear programming model for the NLBP using the notations (see Notations).

An integer nonlinear programming formulation for the NLBP is now presented.

The objective function (1) to be minimized denotes the total processing cost for all batched items. Both of unit processing cost and batch processing cost are involved in the total cost. Constraint (2) balances the number of items to be batched, the number of items batched, and number of items not batched for all hierarchical clusters. Constraint (3) ensures that the total number of items to be batched at any cluster should be equal to the number of items not batched in the clusters at the immediate preceding level. Constraint (4) ensures that there is no remained item not batched until level . Constraints (5)–(7) indicate that items batched at any cluster should satisfy both the minimum and the maximum batch size requirements. Constraints (8)–(10) represent decision variables.

Figure 1 provides an example of a NLBP with and nine original item types: that is, . As shown in the figure, NLBP can be represented as a network flow problem. The network consists of nine source nodes with items to be batched through 3-level batching. That is, there are nine level-1 clusters ( for ) where the first level batches are formed with satisfying both the minimum and the maximum batch size requirements of the clusters at level 1, three level-2 clusters ( for ) where different types of items are batched (for example, four different types of items are batched at cluster), one level-3 cluster where all nine item types can be batched together, and finally one destination node 0. In the network, items are taken out to form batches passed from level-1 clusters to level-3 cluster sequentially with the objective of minimizing total processing costs of batched items. Here, processing costs of batched items, in general, increase as the level of cluster is deeper. Also, the minimum and maximum batch size requirements of clusters may be different. Item quantities to be batched at level () are the total number of items not batched at level .

Lim et al. [15] developed an optimal solution algorithm for a special type of 3-level batching problem that has tapering discount structure in unit processing cost of batched item: that is, for any . In this study, we challenge a more general problem than that of Lim et al. [15] by extending the hierarchical level to and considering more general cost structure for batched items. This paper develops a dynamic programming solution algorithm for the NLBP to obtain an optimal -level batching with hierarchical clustering structure.

#### 3. Dynamic Programming Algorithm for the NLBP

In the dynamic programming algorithm for the NLBP, stage is represented by the level and the state at a stage* n* is the numbers of items of cluster not batched yet until level* n*: that is . Also, possible alternatives at stage are the numbers of items of cluster batched at level* n*: that is, , satisfying the balancing constraints (2)–(4) and the minimum and maximum batch size constraints (5)–(7). First, we give notation used in the DP recursive equations as follows: : the minimum processing cost for batched items during level 1 through* n* when the numbers of items not batched at level are : the processing cost for batched items at level* n* when the numbers of items batched at level are (here, +)The forward DP recursive equations for the NLBP areOptimal objective value for the NLBP is .

It is necessary to reduce the number of states for computational efficiency. We find the range of needed to be considered in the DP recursive equations to find an optimal solution of the NLBP when unit processing cost, , is charged for batched items.

*Property 1. *For a given cluster charged by unit processing cost, , where is as follows:(a)If is an integer, .(b)If is not an integer and , .(c)If is not an integer and , .

*Proof. *Let be the number of items of cluster not batched at level and assume that . In this case (Case ), the maximum processing cost of cluster becomes when is batched at the last level . Here, is the number of items of cluster batched at level with not batched items. Let be the number of items of cluster not batched at level but . Also, let be the number of items of cluster batched at level with not batched items. In this case (Case ), the minimum processing cost of cluster becomes when is batched at the next level . The difference between the maximum cost of Case and the minimum cost of Case is = = = = . As a result, it is better to keep items not batched at level than to keep if . That is, keeping items at level gives less processing cost of batched items if . In other words, it is sufficient to consider to obtain an optimal solution of the NLBP. Here, note that since for all . There are three cases where . The first case is when is an integer. In this case, each batch can contain items and items in each batch can remain not batched. As a result, in this case. The second case is when is not an integer and . We can form batches and items can remain not batched. As a result, in this case. The third case is when is not an integer and . We can form batches and items can remain not batched. As a result, in this case. This completes the proof.

Let be the set of needed to be considered in DP recursive equations to obtain an optimal solution of the NLBP when unit processing cost, , is charged for batched items.

*Property 2. *For a given charged by unit processing cost satisfying , is given as follows. (a)If is an integer, and when whereas when where .(b)If is not an integer and , and when , whereas and when , where .(c)If is not an integer and and , ≤ and when , whereas and when , where .(d)If is not an integer and and , .

*Proof. *It is obvious from Property 1.

The next property gives the range of needed to be considered in the DP recursive equations to find an optimal solution of the NLBP when batch processing cost is charged instead of unit processing cost .

*Property 3. *For a given cluster charged by batch processing cost, it is sufficient to consider in DP recursive equations.

*Proof. *Let be the number of items of cluster not batched at level and assume that . In this case (Case ), the maximum processing cost of cluster becomes (since ) when is batched at the last level . Here, is the number of items of cluster batched at level* n* with not batched items. Let be the number of items of cluster not batched at level but . Also, let be the number of items of cluster batched at level* n* with not batched items. In this case (Case ), the minimum processing cost of cluster becomes (since and ) when is batched at the next level . The difference between the maximum cost of Case and the minimum cost of Case is = since . As a result, it is better to keep items not batched at level than to keep if . That is, keeping items at level gives less processing cost of batched items if . In other words, it is sufficient to consider to obtain an optimal solution of the NLBP.

Let be the set of needed to be considered in DP recursive equations to obtain an optimal solution of the NLBP when batch processing cost, , is charged for batched items.

*Property 4. *For a given charged by batch processing cost satisfying , is given as follows. (a)If is an integer, and when , whereas and when , where .(b)If is not an integer and , and when , whereas and when , where .(c)If is not an integer and and , and when , whereas and when , where .(d)If is not an integer and and , .

*Proof. *It is obvious from Property 3.

Now, we can redefine the forward DP recursive equations as follows:

#### 4. An Example for the Dynamic Programming Algorithm

In this section, we give an example to explain how to solve the NLBP with the DP recursive equations. Note that this example is the same as that given in Figure 1. Problem data is as follows. Here, we assume that all batched items are charged by unit processing cost.Table 1 shows DP calculations at the first stage. Also, the processing cost for batched items at this stage (i.e., level 1) for given () is computed asThe minimum processing cost for batched items to level 1 for given () is computed asAlso, we can define the set of needed to be considered in DP recursive equations to obtain an optimal solution of the NLBP as follows: