I was requested to develop a simple software for my school which will be used in a manufacturing environment.
This is the scenario:
I’m given a list of sizes – each size reflect a board, so for instance I have a 24″ x 30″ board, 30″ x 30″, 30″ x 48″ and so on. These boards are a by-product of a process where they cut the raw material.
The raw material is presented in two different type of board sizes 60″ x 120″ and 48″ x 96″.
They wish to know the best way to cut the boards from the raw material – the “best” way is defined as the way with the least amount of raw material and residue. They also want to know the quantity of raw material which will be used, so for instance 30 boards of 60″ x 120″ and 3 of 48″ x 96″.
They are able to cut any board either horizontally or vertically, this means that a 24″ x 30″ can be cut either as a 24″ x 30″ or as a 30″ x 24″.
If I’m given a quantity of 50 boards overall (might be the same sizes) I can have 2^50 different combinations – this seems to be too long for me as they will be running the software on thousands of different board sizes.
I wonder if anyone knows an Algorithm that might fit this scenario.
Thanks!
A classic simple algorithm for rectangular 2D cutting & packing problem is Wang’s algoritm
However, pure Wang’s algorithm is capable of producing the optimal guillotine cutting pattern, i.e. a pattern where all cuts travel all the way from one edge of remaining material to opposite edge. It can’t produce a non-guillotine pattern as the following one
Yet, for many applications guillotine cutting patters are considered good enough. So, you might want to consider that algorithm (since it is very simple).
There are also approximate randomized algorithms based on Simulated Annealing technique (a detailed description can be found in Simulated Annealing for VLSI Design book (can’t find it on the net), which are able to produce non-guillotine patterns.
In any case, finding precise solution for such problem usually requires considerable amount of computations to generate and analyze a great variety of possible variants, which makes it impractical in most cases. Most of the time people prefer to stick for good approximate/heuristic algorithms, which work much faster. Wang’s algorithm can be customized with number of heuristic filters that speed up the search (at the risk of losing the optimal solution and replacing it with an “almost” optimal one).