Optimal Packing Solution: Naman Shah, Nitya Maheshwari and Neha Sehta
Optimal Packing Solution: Naman Shah, Nitya Maheshwari and Neha Sehta
1
Department of Computer Science and Engineering
Acropolis Institute of Technology and Research
Bypass Road, Manglia Square, Manglia, Indore - 453771.
[email protected]
2
Department of Computer Science and Engineering
Acropolis Institute of Technology and Research
Bypass Road, Manglia Square, Manglia, Indore - 453771.
[email protected]
3
Department of Computer Science and Engineering
Acropolis Institute of Technology and Research
Bypass Road, Manglia Square, Manglia, Indore - 453771.
[email protected]
I. Abstract
Businesses must find ways to pack products of different shapes and sizes into predefined cartons in a way that minimizes the
number of cartons used. Efficient product packing plays a crucial role in the logistics and shipping industry, where improper
utilization of space can lead to significant financial and environmental costs. Inefficient packing not only results in wasted
space but also increases shipping expenses, requires more packaging materials, and adds to fuel consumption and carbon
emissions due to increased shipment volumes.
This work aims to address this issue by developing an algorithm-based solution that calculates the best carton size and
orientation for shipping products. The system takes into account the product's dimensions, shape, and quantity provided from
the end user, then determines and then maps to available carton sizes. It evaluates all orientations to find the most efficient
packing arrangement, leaving a buffer space for packaging materials, otherwise provides alerts for customization. The
system automatically converts measurements to standard units for consistency and provides a final packing strategy that
minimizes the total volume to be shipped, helping businesses save on shipping costs. Additionally, by automating the
packing process, the system eliminates the manual trial and error method saving both time and labour. The system allows
users to adjust the side buffer space used for packaging perishable and fragile products.
Key Words: Optimization Problem, Greedy Methodology, Dynamic Programming, Brute Force approach.
II. Introduction:
In today’s world, packing products and shipping has become an integral part of the supply chain. Companies face issues in
packing products efficiently to reduce shipping cost. Shipping costs are often directly related to the volume of packages.
Inefficient packing can lead to unnecessary expenses due to wasted space. In addition, the improper use of cartons can lead
to increased fuel consumption, handling inefficiencies, and additional resources like extra packaging materials. The
challenge lies in determining the best way to pack multiple products into predefined carton sizes while minimizing the total
volume to be shipped and avoiding underutilized space. We solve this using brute force approach with a predefined set of
cartons. Further, we demonstrate working of the algorithm that takes required input from the user and responds with the best
carton size to pack the products. It also provides the orientation and arrangement of products to be packed and finally the
number of such cartons required.
The literature analysis that follows discusses the several methods that scholars from across the globe have employed to come
up with answers for this problem. In section 3, the algorithm is outlined along with multiple demonstration scenarios. The
limitations have also been mentioned after a thorough analysis and discussion of the results and conclusions in section 4.
There exist certain issues that require development, which are also mentioned in the section titled "Future Enhancements.”
The research concludes with a mention of the sources and author information.
We studied several methods that have been used to solve the optimal box packing problem. Depending on the problem, the
techniques may attempt to minimize wasted space, minimize the number of cuboid spaces generated, minimize the number
of containers, and maximize profit. As stated in [1], greedy algorithms have five components:
A key feature of which is when we make the greedy choice, we never need to change it. This results in fast algorithms.
Wissam F. Maarouf at el [2] proposed a new heuristic algorithm called Peak Filling Slice Push (PFSP) for 3D bin packing.
The algorithm recursively divides the container into smaller slices and then fills each slice with boxes before pushing them
to minimize the wasted space. A hybrid genetic algorithm was used to solve the three-dimensional bin packing problem with
the packing strategy that seeks to minimize the number of cuboid spaces generated during the packing process by matching
the object’s height, length, or width with the dimensions of the packing space [3]. For solving the 3-dimensional packing
problem, the algorithm known as Largest Area First-Fit (LAFF) minimizing height is used in [4]. It uses a heuristics strategy
that places the boxes with the largest surface area first by minimizing height from the bottom of the container. This provides
a reduction of costs in shipments with the use of a minimum number of containers. Kamath [5] solved the container packing
problem using four algorithms: Greedy Shelf, Shelfing with Rotation, Shelfing with Search, and Guillotine Paper Cutting.
The results of the study demonstrate that the Shelfing with Internal Search algorithm performed the most effectively,
resulting in the lowest average height of the packed containers. Richard E. Korf [6] uses a simple approximation algorithm
called first-fit decreasing (FFD). In that algorithm, the elements are sorted in decreasing order of size, and the bins are kept
in a fixed order. Each element is placed into the first bin that it fits into without exceeding the bin capacity. This algorithm
appears to be asymptotically faster than the best existing optimal algorithm. Nguyen Thi Xuan Hoa [7] uses the Genetic
Algorithm (GA), which uses a fitness function in each iteration to measure the quality of each generation and combines the
most desired characteristics to improve the quality of solutions. It demonstrates optimal efficacy in solving large-scale
optimization problems within specified timeframes, yielding high-quality results. Authors [8] talk about the limitations of
using the Brute force approach. It states, “A mathematician using “brute force” is a kind of barbaric monster, is she not?
Case distinctions play an important role for thinking, but if the number of cases gets too big, it seems impossible to obtain an
overview, and one has to slavishly follow the details. But perhaps this is what our times demand?” which means that the
algorithm which is currently running on the same approach might not prove to be scalable enough to handle a large inventory
of outer cartons. After a thorough study, we decided to use the Brute Force approach because it explores all options available
and gives the best possible solution.
In this section, we delve into the proposed work for addressing the problem of optimal box packing. This encompasses
various aspects; it detects the box size based on various factors, which include the shape of the product, the unit of
measurement used for measuring the size of the product, the dimensions of the product to be shipped, and the number of
products to be shipped. Let us elucidate the process to provide a comprehensive understanding of the solution for the
following two cases. All implementations and executions of the proposed work have been performed on a 64-bit Windows
11 operating system with an Intel i5 processor in C++ 20 with Visual Studio Code as an IDE for smooth execution,
debugging, and analysis of the algorithm.
We begin by gathering information about the product from the user. First, the user is prompted with the question: "What is
the shape of the product?" Four different shape options are provided: cuboid, cylinder, sphere, and cube. The user must select
one option and input the corresponding number (1/2/3/4) as their response. Next, the user is prompted with another question:
"What is the unit of measurement?" The available options are centimetre (cm) as option 1, inches (inch) as option 2, and feet
(ft) as option 3. The user should select one unit of measurement based on the dimensions they are providing for the product
and input the corresponding option number in response. Following this, the algorithm asks the user to provide the product
dimensions. The required dimensions depend on the selected shape (e.g., length, breadth, and height for a cuboid; radius and
height for a cylinder; radius for a sphere; and length for a cube). Lastly, the user is prompted to enter the number of products
to be shipped. Based on the inputs provided, the algorithm calculates the best orientation and carton size for optimally
packing the products. The output suggests how to arrange the products—whether height-wise, breadth-wise, or length-wise.
It also recommends how many products should be packed per row, per column, and per stack. Finally, it suggests the best
carton size in the form of L x B x H for packing the products and calculates the number of cartons required. At the end of the
process, the user is prompted with a message confirming that all products have been packed, along with a specification of the
buffer space left in the carton for safely shipping the products. (This buffer size can be adjusted based on the material of the
products being shipped—for example, a larger buffer for fragile items and a smaller one for more durable products.)
Test Case – I:
In this test case (Fig 2), we select cuboid as the shape of the product to be shipped. Furthermore, we select inches as the unit
of measurement for the product dimensions. The length, breadth, and height (L, B, H) of the product are input as 6, 4, and 5
inches, respectively. Additionally, we are required to ship 100 such products. Based on these inputs, the system responds
with the following optimal packing strategy:
The system then selects the best carton size available from the user’s inventory, which is 18 x 16 x 14 inches, and calculates
that 6 cartons are required to ship all 100 products. Lastly, the system informs the user that 1 inch of space has been left on
all sides of the carton for packing materials, ensuring the safe shipping of the products.
In this test case (Fig 3), we have selected cuboid as the product shape, with centimetres as the unit of measurement. The
dimensions of the product are 54 cm x 45 cm x 23 cm, and we are shipping 34 products. Upon receiving these inputs, the
system outputs: “No suitable carton found. Please check the carton inventory and try again.” This test case addresses one of
the two bounding conditions where the product dimensions or total volume of the products to be shipped do not align with
the available cartons in the inventory. These conditions are as follows:
- Product size exceeds the largest carton size available: If the dimensions of a single product exceed the dimensions
of the largest available carton, the system cannot select a suitable carton for packing. This happens when the
product’s size is larger than the largest carton available.
- The combined volume of products is smaller than half the volume of the smallest carton available : If the total
volume of all the products to be shipped is less than half the volume of the smallest available carton, the system
determines that placing the products in the carton would lead to inefficient use of space, resulting in significant
wastage.
In this case, since the product size exceeds the dimensions of the largest available carton, the system responds with the
message: “No suitable carton found. Please check the carton inventory and try again.” These boundary conditions ensure that
the system maintains both efficiency and feasibility in carton selection, preventing poor packing solutions. This test case
highlights how the algorithm handles edge cases where the product is either too large or the volume too small for the
available cartons, ensuring optimal packing.
Fig 1. Flow
Diagram
Fig. 1 provides a detailed breakdown of an efficient algorithm designed for optimal carton packing in a best-fit scenario. The
process begins by asking for the product's shape, dimensions, and unit of measurement. It accounts for various product
forms, such as cuboids, cylinders, and spheres, ensuring proper conversion of units and validation of inputs. In case of any
invalid input, the algorithm promptly notifies the user to re-enter the correct data. Once valid dimensions are provided, the
algorithm checks different carton sizes and orientations, comparing them to find the best configuration. The algorithm
systematically calculates the most space-efficient packing solution, reducing the number of cartons required. At the end, the
user is informed of the remaining buffer space, allowing room for packing materials to safely ship the products. This method
not only optimizes the use of carton space but also ensures that products are protected during shipment, providing a smart,
automated solution for packaging needs. Although not part of the algorithm itself, when the user receives this software, they
must first define the available carton sizes as inputs in a 2D array (an X*3 matrix where X is the number of cartons, and 3
represents the length, breadth, and height of each carton). Additionally, the user must specify a buffer size, which can only be
modified when the process is not under execution and cannot be altered dynamically during runtime. This ensures that the
buffer size is consistent throughout the packing process, further enhancing the safety and efficiency of the shipping
procedure.
Across both test cases, the algorithm performed the calculations effectively in handling the products and carton
size combinations under different conditions. In test case 1 it calculated the best carton size and orientation of
packing 100 cuboid-shaped products in 6 cartons of size 18*16*14 inches. It also provided on how to arrange
the products and left an additional inch buffer space for accommodating packaging material like foam, bubble
wrap, cardboard, etc. Similarly, in the second test the system started functioning as it should but encountered an
edge case where the product dimensions exceeded the largest available carton size. As expected, the algorithm
could not find a suitable carton and returned the appropriate message: “No suitable carton found. Please check
the carton inventory and try again.” This demonstrated the system’s boundary checks and its ability to handle
cases where the products cannot be packed into any available carton.
By this we can successfully conclude that the algorithm effectively identifies optimal packing strategies for most
common product and carton size scenarios, as shown in Test Case 1. It ensures efficient use of space, minimizes
the number of cartons required, and allows for safe product transportation with appropriate buffer sizes. Despite
its strengths, the algorithm has certain limitations which are listed below:
- Customization for Extreme Cases: The algorithm cannot suggest an appropriate carton when products
exceed the largest available carton size or when the total product volume is too small for the smallest
carton. Currently, it lacks the ability to dynamically customize carton sizes to accommodate these
extreme cases.
- Manual Buffer Size Input: The system requires the user to manually predefine the buffer size. Ideally, it
should ask the user for the material or fragility of the products and automatically calculate an
appropriate buffer size based on this input, which is currently not possible.
- Greedy Algorithm Approach: The algorithm uses a greedy approach to provide a locally optimal
solution. While this method is efficient, it may not always result in a globally optimal packing solution,
meaning the results are near-optimal but not guaranteed to be 100% accurate.
While the algorithm performs well in many practical scenarios and provides near-optimal packing solutions,
addressing its limitations—such as adding customization for extreme cases, automating buffer size calculation,
and improving accuracy—would further enhance its utility and reliability in diverse real-world applications.
- Dynamic Carton Size Customization: One of the key challenges right now is that the system can't
suggest a carton size when the products are either too big or too small for the available options. To
solve this, we plan to enhance the algorithm so it can calculate the ideal carton size based on the total
volume of the products to be shipped. This way, instead of running into a dead end, the system will
recommend a customized carton size, ensuring the products fit perfectly.
- Automated Buffer Size Calculation: Right now, users have to manually define the buffer size, which
might not always match the specific needs of the products. To improve this, we're aiming to add data on
common materials like glass, plastic, wood, electronics, ceramics, and food items, along with their
durability factors. This will allow the system to automatically calculate the right buffer size for each
shipment, based on the material's fragility. We're also exploring the use of machine learning to make
this feature even smarter by predicting the ideal buffer size based on historical data and material
properties.
- Optimizing the Packing Strategy with the 0/1 Knapsack Algorithm: At present, the algorithm uses a
greedy approach, which gives a good solution but not always the absolute best one. To address this, we
are working on implementing the 0/1 Knapsack algorithm. While it might take a little more processing
time, it guarantees the most optimal packing strategy possible, helping reduce transportation and
packing material costs. In the long run, this should lead to more efficient use of space and resources,
which is a win for both users and the environment.
These enhancements are aimed at making the system smarter, more adaptable, and ultimately more useful for a
variety of shipping and packing scenarios.
VII. References:
[1] Sathyapriya Sivasamy, “A Study on Greedy Technique in Container Loading Problem and Knapsack Problem,”
May 2021.
[2] Wissam F. Maarouf, “A New Heuristic Algorithm for the 3D Bin Packing Problem,” 2008.
[3] Kyungdaw Kang, “A hybrid genetic algorithm with a new packing strategy for the three-dimensional bin packing
problem,” October 2012.
[4] M.Zahid Gürbüz, “An Efficient Algorithm for 3D Rectangular Box Packing,” 2009.
[5] Raghavendra Kamath, “Optimizing Space Utilization In Container Packing: A Comparative Analysis of Packing
Algorithms,” August 2023.
[6] Richard E. Korf, ” A New Algorithm for Optimal Bin Packing,” 2002.
[7] Nguyen Thi Xuan Hoa, “Optimizing Container Fill Rates for the Textile and Garment Industry Using a 3D Bin
Packing Approach,” May 2024.
[8] Marign J.H. Heule & Oliver Kullmann,” The Science of Brute Force,” July 2017.
VIII. Authors:
- Naman Shah is a student with a focus on data structures and algorithms and
Competitive Programming. He has recently published a paper at an IEEE
conference on automating the process of subject allotment for faculty
members. Naman has been working on the current algorithm since March
2024, designing and refining it for enhanced efficiency and optimization.