Research Article | Open Access

# Optimized Packing Clusters of Objects in a Rectangular Container

**Academic Editor:**Hong-Yu Wu

#### Abstract

A packing (layout) problem for a number of clusters (groups) composed of convex objects (e.g., circles, ellipses, or convex polygons) is considered. The clusters have to be packed into a given rectangular container subject to nonoverlapping between objects within a cluster. Each cluster is represented by the convex hull of objects that form the cluster. Two clusters are said to be nonoverlapping if their convex hulls do not overlap. A cluster is said to be entirely in the container if so is its convex hull. All objects in the cluster have the same shape (different sizes are allowed) and can be continuously translated and rotated. The objective of optimized packing is constructing a maximum sparse layout for clusters subject to nonoverlapping and containment conditions for clusters and objects. Here the term sparse means that clusters are sufficiently distant one from another. New quasi-phi-functions and phi-functions to describe analytically nonoverlapping, containment and distance constraints for clusters are introduced. The layout problem is then formulated as a nonlinear nonconvex continuous problem. A novel algorithm to search for locally optimal solutions is developed. Computational results are provided to demonstrate the efficiency of our approach. This research is motivated by a container-loading problem; however similar problems arise naturally in many other packing/cutting/clustering issues.

#### 1. Introduction

A two-dimensional packing problem of objects in a container is NP-hard [1]. This problem is typical in logistics (transporting rolls of wallpaper, pipes, boxes, paint buckets, etc.,) and also has important applications in computer science, industrial engineering, manufacturing and production processes, healthcare, project portfolio selection, nanophysics, and agriculture (see, e.g., [2] and the references therein).

Various shapes of objects were studied. In particular, cutting and packing problems for ellipses are presented in [3–6], circular packing problems are investigated in [7–13], and packing problems for convex polygons are considered in [11–16]. Papers [17–21] are devoted to irregular packing involving arbitrary shaped objects.

In many cases the objects are not independent and have to be grouped in a number of certain clusters of nonoverlapping objects. This is typical, for example, for a container loading problem [22], where the objects in a large maritime container may form various clusters according to a type of objects (similar shapes, parts of the same machine). Similarly, clusters can be formed according to a supplier or a client (final destination) to facilitate loading/unloading the container.

While the composition of the cluster (number of objects and their shapes) is typically predefined, the overall shape of the cluster is frequently not specified. Bearing in mind a cluster as a number of objects placed in a flexible sack we define the shape of a cluster as a convex hull of the objects in the cluster. Note that the objects are nonoverlapping and the shape of the cluster (convex hull) depends on the layout of the objects in the cluster.

Throughout this paper it is assumed homogeneous clusters composed of the same shapes (different sizes are allowed). The number of clusters as well as the number of objects and their shapes and sizes is given. The shape of the cluster is represented by the convex hull of the objects in the cluster. A feasible clusters layout has to meet the following conditions: (a) objects in the cluster are mutually nonoverlapping and (b) clusters are mutually nonoverlapping and nonoverlapping with the complement of the rectangular container.

Concerning optimized packing of clusters, different objectives can be used. For example, we may look for the “densest” layout fixing one dimension of the rectangular container and minimizing the other subject to feasibility of the clusters layout. On the contrary, we may fix both dimensions of the container and look for a “sparsest” layout maximizing a certain “distance” between the clusters. This objective is motivated by the need of more space between clusters to facilitate access for their loading/unloading. In this paper the latter approach is used.

To the best of our knowledge the problem of optimized packing for clusters of objects was never considered before. The main contributions of the paper are (1) new formulation of the layout problem for clusters of objects; (2) new mathematical modeling tools for representing nonoverlapping and containment of clusters; (3) novel NLP model for optimized packing of clusters; and (4) new algorithm to get initial feasible solution to accelerate a local optimization procedure.

The paper is organized as follows. In Section 2 a layout problem for clusters of objects is formulated. Section 3 provides nonoverlapping and containment conditions for clusters obtained by phi-function technique. Mathematical model for the optimized layout problem is stated in Section 4. Solution algorithm and numerical experiments are presented in Sections 5 and 6, respectively. Conclusions in Section 7 complete this paper.

#### 2. Problem Formulation

Let be a rectangular domain (a container) and , , be an ordered collection of* convex objects*. Each object is defined by its metrical characteristics. In particular, an ellipse is defined by its semiaxes and , a circle is defined by its radius , and a convex polygon is defined by its vertices , .

The position of the object is characterized by the vector of variable placement parameters , where is a translation vector and is a rotation angle. The center of the object coincides with the origin of its local coordinate system. Rotated by an angle and translated by a vector an object is defined as , where denotes nontranslated and nonrotated object and is a standard rotation matrix.

*Remark 1. *The position of a circle is characterized by the motion vector .

In this paper we define a* cluster of objects* (or simply a* cluster*) as a group of objects having the same shape. The ordered collection of objects , , is divided into clusters , with respect to index sets , and , , where , .

We introduce vectors of* placement parameters of clusters * in the form , and use notation for a cluster that involves moving objects , .

With each cluster we associate the convex hull of objects , , denoted by , .

Throughout this paper the following definitions are used: (1) two clusters and do not overlap each other if their convex hulls and do not overlap, ; (2) a cluster belongs to a container if its convex hull belongs to a container , .

*Cluster Layout Problem CLP.* Arrange the collection of* clusters *, , sufficiently distant one from another into a rectangular container , such that The first constraint assures nonoverlapping of objects within the same cluster and the second guarantees nonoverlapping of clusters, while the third relation presents containment conditions for clusters into .

#### 3. Tools of Mathematical Modeling

In this study, we use phi-function technique as a constructive tool for mathematical modeling of placement constraints within the field of Packing&Cutting (see, e.g., [3, 23–25]). For the reader’s convenience we provide definitions of a phi-function (normalized phi-function) and a quasi-phi-function (normalized quasi-phi-function) in the appendix. In this section we introduce new tools to describe placement constraints (2) and (3) analytically.

##### 3.1. Nonoverlapping of Objects within a Cluster

To describe relation (1) we use phi-functions and quasi-phi-functions for a pair of different shapes of convex objects.

Let us consider two objects and that belong to a cluster , , , .

According to the definition of a phi-function [23], we have that if and only if .

From the main property of a quasi-phi-function [3] it follows that if for some , then , where is a vector of extra variables.

In particular, we provide nonoverlapping tools for a pair of ellipses, circles, and convex polygons.

*Quasi-Phi-Function for Two Ellipses.* Let and be ellipses given by their semiaxes and , with placement parameters and .

A quasi-phi-function for and can be defined aswhere is an auxiliary variable (an angle between a straight line passing through the origin of the global coordinate system and axis ).

*Phi-Function for Two Circles.* Let and be circles given by their radii and with placement parameters and .

A phi-function for and has the form [23]

*Quasi-Phi-Function for Two Convex Polygons.* Let convex polygons and be defined by their vertices , , , , with placement parameters and and let be a half plane.

Based on [26] a quasi-phi-function for and can be derived in the formwhere is a vector of auxiliary variables,is a phi-function for and andis a phi-function for and .

##### 3.2. Nonoverlapping of Clusters

Let us describe analytically the placement constraint (2). To this aim we introduce a quasi-phi-function for two objects and .

Now we consider an extension of the phi-function technique to convex hulls of clusters of objects. Note that convex hull of objects in a cluster has variable shape and variable metrical characteristics that depend on variable placement parameters of objects in the cluster.

Let be a half plane with variable placement parameters .

Proposition 2. *A continuous and everywhere defined function is a quasi-phi-function for and , where is a phi-function of and a half plane , is a phi-function of and the half plane .*

*Proof. *Based on the properties of a quasi-phi-function [3] defined for two convex objects we can conclude that if and only if there exists at least one separated line for some , such that and and therefore for .

Next we define a phi-function of and a half plane in (10) in the formwhere is a phi-function of an object and half plane ,

It follows from the properties of the convex hull of and characteristics of a separating line between two convex objects that

(1) and therefore , for all It implies that .

(2) and therefore there exists at least one object , such that , It implies that .

(3)

and therefore , for all , and there exists at least one object , such that , It implies that .

Thus, the function defined in (11) is a phi-function for and a half plane .

Similarly a phi-function of and a half plane takes the formwhere is a phi-function of object , , and the half plane

Thus, if and only if for each .

Now we can conclude that is a phi-function for and and therefore is a quasi-phi-function for the objects.

It should be noted that a quasi-phi-function is a normalized quasi-phi-function for and (see the appendix for more details). It means that if is the distance between and , defined in the standard way as a minimum Euclidean pointwise distance, then the inequality implies .

*Remark 3. *We do not construct convex hulls of clusters to describe nonoverlapping (2) in our problem.

Further we provide nonoverlapping tools (phi-functions) for a half plane and the following types of objects , : an ellipse ; a circle ; and a convex polygon .*Phi-Function for an Ellipse and Half Plane **.* A phi-function for an ellipse given by its semiaxes and half plane can be defined in the form:*Phi-Function for a Circle and Half Plane **.* The phi-function for a circle given by its radius and half plane is defined in [24] and has the form*Phi-Function for a Convex Polygon and Half Plane **.* The phi-function for a convex polygon given by its vertices , , and half plane is defined in [24] and has the form:

##### 3.3. Containment of Clusters into a Container

Let us derive a phi-function representing analytically the containment constraint (3), for each , where .

Let be a phi-function of objects and ,

Proposition 4. *A continuous and everywhere defined function is a phi-function of and the object .*

*Proof. *We show that if then , .

We assume that , where is a half plane, , , , , and ,

For each half plane we can conclude that

(1) and therefore , for all ;

(2) and therefore there exists at least one object , such that , ;

(3) and therefore , for all , and there exists at least one object , such that ,

Thus, , . It means that if and only if for each .

Now we state by phi-functions containment conditions for the object and the following types of objects , : an ellipse ; a circle ; and a convex polygon .*Phi-Function for an Ellipse Containment.* A phi-function for an ellipse given by its semiaxes and the object can be defined in the form The inequality guarantees that We define the phi-function based on the idea of nonoverlapping of an ellipse and half plane introduced in [5].*Phi-Function for a Circle Containment.* A phi-function for a circle given by its radius and the object has the formThe inequality guarantees that *Phi-Function for a Convex Polygon Containment.* A phi-function for a convex polygon given by its vertices , , and the object has the formThe inequality guarantees that

#### 4. Mathematical Model

A mathematical model for layout clusters of objects in a rectangular domain Ω can be formulated in the formwhere is considered as a distance between convex hulls and , is a vector of placement parameters, , , is a vector of auxiliary variables in a quasi-phi-function of convex hulls and , is vector of auxiliary variables in a quasi-phi-function of objects and , is a quasi-phi-function of objects and , is a phi-function of objects and defined in (17), is a quasi-phi-function of convex hulls and defined in (10), and is the number of the problem variables. is a number of auxiliary variables for a function that describes nonoverlapping constraints for a pair of objects and , , . In particular, for two circles, for two ellipses, and for two convex polygons (see Section 3.1).

*Remark 5. *In the case of two circles and we use a phi-function instead of a quasi-phi-function .

The feasible region given by (22) is defined by a system of inequalities with differentiable functions. Our models (21)-(22) are a nonconvex and continuous nonlinear programming problem. This is an exact formulation in the sense that it gives all optimal solutions to the layout problem.

The models (21)-(22) involve nonlinear inequalities and variables due to the auxiliary variables in quasi-phi-functions.

We develop an efficient approach that employs a new algorithm for generating initial feasible solutions to search for local extrema of problems (21)-(22).

#### 5. Solution Algorithm

Our solution strategy is based on the multistart algorithm and consists of three major stages: (1) generate a set of feasible starting points for the problems (21)-(22); (2) search for a set of local maxima for the problems (21)-(22) starting from each feasible point obtained at Stage (1); (3) choose the best local maxima from those found at Stage (2).

To generate feasible starting points of the problems (21)-(22) we develop a special algorithm** CSPA** (**C**luster** S**tarting** P**oints** A**lgorithm) that involves the following** Steps**.

*Step 1. *With each cluster we associate a circular region with variable center point and variable radius , where is a scaling parameter and , is the area of object , ,

*Step 2. *Then we grow up all circular regions , , within a rectangular container as much as possible, solving the following NLP subproblem:where is a vector of variable placement parameters of circular areas , ;

is a phi-function of circular areas and with center points and and appropriate radii and , , is a phi-function of a circular area and the object , ,We search for a local maximum of problems (23)-(24) starting from a feasible point , where and are randomly generated points. Denote a local maximum point of problems (23)-(24) by .

*Step 3. *Next we derive starting values of variables , (obtained by trivial geometrical calculations); for each quasi-phi-function , in the problems (21)-(22). These variables are considered as parameters of separating lines between each pair of circular areas and of radii and with center points and , .

*Step 4. *Then we search for feasible points of the problems (21)-(22) solving the following NLP subproblem:where , , , and ; is a scaling parameter of our objects; is a vector of auxiliary variables in a quasi-phi-function of objects and ; is a quasi-phi-function of objects and ; is a phi-function of objects and ; is a quasi-phi-function for two clusters defined in (10); is the number of the problem variables, and is the number of auxiliary variables.

We use a feasible starting point to solve the problems (27)-(28), where is obtained at Step 3; is a vector of random generated translation parameters and is a randomly generated rotation parameter of object for , ; , and a vector of auxiliary variables is found from the trivial geometrical calculations depending on the object shape (except circles) such that . In particular, for two ellipses and for two convex polygons (see Section 3.1).

Global maximum of the problems (27)-(28) (i.e., ) provides a feasible solution of the problems (21)-(22). A point of global maximum can be used as a starting point to search for local maximum of the problems (21)-(22).

*Remark 6. *Application of the decomposition algorithm described in [3] is recommended to solve the problem (21)-(22), when for clusters , , in order to reduce the computational costs (time and memory).

#### 6. Computational Results

Here we present a number of examples to demonstrate the efficiency of our methodology. We have run all experiments on an AMD FX(tm)-6100, 3.30 GHz computer, Programming Language C++, Windows 7. For the local optimisation we use the IPOPT code https://projects.coin-or.org/Ipopt), developed in [27]. Default options were used for running this software.

We present our new instances for the layout problem in a rectangular container . We run our program 100 times for each example.

*Example 1. *An ordered collection of ellipses is given. The collection of ellipses is divided into clusters , , , and

All ellipses are defined by their sizes = (2.0 1.5), (1.8 1.5), (1.6 1.5), (1.5 1.2), (1.3 1.0), (1.2 0.9), (1.1 0.8), (1.0 0.75), (0.9 0.6), (0.8 0.5), (0.7 0.3), (2.0 1.5), (1.8 1.5), (1.6 1.5), (1.5 1.2), (1.3 1.0), (1.2 0.9), (1.1 0.8), (1.0 0.75), (0.9 0.6), (0.8 0.5), (0.7 0.3), (2.0 1.5), (1.8 1.5), (1.6 1.5), (1.5 1.2), (1.3 1.0), (1.2 0.9), (1.1 0.8), (1.0 0.75).*Our Result**Placement Parameters of Ellipses. * = (10.469949 12.267537 2.244218), (7.279733 12.352075 2.063582), (2.471444 12.548774 13.249926), (8.464111 9.691723 0.145847), (12.920038 11.433172 5.530417), (4.909339 12.890715 1.640578), (4.716335 10.894489 0.195532), (13.092110 13.335890 6.393843), (10.806375 9.993924 -0.401328), (6.267221 10.149879 6.032813), (0.813462 5.582920 1.582319), (2.129866 4.016161 2.043699), (4.516627 2.106510 5.713416), (2.014535 8.617626 4.606157), (5.875381 7.080877 1.710554), (5.246435 4.663067 0.181324), (3.712908 6.439680 3.845887), (1.613133 1.313706 6.313737), (4.250763 8.301450 4.942235), (1.768064 6.435263 0.065954), (13.527926 1.206001 2.906999), (10.087641 4.308896 2.501728), (12.390656 5.699737 2.716022), (8.409176 2.472279 4.931800), (9.003824 5.818192 1.638294), (13.004545 2.937130 5.336177), (13.095024 8.392657 -0.572537), (10.944860 1.726727 0.720864), (10.969680 7.572605 5.373848), (10.898378 3.513018 -0.101262).

The value of objective function is = 2.109291, while the computational time is 7131.446 sec.

Corresponding optimized layout is presented in Figure 1.

*Example 2. *An ordered collection of circles is given. The collection of circles is divided into clusters , , , , and .

All circles are defined by their radii:

= (1.495), (1.500), (1.501), (1.206), (1.009), (0.912), (0.815), (0.765), (0.621), (0.524), (0.336), (1.550), (1.533), (1.512), (1.239), (1.042), (0.945), (0.848), (0.7925), (0.654), (0.557), (0.380), (1.605), (1.566), (1.523), (1.272), (1.075), (0.978), (0.881), (0.820), (0.687), (0.590), (0.424), (1.660), (1.599), (1.534)*Our Result**Placement Parameters of Circles. *=(13.089089 1.910911), (9.282866 1.915911), (11.652953 4.566297), (13.378089 7.152616), (9.147148 4.421237), (11.269926 6.948703), (9.688888 6.189878), (13.819089 5.231585), (13.954597 3.846912), (11.189529 2.595038), (3.381819 14.237068), (4.209528 11.030014), (6.318116 8.780847), (1.927911 13.072089), (2.506044 8.821697), (6.003824 12.979437), (1.360911 10.681408), (6.604792 11.144527), (4.222026 13.460604), (4.247002 8.078382), (3.849810 0.972911), (4.971098 4.766312), (5.740826 2.020911), (1.981911 1.981911), (1.938911 5.681867), (6.544523 5.269738), (3.814234 3.883877), (4.418702 6.006885), (13.509939 9.758354), (11.287589 11.489670), (11.993830 10.158402), (13.994089 11.147396), (11.771968 9.049173), (9.264512 12.924089), (9.777002 9.600308), (13.050089 13.050089).

The value of objective function is , while the computational time is 484.461sec.

Corresponding optimized layout is presented in Figure 2.

*Example 3. *An ordered collection of objects is given. The collection of ellipses is divided into clusters , circles, circles, ellipses, and ellipses.

All circles are defined by their radii:

=(1.5), (1.5), (1.5), (1.2), (1.0), (0.9), (0.8), (0.75), (0.6), (0.5), (0.3), (1.5), (1.5), (1.5), (1.2), (1.0), (0.9), (0.8), (0.75), (0.6)

All ellipses are defined by their semi axes:

=(0.8 0.5), (0.7 0.3), (2.0 1.5), (1.8 1.5), (1.6 1.5), (1.5 1.2), (1.3 1.0), (1.2 0.9), (1.1 0.8), (1.0 0.75), (0.9 0.6), (0.8 0.5), (0.7 0.3), (2.0 1.5), (1.8 1.5), (1.6 1.5).*Our Result**Placement Parameters of Circles. *=(5.969333, 5.831559), (1.910221, 4.910224), (1.910221, 1.910223), (4.593503, 1.610221), (3.633171, 6.721701), (3.920715, 3.599532), (5.620213, 3.558210), (1.160222, 7.031545), (4.001869, 5.097335), (6.120123, 2.358173), (11.629726, 8.900163), (13.089779, 13.089779), (13.089779 10.089779), (8.950916, 11.115733), (10.406497,13.389779), (7.836995, 8.063426), (9.688425, 8.490281), (10.812773, 9.765367), (11.294872, 11.568861), (7.474932, 9.621922). *Placement Parameters of Ellipses. *=(11.912729 0.916670 9.295412), (10.183793 0.775760 -0.039353), (9.620035 5.473407 -0.639827), (11.012582 2.782653 -3.922661), (12.998276 6.515842 -3.441852), (8.195878 1.909350 1.627631), (13.574899 3.775017 13.927174), (13.533974 1.475715 3.943306), (4.818922 13.635480 -0.705039), (6.200920 12.630733 3.035222), (6.736535 13.971098 -0.026565), (3.486483 11.514966 5.442422), (4.430982 12.359577 0.186450), (4.973013 10.072013 -1.233481), (2.113962 12.981281 2.518350), (1.910433 9.773977 17.233423).

The value of objective function is = 0.410222, while the computational time is 1344.9 sec.

Corresponding optimized layout is presented in Figure 3.

*Example 4. *An ordered collection of objects is given. The collection of objects is divided into clusters , ; circles, circles, ellipses, and ellipses.

All circles are defined by their radii:

=(1.625), (1.575), (1.525), (1.275), (1.075), (0.975), (0.875), (0.8125), (0.675), (0.575), (0.400), (1.625), (1.575), (1.525), (1.275), (1.075), (0.975), (0.875), (0.8125), (0.675)

All ellipses are defined by their semi axes:

=(0.8 0.5), (0.7 0.3), (2.0 1.5), (1.8 1.5), (1.6 1.5), (1.5 1.2), (1.3 1.0), (1.2 0.9), (1.1 0.8), (1.0 0.75), (0.9 0.6), (0.8 0.5), (0.7 0.3), (2.0 1.5), (1.8 1.5), (1.6 1.5).*Our Result**Placement Parameters of Circles. * = (5.025933 1.876324), (1.826324 1.826324), (3.974219 6.518053), (6.563760 7.583078), (3.350845 3.993889), (1.451364 5.929808), (6.228908 4.078766), (1.109501 4.136463), (6.051897 5.654399), (4.881146 4.620133), (2.547234 11.199363), (1.876324 13.109992), (1.826324 9.360637), (7.011083 11.353004), (4.211329 11.390181), (8.183466 13.673676), (4.390190 13.773676), (6.234106 13.623755), (4.213121 9.302682), (5.668491 9.610177).*Placement Parameters of Ellipses. * = (11.954503 13.951223 14.239492), (11.755667 12.554007 2.556380), (9.866202 7.871985 -11.985510), (13.200316 7.946103 4.316218), (11.218788 10.594559 -25.265057), (13.543329 13.252969 -23.435600), (10.483036 13.231361 1.774510), (13.776518 10.616527 16.797305), (8.189442 2.594354 -21.480649), (7.771967 1.076809 22.539607), (14.052522 1.182705 20.790155), (9.223332 1.011216 -8.266075), (14.056688 2.541830 -19.537970), (11.441889 1.774003 -12.367135), (12.971454 4.412810 -15.416986), (9.596560 4.458588 44.002983).

The value of objective function is , while the computational time is 1285.73 sec.

Corresponding optimized layout is presented in Figure 4.

*Example 5. *An ordered collection of objects is given. The collection of objects is divided into clusters , : convex polygons, circles, ellipses, and ellipses.

All polygons are defined by their vertices: