Select Page

Packing Algorithm

Originally published on July 15, 2019 by Logiwa Marketing, Updated on November 17, 2022

Packing Algorithms: How They Help Warehouse Operations

Packing algorithms sound intimidating and for good reason. In popular culture, we associate algorithms with complex, advanced technology.

In reality, an algorithm is just a means of solving problems really quickly. In the world of supply chain management, packing algorithms help warehouse managers address what’s known as the bin packing problem— the issue of packing multiple items of various sizes into a finite number of bins (in this case, shipping boxes).

Today, the computational complexity of the bin packing problem is quite high, due to the large number of resources like time and storage. This means that it takes a lot of effort to solve through algorithms. As a result, most bin packing solutions come in the form of 3D bin packing software— tools that allow customers to visualize their items and digitally pack them—rather than software with fancy algorithms.

Table of Contents:

  1. What is an Algorithm?
  2. What Kinds of Problems do Warehouse Packing Algorithms Try to Solve?
  3. Why Does Solving Packing Problems Even Matter?
  4. How Are Algorithms Applied to the Warehouse Management Process?
  5. How 3D Shipping Software Provides Optimal Solutions For Your Customers
  6. So Will Packing Algorithms Achieve Widespread Usage?

BONUS: Before you read further, download our Warehouse Management Software Whitepaper to see how Logiwa uses real-time data to help you get up to 100% inventory accuracy and execute advanced fulfillment strategies like wave planning.

Nevertheless, it’s important to understand what packing algorithms are, because if someone ever cracks this puzzle, it’ll have huge implications on the warehouse industry. In addition to that, understanding these algorithms will give you ideas for optimizing your warehouse packing methods in your day-to-day operations.

If you’ve been avoiding the words “packing algorithm” during your continuous improvement efforts, now’s the time to make their acquaintance. Take a breath, settle in, and let’s break down this concept together.

What is an Algorithm?

An algorithm is simply a set of instructions one follows in order to complete a task or solve a problem. It’s a “sequence of instructions telling a computer what to do” according to Pedro Domingos, author of The Master Algorithm. 

We build algorithms on three logical operations: “and,” “or,” and “not.” While algorithms can become complicated, conceptually they’re quite simple.

Today, tech marketers use the term to make their products seem more sophisticated and mysterious. At the end of the day though, an algorithm is just a set of sequenced instructions and every company creates different instructions for different tasks they want to complete.

Algorithms exist in our everyday life, even if we aren’t using machinery. Baking a cake or getting dressed in the morning could be considered algorithms. There are specific steps and the sequence matters. You wouldn’t put your shirt over your jacket, and you wouldn’t frost a bag of flour.

In the marketplace, we find algorithms all over. They facilitate trading in the financial industry, curate our newsfeed on social media, and help us to decide what to buy next on ecommerce sites like Amazon.

What Kinds of Problems do Warehouse Packing Algorithms Try to Solve?

The Bin Packing Problem

The “bin packing problem” refers to the issue of packing multiple items of various sizes into a finite number of bins, or shipping boxes. It’s an optimization problem in math and computer science: it’s about “finding the best possible solution from all feasible solutions.” When it comes to bin packing, the best solution can be one of two things:

  1. Packing one container as densely as possible
  2. Packing all objects into the least amount of packages as possible

Both objectives are meant to serve one overarching objective: cost savings. Inefficient packing methods lead to excess shipping costs.

In some cases, shipping companies use dimensional weight pricing, meaning that even if you’re shipping something light, it’ll get charged for the amount of space it takes up. This further increases the incentive to optimize your packing methods.

In addition, using more packaging than necessary leads to higher packaging material costs. Moreover, inefficient packing methods take up more space on transport trucks, limiting a warehouse’s shipping capacity and jeopardizing their ability to deliver products to customers on time.

The Knapsack Problem

While this is a less-pressing packing concern for warehouses, it is related to the overall concept of packing algorithms. Imagine you’ve got several items. Each item has a dollar value and a weight. How do you decide which items to pack into a knapsack so that (a) the total weight is less than or equal to what the knapsack can handle and (b) the most valuable items are packed. It’s a resource allocation problem faced by several industries.

The Computational Complexity of These Problems

A problem’s computational complexity refers to how many resources, such as time (e.g., labor hours) and space (e.g., data storage), it will take to solve a problem. Some computer scientists use this classification system to identify the difficulty level of certain algorithms and choose a less difficult algorithm to keep the project efficient.

As a decision problem, where the answer you’re looking for is a “yes” or a “no,” the bin packing problem and the knapsack problem are both considered “NP-Complete” problems. That means there is no known way to find a solution quickly.

As optimization problems, they are both considered “NP-hard.”

For those interested in computer science, this is an opportunity to dive into the difficult P versus NP problem (whether problems that are quick to verify are also quick to solve). For the purposes of this article, let’s keep it simple. If you’re ever reading about packing algorithms, come across the term “nondeterministic polynomial time” and consider throwing in the towel, remember that all you need to know is this:

With today’s technology, packing algorithms may be able to tell you how to optimize your packing efforts, but they can’t definitely tell you that a specific packing solution exists.

In other words, they’ll help you find the best way to pack your packages (solution to an optimization problem), but you can’t find out whether there is a solution to your packing problem by simply turning to an algorithm (decision problem).

Label Printing

Why Does Solving Packing Problems Even Matter?

After all of that, you may think this all sounds like a lot of work for very little reward. Well, you’d only be half right. It’s a lot of work, but the potential reward is huge!

Almost any warehouse manager will tell you that bin selection is a pain . Oftentimes, warehouse workers don’t bother trying to find the best-sized bin (shipping box)—they just pick the largest one and proceed with the task at hand. This is incredibly inefficient and unnecessarily expensive in terms of energy, boxes, and additional packing materials to avoid damage to the product. It’s like using express mail for a package that doesn’t need to arrive for another three weeks.

One manual solution to the bin packing problem is rotating each object to determine if it fits in a bin before retrieving a larger one. The drawback of this is time. In order to make the most of the shipping box, you’d need to do this for every item you suspect might fit into it. That’s a lot of items and rotations. It would take forever and customers would never receive their products.

This is why an algorithm that speeds up the process and limits the amount of analysis = would be a big day for warehouse efficiency efforts. For now warehouses simply make do with what they have.

Overview of Standard Bin Packing Algorithms

Bin packing algorithms are categorized by the specific bin packing strategy they facilitate.

Next Fit

The worker checks if an item fits in the bin they’re currently filling. If it does fit, they place it in. If it doesn’t, they close that box and use the next one. With this strategy, a worker never returns to a previous bin. For instance, if they can’t fit an item in Bin 4, they don’t return to Bin 3. They simply grab a new one.

The benefit of this method is that you don’t need a lot of dedicated warehouse space. The minute additional items cannot fit into the bin, it’s shipped off to the end customer.

First Fit

When packing an item, start with the earliest bin. For instance, if you have a row of boxes partially filled with various items, check to see if it fits in the very first box you packed (Bin 1). If it doesn’t move on to Bin 2, and down the row until you find one that works.

Best Fit

With this approach, a worker looks for the bin with just enough room to pack an item. The goal is to use as much of that bin’s space as possible and get the bin shipped out as quickly as possible.

Worst Fit

If you’ve got an item, and several partially filled bins, try and put the item into the bin with the least amount of items, working your way up. You can think of it as evening the weight between each of the shipping boxes. If there are two boxes tied for “emptiest” or “lightest,” choose the one that was opened or started earliest.

The Decreasing Variation on Standard Packing Algorithms and the Difference Between Algorithms

All of these algorithms, or instructions, if you will, have decreasing variations. All the items to be packed are lined up, decreasing in size and then those items are packed using the next fit, first fit, best fit, or worst fit system.

Furthermore, bin packing algorithms are classified into two categories: online algorithms and offline algorithms. If an algorithm must pack items in a fixed order, such as the order they arrive in, it’s an online algorithm. If the algorithm can rearrange the order and find the most optimal packing scenario, then it’s an offline algorithm.

How Are Algorithms Applied to the Warehouse Management Process?

Ideally, these algorithms would be built into a company’s warehouse management system. Even companies who create 3D bin packing software could build these algorithms into their solutions to help businesses come up with the most optimized manner of packing their goods.

Current solutions prompt the warehouse to input the number of goods and dimensions of each of their goods into the system. The software then analyzes these variables and suggests the best way to pack these goods so that warehouses can make the most of their bins and pallets. In some cases, they could provide step-by-step assistance, guiding the worker through the packing process.

In addition to guiding workers on the best way to pack their bins, 3D bin packing software also helps workers find the exact shipping container they need for their items, so they don’t simply reach for the nearest box, regardless of its suitability.

But, what is 3D bin packing software?

Imagine a game of tetris, where you’re quickly fitting blocks together. 3D bin packing is like a more forgiving game of tetris, but in 3D. The pieces don’t have to fit in perfectly together, but they should fit in as best as possible, and you can digitally pack your bins, or shipping boxes,  in 3D. This way, your workers don’t have to go through the process of manually rotating items and checking to see which boxes they fit best in. They can quickly and easily review a simulation based on previously conducted analysis.

Keep in mind, though, that not all 3D shipping software will necessarily have reliable packing algorithms.

How 3D Shipping Software Provides Optimal Solutions For Your Customers

A frustrating part of the online shopping experience is being hit with unexpected shipping charges. In some cases, if customers knew how much they’d be charged, they wouldn’t have bought the product. Furthermore, it’s frustrating for businesses that want to be upfront, but don’t know exactly how much they’ll spend on shipping until later.

3D shipping software helps businesses do this. For instance, Shopify offers intelligent 3D packing that allows product and box dimensions to digitally find the smallest box and provide the dimensional weight pricing in real time. As a result, customers know exactly what they’ll pay for shipping up front.

Customers aren’t surprised and businesses eager not to anger customers don’t have to swallow unexpected shipping fees. The process becomes transparent, and both companies and customers are happy. The Shopify solution integrates with popular carriers like Purolator, UPS, and the United States Postal Service (USPS).

So Will Packing Algorithms Achieve Widespread Usage?

While packing algorithms present exciting possibilities, there aren’t a lot of reliable, advanced solutions on the market that allow customers to rapidly come up with the most efficient way to pack boxes.

Not surprising, considering that the bin packing problems and the knapsack problem are extensions of the “P versus NP problem,” one of the big unsolved computer science Millenium Problems. (If you’re wondering how tough and important these problems are, there’s a $1 million USD prize for solving them.)

In the meantime, 3D packing tools are the most feasible option. Nevertheless, it’s important for warehouse operators to understand and keep an eye on the world of 3D packing algorithms. While they’re currently a bit of a holy grail for warehouse owners, they will still inform and guide how warehouse operations are run and improved.

While we wait for our holy grail, get started with Logiwa WMS demo for software solutions, tools and support for optimizing your warehouse.

Related Terms

Dark Stores

The dark store concept, from the definition to the benefits is covered in Logiwa Blog. What is a dark store, finds the perfect answer in this article with related details.

WMS Requirements List

Warehouse management system requirements help identify opportunities support your company growth. Learn more with the Logiwa WMS Blog.

Moving Warehouses

The best time to implement a new WMS is when you are moving warehouses. Moving your warehouse? Consider Logiwa’s latest tech WMS solutions to upgrade your logistics procedures.


What is Deliverr? Deliverr makes it easy to fulfill the ecommerce marketplace and shopping cart order. Learn more about Deliverr warehouse locations now!

Furniture Inventory Management

Furniture inventory is important in warehouse management. Click to see clearly how furniture 3PLs can offer significant value and the details of a furniture inventory system!

Apparel Inventory Management

Effective apparel inventory management means online retailers can meet demand while keeping inventory at a healthy level.

Back to Blog