I am building a house, and to make things go, I have a list of all the molding/trim/baseboard pieces that are going into the house. I also have a list of all the pieces you can buy and the lengths they come in.
I started writing some code to mesh the two, and realized this is not nearly as simple as it sounds.
Example (much simplified for illustration):
Baseboard
Pieces To Cut: 14,16,17,19,21,22,28,45,48,69,88,98,123,144,158,162,188,189,194,210
Available in: 96,120,144,168,192
How would you figure out the most efficient way to determine the best cuts with the least waste?
Assumptions:
You don't make a piece from multiple pieces of waste eg: 24 = 8,8,8
Any size available stock is ok to use
Brute force is not acceptable. An average house can have more than a 1000 pieces of molding cut from 40-60 stock sizes. To try every possible combination would be nearly impossible.
Most of my programming is in c#
I started writing some code to mesh the two, and realized this is not nearly as simple as it sounds.
Example (much simplified for illustration):
Baseboard
Pieces To Cut: 14,16,17,19,21,22,28,45,48,69,88,98,123,144,158,162,188,189,194,210
Available in: 96,120,144,168,192
How would you figure out the most efficient way to determine the best cuts with the least waste?
Assumptions:
You don't make a piece from multiple pieces of waste eg: 24 = 8,8,8
Any size available stock is ok to use
Brute force is not acceptable. An average house can have more than a 1000 pieces of molding cut from 40-60 stock sizes. To try every possible combination would be nearly impossible.
Most of my programming is in c#