title: Calculating efficient use of window casing (trim)
body: <p>I'm working on an app that's going to estimate building material for my business. The part I'm working on right now deals specifically with trim that goes around windows.</p>
  
  <p>The best way to explain this is to give an example:</p>
  
  <p>Window trim is purchased in lengths of 14 feet (168 inches). Let say I have 5 rectangular windows of various sizes, all of which consist of 4 pieces of trim each (the top and bottom, and right and left). I'm trying to build an algorithm that will determine the best way to cut these pieces with the least amount of waste. </p>
  
  <p>I've looked into using permutations to calculate every possibly outcome and keep track of waste, but the number of permutations where beyond the trillions once I got past 5 windows (20 different pieces of trim).</p>
  
  <p>Does anyone have any insight on how I might do this.</p>
  
  <p>Thanks.</p>