TITLE: Help figuring a formula for my job
QUESTION [10 upvotes]: I'm a metal worker, I cut, weld, whatever.
I'm trying to figure out a formula where I could take my cutting list 
And figure out the most efficient way to cut it with the materials I have. 
For example 
I have 2 20ft lengths of tubes
I want 5 peices cut at 1.5ft, 3 at 2ft and 1 at 2ft
What I'm trying to do is calculate the most efficient cutting order to save the most material I'm using.
My education is limited so any help would be appreciated, thank you.

REPLY [8 votes]: This is a very well known, difficult problem, called the "bin packing problem".  There is no known algorithm that would work efficiently for large numbers of pipes, but for reasonably small numbers
it can be done in practice. 
A reasonably good, though not always optimal, strategy is "first fit decreasing".
Sort the desired output lengths in decreasing order, and cut each from the first
tube where it will fit.