in reply to Finding the simplest combination of descrete thicknesses that sums nearest to the target thickness.

Yes some example code would be helpful. From the outside looking in, it sounds like you're trying to solve a 2d packing problem.

Or trying to win at tetris...

Soon to be unemployed!

  • Comment on Re: Finding the simplest combination of descrete thicknesses that sums nearest to the target thickness.

Replies are listed 'Best First'.
Re^2: Finding the simplest combination of descrete thicknesses that sums nearest to the target thickness.
by doowah2004 (Monk) on May 03, 2005 at 16:14 UTC
    Well, I am at the brainstorming stage right now, I was hoping that someone clever has seen a module or some code that does something similar, or has a clever suggestion.
    With that said my plans are to:

  • Parse the input to seperate the groups (apply some rounding rules to find the 0 thicknesses)
  • Starting with the base (first level), build that level by iterating over the discreet thicknesses, keeping the closest match.
  • Subtract the thickness of the first level from each of that groups thicknesses and re-apply the rounding rule to further breack down into groups.
  • Repeat this process until all thicknesses are found.


  • The problem with this is that it does not determing the best overall thicknesses, the latter thicknesses would be further limited by the early choices, so I would have to further determine possiblities by including a minimum agreement thickness and then iterate over all possibilities assigning a score to each iteration and getting a solution based off of scores.

    This is very brute force, but it is my first thought.