Forum Discussion
Grouping a list of numbers
Hi,
I have been trying to find a formula for a work issue but have been struggling to figure out what exactly to search for. I work for a company that deals with artificial grass, and the grass comes in 25m long rolls. When we do a plan, we may need 10 rolls of varying lengths, and will need to cut the 25m rolls into pieces. Is there some sort of formula where I could take the list of grass lengths that we need, and put them into groups adding up to 25, but making as little cuts as possible?
4 Replies
- Patrick2788Silver Contributor
Your request is what's known as the 'Cutting Stock Problem'.
https://en.wikipedia.org/wiki/Cutting_stock_problem
There are two possible approaches to solving this: Lambda or Solver.
Do you happen to have any more details about the grass lengths?- Jasmine_tamaraCopper Contributor
Thanks for getting back to me so quickly, this is very helpful!
This is not a real plan that we are doing, just a mock area to demonstrate:
The image below shows the area of grass to be covered, and the red rectangles are the grass rolls. Then the image below that shows a section of a worksheet showing how long each of those rolls are, rounded up to the nearest 500mm.
Obviously this is a very simple example that would be easy to workout manually, however we often have plans where we use a lot more grass than this, and in those instances, it's hard to workout the best combinations to minimise the amount of waste and cuts we need to make.
Any help is greatly appreciated!
- Patrick2788Silver Contributor
If I understand correctly, these figures are the rolls to be produced with as minimal waste as possible:
I think the part that's missing are the constraints. I realize this is an example and the there's no waste because 25mm is a multiple of the the various rolls required.