Friday, October 23, 2009

Boxes Inside Boxes

I recently had to write a piece of software that calculated the most efficient way to pack boxes (products) inside bigger boxes (boxes). It seems simple enough but as we zoomed in on the scope I realized that much of the spacial engineering that we, as humans, do so effortlessly is very difficult to program into a computer.

I remember how much pride my dad used to take in packing the trunk just right on those family vacations. Which suitcase goes in first? Do you lay it flat or stand it on it's side? Is it better to stack these 2 on top of each other or side by side? What about those skis that had to go in at an angle? What about that bit of left over space on the left that I can't fit anything into? Now imagine you have dozens of parts and dozens of boxes to choose from and you have to figure out how to pack those parts into into the least number of boxes and do it most efficiently by using the smallest boxes possible. Now write a software that does it. Yeah ... not so easy.

This was further evidenced by the fact that when we decided to just buy an off-the-shelf software for the project, we still couldn't find a practical solution. One guy on my team said if I manage to pull this off we can all go into a new line of business.

I built the back end data structure that stored all the product info (Length, Width, Height, Weight, etc.) and also the available boxes (Length, Width, Height, Weight Capacity, etc.). Next, I built a test harness where you could quickly add a bunch of parts to your cart and hit a button to run the Boxing process. It was my first 100% object oriented app. I've been demo'ing the harness for managment, IT, and warehouse peeps around here and everyone loves it.

One warehouse guy came up and gave me a fist bump after the demo. I guess that's why I do what I do. Once every few years you build something that matters to someone. You get to see them smile and you get some appreciation.

No comments: