title: Minimize shipping cost based on price and weight constraints
body: <p>I'm trying to determine the least shipping cost when you have a number of items (each with a weight and a price) that can be combined into the same package. The constraints are as follows:</p>
  
  <ol>
  <li>There is a limit on the max price of the combined package (say $15)</li>
  <li>The cost of the package is determined using the following table:  
  
  <ol>
  <li>If total weight of package is &lt; 30 grams, cost is $7.5</li>
  <li>If total weight of package is >= 30g and &lt;80g, cost is $7.5 + (weight - 30)x0.075</li>
  <li>If total weight of package is >= 80g, cost is $7.5 + (weight - 30)x0.055</li>
  </ol></li>
  </ol>
  
  <p>There is no limitation on the number of packages these items can be combined into as long they remain under the total price threshold.</p>
  
  <p>I looked at the knapsack problem, but there are 2 major differences between the knapsack problem and my problem: </p>
  
  <ol>
  <li>One is that we are not maximizing the weight or price of the items combined, instead we want to minimize a calculated variable that can only be determined after the combination.</li>
  <li>Also, there isn't a direct correlation between weight and shipping cost.</li>
  </ol>