# A New Quasi-Human Algorithm for Solving the Packing Problem of Unit Equilateral Triangles

Authors: Ruimin Wang; Xiaozhuo Qi; Yuqiang Luo; Jianqiang Dong
Journal: Abstract and Applied Analysis
 (2014)

---

## Abstract

The packing problem of unit equilateral triangles not only has the theoretical significance but also offers broad
prospects in material processing and network resource optimization. Because this problem is nondeterministic polynomial
(NP) hard and has the feature of continuity, it is necessary to limit the placements of unit equilateral triangles
before optimizing and obtaining approximate solution (e.g., the unit equilateral triangles are not allowed to be rotated).
This paper adopts a new quasi-human strategy to study the packing problem of unit equilateral triangles. Some new
concepts are put forward such as side-clinging action, and an approximation algorithm for solving the addressed problem
is designed. Time complexity analysis and the calculation results indicate that the proposed method is a polynomial
time algorithm, which provides the possibility to solve the packing problem of arbitrary triangles.


---

## Body

## 1. Introduction

The solution of NP hard problem has both popularity and intractability, which is of great value in philosophy of science and real life. Packing problem in two-dimension plane is a typical NP hard issue, which is about how to use the two-dimensional space efficiently. To date, research results show that a complete axiomatic approach is not currently viable. Packing problem of unit equilateral triangles is actually a special case of the two-dimension packing problem. Therefore, researches on the packing problem of unit equilateral triangles are theoretically significant to look for an efficient approximate algorithm for a NP hard issue, especially for a general packing problem. Moreover, researches on the rational distribution of a set of unit equilateral triangles, which do not overlap mutually in a limited region, are extremely useful in practical application. The packing problem discussed in this paper is one of the key issues in the field of CAD/CAM, the task of which is to design a high-performance algorithm to improve the quality of a layout scheme for the purposes of saving raw materials, shortening the construction period, reducing the costs, increasing productivity, and so forth.A classification approach for packing problem has been brought forward by Dyckhoff in 1990 (see, e.g., [1]), and an improved classification method has been proposed by Wäscher et al. in 2007 (see, e.g., [2]). Wäscher et al. have classified the packing problem into four cases, namely, one-dimensional (1D), two-dimensional (2D), three-dimensional (3D), and high-dimensional (n-D) spaces. 1D packing problem only considers one factor, such as weight, volume, or length. 2D packing problem always considers two factors. Some common issues include geographic division of parking lots, trim of packing materials, and leathers. 3D packing problem considers three factors, usually the length, width, and height. For example, three dimensions should not go beyond the set bounds in ship or car loading process. n-D packing problem is always the optimal operation of rectangle packing problem in space and time dimension. Reference [3] can be deemed as a world’s earlier result about n-D packing problem, where the layout feature of rods with n-1 unit sides has been analyzed, but a specific algorithm has not been described. Subsequently, Fekete et al. have published a series of articles to discuss the general n-D packing problem (see, e.g., [4–6]). According to graph theory, a branch-and-bound framework and a tree searching algorithm have been provided based on all kinds of legitimate classifications. Typical examples regarding 1D and 2D spaces are presented, but the situations of 4D or more are not discussed. Moreover, the famous OR-Library and PackLib2 provide only the 2D and 3D packing instances; see [7, 8], respectively.The most common packing problems in daily life include cloth cutting and steel processing. Nowadays, the academia has conducted large number of valuable studies on the 2D and 3D packing problems; see, for example, [9, 10]. 2D packing problem mainly includes circles packing problem, rectangles packing problem, and triangles packing problem. Based on the population control (PERM) strategy and corner-occupying approach, a new hybrid algorithm is proposed to solve the problem of packing equal or unequal circles into a larger circle container in [11]. In [12], a novel computational approach is designed to place n identical nonoverlapping disks into a unit square, by which the radii are maximized. And based on the conjecture, a stochastic search algorithm that displays excellent numerical performance is developed. By elaborately simulating the movement of the smooth elastic disks in the container in the physical world, a heuristic quasiphysical strategy is provided in [13] for solving disks packing problem. Subsequently, based on the simulated annealing, that is, imitating the displacements of the objects under different temperature, the calculation speed is also improved. In [14], a coarse-to-fine quasiphysical optimization method is presented for solving the circle packing problem with equilibrium constraints, where the dense packing of n circular disks satisfying the equilibrium constraints is considered. 3D packing problem is confined primarily to a cuboid packing problem, which mainly includes the block arrangement method [15], spatial representation technique [16], genetic algorithm [17], dynamic space decomposition approach [18], and sequence triplet method [19].In the past decade, the rectangles packing problem has been widely studied by researchers at home and abroad; for instance, a population heuristic is proposed in [20]. An effective deterministic heuristic, namely, the Less Flexibility First strategy, is studied in [21]. A hybrid heuristic algorithm is provided in [22], which is based on the divide-and-conquer and greedy strategies. Unfortunately, to the best of authors’ knowledge, so far, the triangles packing problem and the convex polygons packing problem have not yet been discussed well. In [23], a preliminary study has been conducted on the general triangles packing problem, but further improvement and some indepth studies are required.Therefore, the primary purpose of this paper is to study the packing problem of unit equilateral triangles according to the characteristic of the unit equilateral triangles and in the base of analysis of the general triangles packing problems. The main contribution of this paper can be listed as follows.(i)
A mathematical description of the packing problem of unit equilateral triangles is proposed, and the characteristic and advantage of which are colloquially stated.
(ii)
A reasonable quasi-human strategy is formed according to the natural law of the “like attracts like."
(iii)
A new algorithm for solving the packing problem of unit equilateral triangles is presented based on the proposed quasi-human strategy.


## 2. Problem Formulation

Packing problem of unit equilateral triangles: given one square container whose side isL, if N unit equilateral triangles can be put into the given container, then develop a concrete algorithm accordingly or else provide an opposite answer. Actually, the problem can be formally described as follows. For any given positive integer N and one square container with every side of L, let S
i
j be the overlap area of the ith triangle (△
i) and the jth triangle (△
j). Does there exist the following array of 6
N real numbers? Consider
(1)
A
=
{
x
11
,
y
11
,
x
12
,
y
12
,
x
13
,
y
13
,
x
21
,
y
21
,
x
22
,
y
22
,
x
23
,
y
23
,
…
,
x
N
1
,
y
N
1
,
x
N
2
,
y
N
2
,
x
N
3
,
y
N
3
}
such that
(2)
(
i
)
(
x
i
1
-
x
i
2
)
2
+
(
y
i
1
-
y
i
2
)
2
=
(
x
i
2
-
x
i
3
)
2
+
(
y
i
2
-
y
i
3
)
2
=
(
x
i
3
-
x
i
1
)
2
+
(
y
i
3
-
y
i
1
)
2
=
1
;
0
≤
x
i
1
,
x
i
2
,
x
i
3
,
y
i
1
,
y
i
2
,
y
i
3
≤
L
;
mmmmmmmmmmmmmmlmn
∀
i
∈
1,2
,
…
,
N
,
(
ii
)
∑
i
<
j
‍
S
i
j
=
0
;
∀
i
,
j
∈
1,2
,
…
,
N
.
If there exists one which meets (i) and (ii), then provide the corresponding solution A.Remark 1.
It is important to note that if the givenL is sufficiently large, it is very easy to find the solution constrained by (i) and (ii) to the packing problem of unit equilateral triangles. However, it is not an easy task to put the unit equilateral triangles into the square container quickly, when the given L is relatively small. On the other hand, the packing problem of unit equilateral triangles can be described as follows. Given N unit equilateral triangles, if these triangles can be put into a square container without overlap, then how long should the sides of the square container be at least?
Since figures in a plane can be translated and rotated continuously, there always is an infinite number of ways of layout scheme. Therefore, it is always to limit the placements of the filler when solving the packing problem quickly. The restriction policy in [1] only allows the polygons to translate but not to rotate; thus, the polygons packing problem can be converted into a NP complete problem.Definition 2 (tangency).
For two unit equilateral triangles in a same plane, if they intersect each other, but the overlapping area is zero, then the two triangles are said to be tangent. As shown in Figure1, △
1 and △
2 are tangent to with each other, and △
3 and △
4 are also tangent.Figure 1
Tangent triangles.Definition 3 (angle region).
Given two tangent unit equilateral triangles, for any two sides which are taken from the two triangles, respectively, if all items below are matched:(1)
there is one and only one point of intersection between the two sides, which is denoted byO;
(2)
the angle (letO be the vertex) formed by the two sides is positive, but less than π;
(3)
in the angle of (2), there is on side of the two unit equilateral triangles, except these in (1),then the angle in (2) is said to be angle region of the two tangent triangles. Its size is called the angle of the angle region. The initial side of the angle in (2) is called the initial side of the angle region, and the terminal side of the angle in (2) is the terminal side of the angle region. The intersection in (1) is called the vertex of the angle region.As shown in Figure2, △
A
B
C is tangent to △
D
E
F at A; ∠
B
A
D is an angle region of △
A
B
C and △
D
E
F. Size of the angle region is denoted by ∠
B
A
D. A
B and A
D are the initial and terminal sides of the angle region, respectively.Figure 2
Angle region.To judge whether there is an angle region formed by two tangent unit equilateral triangles, it is just to take out two sides with public vertex from each unit equilateral triangle and judge whether the angle formed by the two sides is positive and less thanπ and verify that there is no other side of the two unit equilateral triangles with the angle. The computational procedure can be realized according to vertex coordinate of the triangle.


## 3. Classification of an Angle Region and Side-Clinging Action

When a unit equilateral triangle is tangent to another unit equilateral triangle, zero, one, or two angle regions may be formed, which is shown in Figures3, 4, and 5(a)–5(c), respectively.Figure 3
Zero angle regions.Figure 4
One angle region.Two angle regions.
(a)
(b)
(c)Based on the long-term production practice of the human society, in order to put some fillers into a given container as much as possible, one always chooses some appropriate fillers which matches the size of the free space in the container first. Then, put these fillers into some relatively stable positions. This so-called stable position cannot be rotated or slide freely.For a unit equilateral triangle, if it can be rotated clockwise or counterclockwise around one of its vertexes, then the unit equilateral triangle is said to be freely rotated or it is said to be restrictively rotated. Let one side of the unit equilateral triangle cling to a side of another; namely, the length of the overlapping part of the two unit equilateral triangles is greater than zero. If the triangle can move along the clinging side in one direction at most, then the unit equilateral triangle is said to be restrictively sliding or it is said to be freely sliding. One point should be noted that unit equilateral triangles cannot intersect others and must always be within the square container.If a side of the unit equilateral triangle△
1 clings to a side of others, then the triangle can only slide along the clinging side, and the position of △
1 is said to be a slidable position. If △
1 slides along the clinging side to cling to a third unit equilateral triangle △
3, where △
1 still clings to △
2, then the position of △
1 is stable. If a unit equilateral triangle can slide or be rotated freely, then it is said to be impending. Obviously, the position of this unit equilateral triangle at the moment is extremely unstable, as △
1 is shown in Figure 6. If a unit equilateral triangle is restrictively sliding but freely rotated, then the position of which is actually unstable, as △
2 is shown in Figure 6. Moreover, if a unit equilateral triangle is restrictively rotated but freely sliding, the position of which is still unstable, as △
3 (which can move left and right), △
4, and △
5 (which do not overlap with side of any triangle) are shown in Figure 6. Generally speaking, the placement of a unit equilateral triangle is stable, only if it is restrictively rotated and restrictively sliding, as △
6 and △
7 are shown in Figure 6.Figure 6
Stability of unit equilateral triangles.In general, the more stable the position of a unit equilateral triangle is, the closer it will cling to other triangles and therefore the higher the space utilization will be.Definition 4 (side-clinging action).
If one side of a unit equilateral triangle clings to an initial or terminal side of an angle region (the overlapping part is greater than zero) and another side of the unit equilateral triangle is tangent to terminal or initial side of the angle region, then the process of putting the triangle into the angle region is said to be a side-clinging action.One can find a side-clinging action in this way. Let the sidea of a unit equilateral triangle cling to the initial side B
A or the terminal side D
A of the angle region ∠
B
A
D and push the side a along B
A
→ or D
A
→ until it cannot move (the triangle is tangent to initial or terminal side of the angle region). If the side a also clings to the initial side B
A or terminal side D
A of ∠
B
A
D, then fix the unit equilateral triangle to the position where it is. Therefore, the problem of putting a unit equilateral triangle into an angle region formed by two given tangent unit equilateral triangles is converted into the positional relationship between a side of the unit equilateral triangle and a line segment; thus, the search space is limited to just a few points from continuous Euclidean space.Definition 5 (side-clinging degree).
If one side of a unit equilateral triangle clings to one side of an angle region (the length isa
1), set the length of overlapping part as b
1, then the side-clinging degree of the side-clinging action is b
1
/
max
(
1
,
a
1
). Specifically, if the other side of the unit equilateral triangle clings to another side (the length is a
2) of the angle region, set the length of overlapping part as b
2, then the side-clinging degree of the side-clinging action is b
1
/
max
⁡
(
1
,
a
1
)
+
b
2
/
max
⁡
(
1
,
a
2
).Remark 6.
Actually, side-clinging degree can be used to measure how well a unit equilateral triangle fits the position which is proposed to be filled. The bigger the side-clinging degree is, the better the triangle will fit.


## 4. The Side-Clinging Algorithm

As shown in Figure7, the square container O
A
B
C can be deemed as a plane figure formed by four equilateral triangles.Figure 7
The square container.Definition 7 (pattern).
A pattern refers to a kind of ordered pair〈
P
,
R
〉 at some points, where P is the set of the four triangles constituting the square container and unit equilateral triangles which has been put in the container (each element in the set is denoted by three vertex coordinates of a triangle) and R is the set of angle regions formed by triangles in P.At the first moment, letN
>
0; and there are four triangles constituting the square container in P; R is the set of angle regions formed by four triangles constituting the square container. Then, initial pattern at this moment is denoted by 〈
P
0
,
R
0
〉. Putting the kth (
0
<
k
≤
N
) triangle into the square container after the initial pattern, then the corresponding pattern is called the kth pattern, which is denoted by 〈
P
k
,
R
k
〉. In the kth pattern, let a triangle perform a side-clinging action; if the triangle is still in the square container and does not intersect any triangle in P
k, then the side-clinging action is considered to be an appropriate side-clinging action.Side-Clinging Strategy. Set the side-clinging degree of two appropriate side-clinging actions (a
1 and a
2) as q
1 and q
2, respectively. If q
1
>
q
2, then priority of the side-clinging action a
1 is higher than a
2.Based on the side-clinging strategy, the quasi-human algorithm for solving a given packing problem of unit equilateral triangles can be presented as follows.Given an initial pattern〈
P
0
,
R
0
〉, where P
0 is the set of triangles constituting a given square container, R
0 is the set of angle regions formed by four triangles constituting a given square container. Arrange angle regions and appropriate side-clinging actions in the pattern according to time sequences.Step 1.
Sett
=
0, S
=
S
t, and the number of the unit equilateral triangles to be put into the container as N
-
t.Step 2.
In the patternS
t, if N
-
t
=
0, then print the information indicating that all the triangles have been put into the square container and stop; if N
-
t
≠
0 and there is no appropriate side-clinging action to be performed, then print that it is failure to obtain the solution and stop; if N
-
t
≠
0 and there are some appropriate side-clinging actions to be performed in S
t, then go to Step 3.Step 3.
Perform the highest-priority side-clinging action according to the side-clinging strategy. If there is only one appropriate side-clinging action based on the side-clinging strategy, then put a unit equilateral triangle into the container according to the side-clinging action or according to the first corner-occupying action.Step 4.
Sett
≤
t
+
1 and add the three-vertex coordinates of the triangle in Step 3 to P
t. Accordingly, R
t represents the set of angle regions formed by triangles in P
t; then, go to Step 2.


## 5. Time Complexity Analysis of the Side-Clinging Algorithm

In general, one can assume that there aren
-
1 unit equilateral triangles that have been put into the container at the pattern 〈
P
,
R
〉; namely, there are n
+
3 triangles in P, and it will take f
(
n
) time units to find and perform the highest-priority side-clinging action with respect to the nth unit equilateral triangle. Sequence of the implementation is as follows.(
1) Time Complexity of Forming Angle Regions by
n
+
3
Triangles in
P. Given triangles, if it will take a time units to judge whether the two sides taken from each triangle can form an angle region, then it will take C
(
3,1
)
×
C
(
3,1
)
×
a
=
9
a time units at most to find the angle region formed by the two triangles. Besides, it is easy to know that it will take C
(
n
+
3,2
)
×
9
a time units at most to find all the possible angle regions formed by n
+
3 triangles in P. According to the definition of angle region, two triangles can form two angle regions at most. Therefore, there will be up to 2
×
C
(
n
+
3,2
) angle regions in R.Remark 8.
In fact, it is impossible that a unit equilateral triangle is tangent to each triangle in the square container. Generally speaking, the number of angle regions formed byn
+
3 triangles is far less than 2
×
C
(
n
+
3,2
). And this is exactly the essential reason for the fast property of the proposed algorithm.(
2) Time Complexity of All the Side-Clinging Actions for Putting the
n
th Unit Equilateral Triangle into All the Angle Regions in
R. Assume that it will take b time units to put a unit equilateral triangle into an angle region, with one side of the unit equilateral triangle clinging to one side of the angle region. Because there are only two different side-clinging actions to be performed while putting a unit equilateral triangle into a given angle region, it will take 2
b time units at most. One can easily find that it will take up to C
(
n
+
3,2
)
×
4
b time units to put a unit equilateral triangle into all angle regions in R.(3) Time Complexity of Judging Whether Every Side-Clinging Action Is an Appropriate Side-Clinging Action. If it will take c
1 time units to judge whether two triangles can intersect each other and c
2 time units to judge whether a unit equilateral triangle is in the square container, then it will take C
(
n
+
3,2
)
×
4
(
(
n
-
1
)
×
c
1
+
c
2
) time units to find all appropriate side-clinging actions.(4) Time Complexity of Finding the Highest-Priority Side-Clinging Action from All the Appropriate Side-Clinging Actions. If it will take d time units to compare the priority of two side-clinging actions, then it will take a maximum of C
(
n
+
3,2
)
×
4
d time units to find the highest-priority side-clinging action.Based on the above analysis, one can know that the maximum time units to put thenth unit equilateral triangle into a square container should be C
(
n
+
3,2
)
×
9
a
+
C
(
n
+
3,2
)
×
4
b
+
C
(
n
+
3,2
)
×
4
(
(
n
-
1
)
×
c
1
+
c
2
)
+
C
(
n
+
3,2
)
×
4
d
=
C
(
n
+
3,2
)
(
9
a
+
4
b
+
4
(
(
n
-
1
)
×
c
1
+
c
2
)
+
4
d
), where a, b, c
1, c
2, and d are constants. Thus, the time complexity of putting the nth triangle is O
(
n
3
), and the time complexity of putting n triangles will be no more than 1
+
2
3
+
3
3
+
⋯
+
n
3
=
(
n
(
n
+
1
)
/
2
)
2, which implies that the time complexity of the designed algorithm is O
(
n
4
). If there is no reasonable side-clinging action to perform, then stop. Thus, the order of magnitude of the total computing time is not more than O
(
n
4
).In the process of solving the packing problem of unit equilateral triangles, we find that some similar packing problems can be solved by experience accumulated in long-term practice. For example, the triangles packing problem is the same as with bricklayers: how to place irregular stones to make the most of the limited space? Based on past experience, they always occupy corners first, then sides and centers. In fact, this idea just provides an arrangement sequence. Inspired by which, we only consider the properties of side-clinging actions for unit equilateral triangles, which can guarantee the compactness of placement method. According to the proposed side-clinging algorithm, an approximation algorithm for solving packing problem of general polygon can be developed in the future.


## 6. Illustrative Examples

This program is developed by using Visual C++6.0. The simulation example is tested on a computer with Pentium 2.8 GHz processor and 1 G of RAM.Inputs:Length of the side of the square container(
±
0.1
);
Number of unit equilateral triangles to be put(
±
0.000001
).Outputs:Utilization(
0
.
1
%
);
Computing time(
±
0.01
sec
);
Sequence of putting unit equilateral triangles into a square container.The simulation results are shown in Figure8, from which we can know that the computing speed of the suggested quasi-human algorithm is polynomial time. However, the size of the square container for placing three unit equilateral triangles is the same as the case of four in some individual examples, indicating that space utilization of the container has yet to be improved. In future research, we will explore how to adjust and improve the quasi-human algorithm to increase the space utilization.Outputs of simulation examples.
(a)
(b)
(c)
(d)
(e)
(f)


## 7. Conclusions and Future Work

In this note, a novel quasi-human algorithm for solving the packing problem of unit equilateral triangles has been proposed. We have categorized angle regions of two tangent triangles based on their position relations. Some concepts and terms have been defined, such as tangency, angle region, and side-clinging action, and the position stability of triangles has been analyzed. According to the side-clinging strategy, an effective quasi-human algorithm has been developed to solve the packing problem of unit equilateral triangles. On the basis of the simulation results, we can find that there is always only one angle region between two successive unit equilateral triangles, and the mount of angle regions can be relatively stable. Thus, search scope of available space for the subsequent triangles can be reduced, which is the root cause of the lower complexity of the suggested quasi-human algorithm.Although the computational results are already very satisfactory, there are still many possible ways that may further improve the proposed quasi-human algorithm, such as the sound fuzzy method; see [24, 25] and references therein. As is well known, networked systems (NSs), complex networks, sensor networks, and multiagent systems are some important systems in daily life, and researches on which have become increasingly active in recent years, primarily due to their wide applications in many fields; see, for example, [26–30]. Naturally, how to apply our quasi-human algorithm to optimize resources in different systems is still a thoughtful issue. For another, disturbance (such as white noise and periodic narrowband noise) and incomplete information (such as data-packet dropouts and missing measurements) inevitably exist in many kinds of systems and networks; see, for example, [31–35], which will undoubtedly influence the feasibility of the suggested algorithm. Therefore, accuracy and robustness of the designed quasi-human algorithm in complicated background are a promising and valuable research direction in the future.



---

*Source: 308474-2014-08-05.xml*