During our schooling, we’ve all at some point looked longingly out the window of our classroom and asked ourselves “Am I ever really going to need to know how to do this?”. I remember an exact day like this during my junior year of college. The class was on mathematical optimizations, and I had to take it to fill my graduation requirements. This particular class was on cut optimization. The questions this type of math problem sets out to solve is this:
“I have a list of lengths of board I need, and a bunch of different lengths of board I can buy, how can I cut all the lengths of board I need and have the least amount of waste possible?”
Flash forward to three years after that class, and I am writing a system to price molding for a house. I had been pondering this problem for a half hour over a cup of java when it hit me. This is the moment! There is a literally a moment in my life I thought was wasted, that now I have a fleeting memory of an idea of what the anwser to this problem might be.
I am not a savant. I certainly did not still remember the algorthm that handles this situation, but I did remember the name. “The Knapsack Problem”. There are literally decades of scholarly writings on this type of problem, so I won’t jump into the details here. Given this sliver of inforamtion to start with, however, I was able to reconstruct this algorithm in an adapted way that fit perfectly into my molding data models, and thus the molding optimizer was born. The video below is from the Fasterbids tutorial I put together, and illustrates both the catalog, and optimizer method of quoting molding from inside the Fasterbids system.