- #1
droobilicious
- 3
- 0
Hi,
New to this forum so sorry if i am not posting in the right place.
I have a problem, I need to cut a number of pieces of wood to certain lengths (the width and depth are standard and not relevant here). I know the number and lengths of all the lengths I need, but i can only buy the wood in boards of 2400mm or 1800mm. What I would like to do is find the number of boards of each length that i need to buy, and how to cut them in the most efficient way. I would like to write a function to do this and and competent at coding but do not know how the logic of the function should work. I'd also like to try and generalize the function to work for any input sizes and quantities and any given board that can be purchased.
Here's my example:I want to create the following board quantities and lengths:
8 x 2060mm
14 x 450mm
2 x 458mm
4 x 283mm
2 x 197mm
2 x 486mmI can only purchase 2400mm or 1800mm length boards from which i must cut the above lengths.My only thought so far is to first arrange the boards into every possible combination, then line each order up against the 2400mm and 1800mm boards to see which uses least/produces least waste. There are 32 boards so i believe this gives me 32! positions that they could be in. This is obviously too large to do anything with. Clearly there are a lot of positions that i don't care about, for example it doesn't matter which of the 14 boards that are 450mm is at a given position in the order. It doesn't matter about orders that are the reverse of another order etc.
This way seems very inefficient and at the end still wouldn't identify any solutions that are more efficient by using only the shorter boards to cut from etc.Looking for any help you can give me to get my head around this problem.
If anyone wants to get really crazy then there is a per meter price difference
14.78 GBP for 2400 making 6.16 GBP/meter
11.82 GBP for 1800 making 6.57 GBP/meterIt would be great to figure out the function that gives the most efficient option in terms of price also.If I'm totally in the wrong place please feel free to point my in the right direction.
Thanks in advance
Droobilicious
New to this forum so sorry if i am not posting in the right place.
I have a problem, I need to cut a number of pieces of wood to certain lengths (the width and depth are standard and not relevant here). I know the number and lengths of all the lengths I need, but i can only buy the wood in boards of 2400mm or 1800mm. What I would like to do is find the number of boards of each length that i need to buy, and how to cut them in the most efficient way. I would like to write a function to do this and and competent at coding but do not know how the logic of the function should work. I'd also like to try and generalize the function to work for any input sizes and quantities and any given board that can be purchased.
Here's my example:I want to create the following board quantities and lengths:
8 x 2060mm
14 x 450mm
2 x 458mm
4 x 283mm
2 x 197mm
2 x 486mmI can only purchase 2400mm or 1800mm length boards from which i must cut the above lengths.My only thought so far is to first arrange the boards into every possible combination, then line each order up against the 2400mm and 1800mm boards to see which uses least/produces least waste. There are 32 boards so i believe this gives me 32! positions that they could be in. This is obviously too large to do anything with. Clearly there are a lot of positions that i don't care about, for example it doesn't matter which of the 14 boards that are 450mm is at a given position in the order. It doesn't matter about orders that are the reverse of another order etc.
This way seems very inefficient and at the end still wouldn't identify any solutions that are more efficient by using only the shorter boards to cut from etc.Looking for any help you can give me to get my head around this problem.
If anyone wants to get really crazy then there is a per meter price difference
14.78 GBP for 2400 making 6.16 GBP/meter
11.82 GBP for 1800 making 6.57 GBP/meterIt would be great to figure out the function that gives the most efficient option in terms of price also.If I'm totally in the wrong place please feel free to point my in the right direction.
Thanks in advance
Droobilicious