A Taboo-Search Algorithm For 3D-Binpacking

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

A Taboo-Search Algorithm for 3D-Binpacking

Problem in Containers

Paul Leon1, Rony Cueva1, Manuel Tupia1(&),


and Gonçalo Paiva Dias2
1
Department of Engineering, Pontificia Universidad Catolica del Peru,
Avenida Universitaria 1801, San Miguel, Lima, Peru
{andres.leonm,tupia.mf}@pucp.edu.pe, cueva.r@pucp.pe
2
ESTGA/GOVCOPP, Universidade de Aveiro,
Rua Comandante Pinho e Freitas, 28, 3750-127 Águeda, Portugal
gpd@ua.pt

Abstract. One of the biggest challenges facing by logistics companies is the


packing of fragile products in containers. These activities, due to the nature of
the packaged products, can entail great risks for the company due to the possible
losses and the cost of the transporting containers, so-called in literature as bin-
packing problem. Being this problem of a complex computational nature (NP-
hard), companies do not have exact technological solutions to establish a
positional sequence of the packages that have to be arranged in containers,
considering aspects such as fragility, weight, volume, among other aspects. In
most cases only the volume and order of dispatch is considered. The application
of bio-inspired techniques such as metaheuristics are an appropriate way to
obtain approximate solutions to this kind of problems, without the difficulties of
complex software implementations. In previous works of the authors, bio-
inspired algorithms have been developed to solve the problem and in this paper
a taboo-search algorithm is proposed to solve the 3D-bin packing variant, which
has been compared with the previous algorithms obtaining approximately a
waste reduction of 28%. Fundamentally, research has used real data from
Peruvian ceramic industry.

Keywords: Bin packing problem  Taboo search  Genetic algorithm 


Metaheuristic

1 Introduction

A key aspect to become successful in the current trading market is properly managing
product’s logistics and storage. Last years’ trend follows the path of companies whose
advantage lies in the capacity of conducting international shipments with a great
number of products. Hence, the efficiency in the capacity of transportation is a
mandatory requirement for sales companies to maintain or increase their share in the
market [1]. Created in 1956, containers are used as a transportation and packaging
cargo unit for commercialization of different products. They have evolved to such an
extent that even ships have been built with the specific purpose to carry containers [2].
Companies around the world considered containers the ideal method of delivering the
© Springer Nature Switzerland AG 2019
Á. Rocha et al. (Eds.): WorldCIST'19 2019, AISC 930, pp. 229–240, 2019.
https://doi.org/10.1007/978-3-030-16181-1_22
230 P. Leon et al.

goods to clients because of reduced time in cargo transit, more safety (in the sense of
integrity and protection of the products that are sent in the containers) and above all
lower costs.
Despite the benefits from the use of containers, sales companies have got into
troubles in optimizing the space used within these transport units mainly due to the fact
that the order and distribution of packages placed into containers is inadequate since
weight, shape, volume of these items are not taken into account. The problem gets
worse when personnel involved lacks the knowledge or training required to conduct
the tasks at hand [3]. Therefore, proposing an order of placement of packages within
the container with the aim of optimizing the space used in them, becomes the main
hurdle for this research, since the solution will allow transporting more packages—in a
safe way—in less numbers of containers and minimizing faults or fractures in fragile
products during transport [12, 14]. Eventually, this will result in reduced transportation
costs per container incurred by the company, as costs are related to the number of
containers to be used. In the bibliography this problem is known as the 3D Bin Packing
Problem. This is a combinatorial optimization problem focused on maximizing the
space used by objects within a restricted space, e.g., a container. Objects are placed
following certain boundaries to achieve the proposed objective. This problem increases
its computational complexity in a non-determinist polynomial time while variables
such as the number of objects or their sizes differ, that is why it is called NP-hard (a
term to describe the set of problems that is at least as hard as the hardest problem that
can be solved in a polynomial time [4]).
Because of this complexity, exact algorithms cannot solve 3D packaging scenarios,
nor may consider many restrictions. It is necessary to use approximate algorithms to
solve these situations. In this field, it is that metaheuristic algorithms such as bio-
inspired ones, can yield sufficiently good and computationally economical solutions to
implement in software [13].
For this research the design and construction of a metaheuristic algorithm delivering
a solution to the above said problem are proposed. Likewise, the taboo-search algorithm
has shown to be capable of providing very good results in combinatorial optimization
problems [5]. On this premise, an algorithm previously used in the literature will be built
to compare its results with those obtained by the algorithm proposed on this project,
using mainly data from Peruvian companies producing ceramic for bathrooms and
kitchens, which must export their products transnationally both by sea and land.
In this paper it is to find the following structure: a brief introduction to the taboo-
search in Sect. 2; algorithms proposed in Sect. 3; numerical experimentation in Sect. 4;
to end with the conclusions in Sect. 5.

2 Taboo Search Algorithm

The authors have developed previous works related to the variants of the bin packing
problem, developing several metaheuristics (GRASP, Genetic algorithm, memetic,
algorithm, among others) being the genetic algorithms those that have obtained the best
results for 3D scenarios [9–11]. The main motivation of this investigation is to verify if
Taboo-search algorithm can surpass the previously calculated results. This is a kind of
A Taboo-Search Algorithm for 3D-Binpacking Problem in Containers 231

metaheuristic algorithm that tries to solve optimization problems. Its main character-
istic is that it relies on a specific heuristics to prevent areas of the search space recently
visited from being visited again. This characteristic is called short-term memory and is
represented by a taboo list of specific size, with this structure storing the most recent
moves and marking them as moves forbidden for the following n iterations. Through
this heuristic, the taboo search avoids being stuck in a cyclic state, i.e., it escapes local
optima while approaching global optima [6, 7].
It can be considered a better alternative to other types of heuristic and bio-inspired
algorithms due to the ease of implementation and the low computational cost. In
Table 1, appears the pseudo code of the TSA:

Table 1. The taboo search algorithm (TSA)

Input: Iterations, InitialSolutions, ListSize, NeighborhoodSize


Exit: Solution
1. BestSolution = InitialSolution
2. Iteration = 0
3. TabooList = { }
4. Whereas (StoppingCondition)
4.1 Neighborhood = GenerateNeighborhood(BestSolution,Iteration)
4.2 BestNeighbor = FindBestSolution(Neighborhood)
4.3 If ( TabooListDoesNotContain(BestNeighbor) And Fitness(BestNeighbor)
> Fitness(BestSolution) )
4.3.1 BestSolution = BestNeighbor
End If
4.4 If ( TabooListSize == ListSize )
4.4.1 RemoveLast(TabooList)
End If
4.5 AddTabooList(BestNeighbor)
4.6 Iteration = Iteration + 1
End Whereas
5. Return BestSolution

3 Contribution
3.1 Brief Discussion About State of Art of the Problem
Three different approaches have been found in the literature for solutions to the
problem [15, 16]:
• Optimization of container filling for multimodal transport
• Hybrid approach between linear programming with heuristics
• Minimization of wasted warehouse space
232 P. Leon et al.

This allows perceiving that the resolution of the problem in 3D scenarios has been
based on hybrid solutions -between the use of exact and approximate methods- that
minimize the loss of spatial volume inside containers. When reviewing the most
commonly used approximate methods, there are some tools that provide an alternative
solution to the problem of waste of container space, but these tools only consider the
space used and no other important factors such as the distribution of weight and
fragility of objects.

3.2 Objective Function for Taboo-Search Algorithm


With the aim of placing the largest number of boxes in each container, the function
attempts to find the exact points within these containers to place the boxes. The volume
of the box to be placed is an important attribute to consider since a lot of restrictions of
this problem are related to each box’s own characteristic. This importance may be
reflected in the following objective function formalization:
PN 1
PM
i¼1 Ci j¼1 Vj x kji
Max
N

Where:
N: Number of containers used.
M: Number of boxes in total.
Vj: Volume of box j.
Kji: Indicates if box j is placed in container i (it can only have the value 0 or 1).
Ci: Capacity of container i.
To test the validity of the objective function, the following test case is presented in
an extreme situation. There are two solutions, the first one has 3 containers with a box
inside each one; the second one has a container with 3 boxes inside. If we consider that
the boxes have a volume of 20 “cubic” units and the containers, a capacity of 100
“cubic” units, it can be raised:
     
20  100
1
þ 20  100
1
þ 20  100
1
First solution ¼ ¼ 0:2
3
1
ð20 þ 20 þ 20Þ  100
Second solution ¼ ¼ 0:6
1

3.3 Rotations and Positioning of Boxes


Here are some of the most important restrictions to consider when developing the
problem. First restriction is crucial to understand how the boxes will be positioned
A Taboo-Search Algorithm for 3D-Binpacking Problem in Containers 233

within containers. Usually, a box can be placed in more than one manner as can be seen
in the following figure [8] (Fig. 1):

Fig. 1. Rotations of a box

Second restriction is limit of the walls of the container: this one indicates that none
of the boxes placed can exceed the limits of the container, that is, all the boxes must be
inside it. Last restriction is weight limit: this one is directly related to the intrinsic
fragility factor of the boxes. It specifies that each box can only have a specific weight
limit above.

3.4 Data Structure for Algorithms


This chapter introduces data structures mentioned in the objectives, which will be used
in both algorithms. It is worth mentioning that these structures will be the same for both
but will be treated in a different manner for each of the algorithms.
Container: As an international standard will be applied, all containers used will
have the same dimensions: Height, Width, Length and Volume.
Box: This structure is the main part of the solution because it will not only consider
boxes’ dimensions but will also indicate the coordinates where the box is placed within
the container and the rotation that has been used: Height, Width, Length and Volume,
and Position X, Position Y and Position Z that represent the point in the X, Y or Z axis
where the box is placed.
Rotation: As each box can be placed in different positions in a same point by
rotating such box on its own axes, a structure that considers this concept is required.
Solution: As its own name suggests, this structure will represent the solution
generated, which will contain a list of all boxes placed in each container and the
extreme points present within:
• List of boxes: represents all the boxes placed in the container.
• List of extreme points: represents all the remaining extreme points after generating
the solution.
234 P. Leon et al.

3.5 Pseudocode of Genetic Algorithm


In the next sections, the pseudocodes of the proposed algorithms will be presented. It
begins by presenting the genetic algorithm in Table 2.

Table 2. Genetic algorithm

Input: PopulationSize, Generations, MutationProb, CrossOverProb


Output: BestSolution
1. Population = GenerateInitialPopulation()
2. BestSolution = FindBestSolution(Population)
3. Whereas (StopCondition)
3.1 Parents = SelectParents(Population, PopulationSize)
3.2 Children = ReproduceParents(Parents, PopulationSize, Mutationprob,
CrossOverProb)
3.3 Children_BestSolution = FindBestSolution(Children)
3.4 If ( Fitness(Children_BestSolution) > Fitness(BestSolution.Fitness) )
3.4.1 BestSolution= Children_BestSolution
End If
3.5 Population = Children
End Whereas
4. Return BestSolution

3.6 Pseudocode of Taboo-Search Algorithm


Like in previous section and Tables 1, 2 and 3 shows pseudo code of TSA:
Within this pseudocode, there are four functions (line 4.1, line, 4.2, line 4.4.1 and
line 4.5), but only two, “GenerateNeighborhood” and “RemoveLast”, will be specified,
since function “FindBestSolution” was detailed in the previous chapter and
“AddTabooList” only adds a solution to a list of solutions called “TabooList”.
Finally, it is worth mentioning that both “ConditionCombination” and
“SizeNeighborhood”, in lines 3 and 3.1, respectively, are parameters entered as global
variables for all the algorithm, these parameters indicate the condition that must be met
to conduct the combination and the number of neighbors to be generated by neigh-
borhood, respectively.
A Taboo-Search Algorithm for 3D-Binpacking Problem in Containers 235

Table 3. The taboo search algorithm proposed

Input: Iterations, InitialSolutions, ListSize, NeighborhoodSize


Exit: Solution
1. BestSolution = InitialSolution
2. Iteration = 0
3. TabooList = { }
4. Whereas (StoppingCondition)
4.1 Neighborhood = GenerateNeighborhood(BestSolution,Iteration)
4.2 BestNeighbor = FindBestSolution(Neighborhood)
4.3 If ( TabooListDoesNotContain(BestNeighbor) And Fitness(BestNeighbor)
> Fitness(BestSolution) )
4.3.1 BestSolution = BestNeighbor
End If
4.4 If ( TabooListSize == ListSize )
4.4.1 RemoveLast(TabooList)
End If
4.5 AddTabooList(BestNeighbor)
4.6 Iteration = Iteration + 1
End Whereas
5. Return BestSolution

Table 4. Algorithms results


Sample Genetic algorithm results Taboo search algorithm results
1 0.862351701350831 0.868905212716766
2 0.859659925914651 0.859659925914651
3 0.852777447283593 0.852777447283593
4 0.84968569449088 0.84968569449088
5 0.848484693392605 0.848484693392605
21 0.838743194496973 0.848570362470513
22 0.838610380146598 0.838610380146598
23 0.838360825649067 0.841123372999282
24 0.838320390885628 0.838320390885628
25 0.837857149741339 0.845669846722336
26 0.837607010878392 0.842349033764246
27 0.837453369855341 0.837453369855341
28 0.836870289488535 0.836971786283775
29 0.836569676408897 0.839018173044392
30 0.836426227161836 0.836426227161836
236 P. Leon et al.

4 Numeric Experimentation

To obtain the results sought, both algorithms were run 55 times with different samples.
It should be mentioned that as standards size containers are used, the tests were con-
ducted with same size containers.

4.1 Algorithms Results


Below are the results obtained from the algorithms run. These results contain fitness
values of each solution found, which represent the objective function mentioned in
previous chapters.
Below are the results displayed within the interface created (Fig. 2):

Fig. 2. Interface of algorithms results

Where volumes are represented in percentages and run time in milliseconds.


Likewise, all the boxes and their respective measurements, along with the container in
which they were placed, are indicated.

4.2 Kolmogorov-Smirnov Test


As mentioned in the introduction, this test will be used to prove that the results of
algorithms, i.e. fitness of each solution found, follow a normal distribution, which is an
indispensable requirement to be able to run the Z test. Usually, hypotheses for this test
are that the data analyzed follow a certain distribution. For this case, the following
hypotheses area considered:
• H0: algorithm results follow a normal distribution.
• H1: algorithm results do not follow a normal distribution.
A Taboo-Search Algorithm for 3D-Binpacking Problem in Containers 237

These hypotheses will be advanced for both algorithms in such a way that there will
be sufficient evidence to conclude that one of the two hypotheses is true.

4.2.1 Test for Genetic Algorithm


With the aim of proving that the genetic algorithm results follow a normal distribution,
the following values were calculated:
• Mean of results: 0.8373238.
• Standard deviation of results: 0.008056261.
Then, with the assistance of R Studio, considering a 5% significance, the
Kolmogorov-Smirnov test was obtained:
• P-value: 0.1968.
As P-value obtained is higher than 0.05, the null hypothesis is accepted, and it is
concluded that genetic algorithm results follow a normal distribution (Fig. 3).

Fig. 3. Genetic algorithm results

4.2.2 Test for Taboo Search Algorithm


With the aim of proving that the genetic algorithm results follow a normal distribution,
the following values were calculated:
• Mean of results: 0.8419255.
• Standard deviation of results: 0.008761028.
Then, considering a 5% significance, the Kolmogorov-Smirnov test was obtained:
• P-value: 0.4315.
As P-value obtained is higher than 0.05, the null hypothesis is accepted, and it is
concluded that genetic algorithm results follow a normal distribution (Fig. 4).
238 P. Leon et al.

Fig. 4. Taboo algorithm results

4.2.3 Fisher F Test


This statistical test is intended to verify that variances of algorithm results are homoge-
nous since this is required to be able to conduct the Z test. This test can be applied to
different statistics; however it is most often used to check that variances of samples taken,
in this case, of the algorithm results are considerably homogenous or otherwise consid-
erably different. Therefore, the following hypotheses for both algorithms are considered:
• H0: The variances of algorithm results are considerably homogenous.
• H1: The variances of algorithm results are considerably different.
With the aim of proving that the variances of algorithm results are homogeneous
the Fisher F Test was run. In this test, the following result was obtained:
• P-value: 0.5398
As the P-value obtained is higher than 0.05, the null hypothesis is accepted con-
cluding that variances of algorithm results are considerably homogeneous.

4.2.4 Z Test
Since this test will be used to compare the means of both algorithms results, this is ideal
to be able to determine which of the two delivers the best solutions and then reach a
final conclusion.
In order to compare both means, it is first necessary to prove these are considerably
different. After verifying this, the test may be run to determine which of the two means
is the lowest and hence finally conclude which algorithm showed a better performance.
For the first test (two tails) the following hypothesis are proposed (Table 5):
• H0: the means of algorithms results are considerably homogeneous.
• H1: the means of algorithms results are considerably different.
For the second test (one tail) the following hypotheses are proposed:
• H0: the mean of taboo search algorithms results is lower than the mean of genetic
algorithms results.
• H1: the mean of taboo search algorithms results is higher than the mean of genetic
algorithms results.
A Taboo-Search Algorithm for 3D-Binpacking Problem in Containers 239

Table 5. Z test results


Genetic algorithm Taboo search algorithm
Mean 0,837323812 0,841925455
Variance (known) 6,49034E-05 7,67556E-05
Observations 55 55
Hypothetical difference of means 0
Z −2,86729349
P(Z <= z) one tail 0,002069994
Critical value of z (one tail) 1,644853627
Critical value of z (two tails) 0,004139989
Critical value of z (two tails) 1,959963985

4.2.5 Results for the Two-Tailed Test


With the purpose of accepting or rejecting the null hypothesis of the two-tailed test, it is
verified if the value of “Z” found is between −1,959963985 and +1,959963985 (values
representing the interval outside the critical area). In this case, the value “Z” is found in
the critical area, hence it can be stated that there is sufficient evidence to reject the null
hypothesis, i.e., the means of the genetic algorithms results and the taboo search
algorithms results are considerably different.

4.2.6 Results for One-Tailed Test


Thanks to the results of the two-tailed test, the one-tailed test can be continued. For this
test, the value of “Z” should be compared with the critical value of one tail, in this case,
−1,644853627. As the value of “Z” found is −2,86729349, this is situated in the critical
area so that it may be concluded that there is enough evidence to reject the null
hypothesis, that is to say, the mean of the taboo search algorithm results is higher than
that of the genetic algorithm.
Finally, it might be concluded that the taboo search algorithm produces better
results than the genetic algorithm to optimize the space used in the filing of containers.

5 Conclusions

First, we can conclude that the objective function proposed was easily accommodated
to the development of algorithms, since the solutions provided by these contain all the
components that are part of the function. Likewise, it was noted that the objective
function met its purpose, which is determining if a solution is better than the other.
Second, both algorithms were correctly adapted to the optimization problem of the
space used in containers. Both the genetic algorithm and the taboo search algorithm
provided the expected solutions.
Third, through the numeric experimentation, it can be inferred that the taboo search
algorithm delivers better results than the genetic algorithm. This is due to the fact that
the working mode of the search taboo algorithm lays emphasis on the continuous
search for the global optimum avoiding repetition in local optima. On the other hand,
240 P. Leon et al.

the genetic algorithm is only based on inheriting the best solutions and trying to
improve them iteration after iteration, which can result in a local optimum. However, as
can be seen in results shown in Table 4, the taboo search algorithm results are not very
different from those of the genetic algorithm. This is because boxes’ measures intro-
duced in containers do not vary considerably in size and so the solutions found will
hardly be any different.
Finally, it should be mentioned that although this research is focused on finding a
solution to the problem of containers, the algorithms proposed may be applied to other
type of deposits such as warehouses, shelving, railway wagons, and so on.

References
1. Liang, S., Lee, C., Huang, S.: A hybrid meta-heuristic for the container loading problem.
Commun. Int. Inf. Manag. Assoc. 7(4), 73–84 (2007)
2. Tiba Group. http://www.tibagroup.com/mx/mclean-y-la-caja-que-cambio-la-historia-del-
comercio. Accessed 05 Sept 2017
3. Jiménez, J., Jiménez, J.: Cubicaje: distribución a bajo costo. http://www.logisticamx.enfasis.
com/articulos/72752-cubicaje-distribucion-costo. Accessed 12 Sept 2017
4. Garey, M., Johnson, D.: Computers and Intractability. A Guide to the Theory of NP-
Completeness. W. H. Freeman and Company, New York (1979)
5. Werra, D., Hertz, A.: Taboo search techniques. Oper.-Res.-Spektrum 11(3), 131–141 (1989)
6. Glover, F.: Taboo search—part I. ORSA J. Comput. 1(3), 190–2016 (1989)
7. Brownlee, J.: Clever Algorithms: Nature-Inspired Programming Recipes. Lulu, Australia
(2011)
8. Xuehao, F., Ilkyeong, M., Jeongho, S.: Hybrid genetic algorithms for the three-dimensional
multiple container packing problem. Flex. Serv. Manuf. J. 27(2), 451–477 (2013)
9. Tupia, M., Cueva, R., Guanira, J.: A bat algorithm for job scheduling problem in ceramics
production lines. In: International Conference on Infocom Technologies and Unmanned
Systems (ICTUS 2017), pp. 47–53. Amity University Dubai and IEEE India, Dubai (2017)
10. Pizarro, A., Cueva, R., Tupia, M.: Implementation of a genetic algorithm to optimize the
distribution of water in irrigation of peruvian farmland affected by “El Niño”. In: 31st
International Conference on Computers and their Applications (CATA 2016), pp. 31–38.
International Society for Computers and Their Applications (ISCA), Las Vegas (2016)
11. Meneses, S., Cueva, R., Tupia, M., Guanira, J.: A genetic algorithm to solve 3D traveling
salesman problem with initial population based on a GRASP algorithm. J. Comput. Methods
Sci. Eng. 17(1), 1–11 (2017)
12. Viegas, J., Vieira, S., Henriques, E., Sousa, J.: A tabu search algorithm for the 3D bin
packing problem in the steel industry. Lecture Notes in Electrical Engineering, vol. 321,
pp. 355–364 (2015)
13. Ren, R.: Combinatorial algorithms for scheduling jobs to minimize server usage time.
Doctoral thesis, Nanyang Technological University, Singapore (2018)
14. Hawa, A., Lewis, R., Thompson, J.: Heuristics for the score-constrained strip-packing
problem. Comb. Optim. Appl. 11346, 449–462 (2018)
15. Crainic, T., Perboli, G., Tadei, R.: Extreme point-based heuristics for three-dimensional bin
packing. INFORMS J. Comput. 20, 368–384 (2008)
16. Hifi, M., Kacem, I., Negre, S., Wu, L.: Heuristics algorithms based on a linear programming
for the three-dimensional bin-packing problem. IFAC Proc. Volumes 43, 72–76 (2010)

You might also like