Bin Packing Problem

Why?

This one is a lot more interesting. This is a computational problem older than me, but it's such a beautiful concept...

This all started when I was asked to optimize the cable tray segment amount needed for a construction site. Usually those cable trays are sold in 20 ft. segments, so, if you need 200 ft. you have to buy 10 segments, right?

Well, what happens if they need a 190 ft. cable tray? They still need to get those 10 segments, and now they've got 10 ft. that can be used on a smaller run.

This concept might seem simple at the beggining, but finding the optimal solution is not as simple as one might think. Check that out for yourself.

So, I've decided to implement this directly into Revit. But it only works on cable trays on Revit... I figured this could help a lot more if I just shared it and let people use it with multiple data sources, so...

Features

This app is designed to ingest three data types (more might be coming, it depends on feedback):

  • CSV
  • XLSX
  • SQLITE

At the beggining it will look something like this:

Bin Packing 1

Then the moment you upload a file:

Bin Packing 2

And now you can actually use it.

I had this app display the uploaded data, it's always simpler to explore and stuff.

Now you have to select the column where the important measurement is.

In the case of cable trays, it's probably going to be length. In the case of steel it probably would be length again. In the case of boxes, it's probably going to be the amount of boxes. Use your imagination.

So:

  1. You select the column for bin sizes.
  2. You enter the bin size.

Column part is already explained. Bin size, you have to input the amount of the sections/bins. In the cable tray example I mentioned at the beggining, it's 20 ft. It can be a box with 50 oz. It can be a steel structure that is sold in 30 ft. segments, you get the idea.

If you found an error while running it... Check the data. I tried to convert the data types, so, in that picture, one of the rows has a decimal comma instead of a point. It will give a warning and then show you what row generated the problem, but you might have even more, so, be careful with the data.

After fixing that you'll end up with something like this:

Bin Packing 3

Now, you can analyze these results and make decisions on it.

Results

This software will give 4 results metrics:

  • Optimal segments with leftover space:

These are the segments that after optimization still have space available to be used. This is where human criteria works out, if there's only 0.01 ft. available, will you even consider using it?

  • Optimal leftover:

This is the amount of leftover that will be usable. Same here with the criteria, this is just summing up all available space, so, for the example case, this might be 1 space with 4.5 ft. and 1 space with 0.2599999... ft. You probably won't end up using the 0.25 one.

  • Number of optimal bins required:

Ohhhh this is the big number. Just know that this is the minimum amount you'll need. This is obliously a mathematic perfect amount. Some of the segments might not be usable (like using 0.25999999... ft., you know?) so, take this number with precaution.

  • Number of highest amount of bins required:

This one will just use the highest amount of segments.

The real segments necessary will certainly be a number between the highest amount and the optimal amount.

Now, if you want to use it:

This is the access link:

>>> Bin Packing Problem App <<<