Talk:Bin packing problem


 * The Best Fit Decreasing and First Fit Decreasing strategies use no more than 11/9 OPT + 1 bins (where OPT is the number of bins given by the optimal solution).

I think this needs a citation. Worst-Case Performance Bounds for Simple One-Dimensional Packing Algorithms only proves 11/9 OPT + 4. Is this in Vazirani? Also, the FF/BF worst case of 17/10 OPT + 2 might be worth mentioning. CRGreathouse 21:04, 27 June 2006 (UTC)
 * Great feedback, thanks. There might be a better bound than "+4", that is a very old paper, but I don't have the sources with me right now, so I changed it to "+4". Deco 23:50, 27 June 2006 (UTC)
 * I did eventually come across the bounds you originally posted, so I put it back with a reference. CRGreathouse (t | c) 15:18, 13 October 2006 (UTC)
 * Although not incorrect, shouldn't the article indicate that it's an NP-complete problem, since Bin packing can be reduced to Partition? —Preceding unsigned comment added by SilverPhoenix99 (talk • contribs) 19:26, 4 June 2010 (UTC)

Does sorting "greatly" increase time?
The original article had a sentence concluding that sorting, "...particularly for longer list, can greatly increase the time taken to implement the algorithm." It also says that the algorithm in question, the first fit algorithm, requires Θ(n log n) time. Typical sorting algorithms also require O(n log n) time.

Since the sort appears to be complete before the fitting algorithm begins, I would expect to sort not to add "greatly" to the time. However, I'm not completely certain about this. I would welcome references stating one way or the other.

Ken g6 02:51, 5 May 2007 (UTC)


 * I don't believe the sort has anything to do with it, however it is true, the algorithm runtime isn't explained. As far as I can figure out it can be done in n log n time, but not with a linear scan of the bins as it is usually explained. The general algorithm would be to sort the original array (n log n), then, keeping the list of bins sorted by available space, for each item find the first bin it fits in (binary search, log n), insert it, and update the list of bins to put it back in sorted order (log n). This gives a complete runtime of O(n log n). With a linear scan the algorithm would actually be O(n^2). It would be nice to have sources for all of this, however google is proving quite stubborn. Eric Burnett (talk) 14:29, 22 November 2008 (UTC)

Can you solve for the number of bins?
Is the question of how many bins (without regard to which items go in which bin) an equivalent problem? Or are there polynomial time solutions to that? —Preceding unsigned comment added by 204.94.228.3 (talk) 01:07, 1 March 2008 (UTC)
 * That's a good question. The usual way to approach this question is to answer the question: if we had an oracle that could tell us the exact minimum number of bins needed to pack the items into the bins, would the bin packing problem become easy? If so, then your problem is NP-hard with respect to polynomial-time Turing reductions. I suspect the answer to this is yes, but don't have a proof or a reference. Dcoetzee 04:31, 1 March 2008 (UTC)
 * Thanks for the response. That's a good insight. I suspect that the answer is no, because if you could guess the number of bins and then make the bin packing problem easy then you could simply solve the general bin packing problem by starting with the total weight of items / capacity of each bin and keep increasing the number of bins until you had an optimal pack. I noticed that the article says that FFD produces bins <= 1/9 * optimal bins + 1, so I'm guessing there must be some other method to determine the optimal number. I expect that's where the answer lies. —Preceding unsigned comment added by 67.162.48.73 (talk) 02:29, 4 March 2008 (UTC)

Fixed percentage of the optimal solution?
Although these simple strategies are often good enough, efficient approximation algorithms have been demonstrated that can solve the bin packing problem within any fixed percentage of the optimal solution for sufficiently large inputs [...].

What does fixed percentage of the optimal solution mean? Thank you! --Abdull (talk) 19:46, 24 July 2008 (UTC)
 * It means, for example, that given any percentage (say 5%) there is an algorithm that will always produce a solution at most 5% worse than the optimal solution; in other words, the number of bins may not be the absolute minimum, but will be at most 5% more than the absolute minimum number of bins. Dcoetzee 21:29, 24 July 2008 (UTC)

Practical Solubility not hard.
I added a description for the algorithm that I developed that works for all computational (and most real-word) cases. The methodology is sound and works, but I am a programmer not a mathematician, so I didn't provide the proof.

The super short version is that you shouldn't let maths people get too close to some pratical problems. Always placing the largest object in the container with the most available space solves the problem in linear time with no doubt because for every configuration step you _never_ end up with a piece in hand that can be swapped for a smaller piece, so you can never and do never backtrack to "make room for" a piece that can only fit by taking out some other piece. If you do that, you know that the piece you removed cannot go back into the bin you removed it from (otherwise you wouldn't have had to remove it), and you _already_ know it cannot fit in any other bin since the smaller piece already didn't fit.

In short, all that math complicates a rather simple procedure. Rob White. IBitOBear (talk) 14:48, 26 November 2012 (UTC)
 * First, Wikipedia is not the place to publish your own ideas, see WP:No original research. Second, your algorithm obviously does not guarantee finding the optimal solution: for example, if we have bins of sizes 4, 3 and objects of sizes 3, 2, 2, then the algorithm first puts the first (= largest) object into the first (= having most room available) bin, then the second object into the second bin (its the only one left where it fits), leaving no room for the third object. The optimal solution is to place the first object into the second bin and the other two objects into the first bin, fitting them all.—Emil J. 19:30, 26 November 2012 (UTC)


 * True, I forgot to mention equal sized bins as a predicate for "real word" problems. E.g. shipping containers, process scheduling, or, you know, bins.. IBitOBear (talk) 23:27, 26 November 2012 (UTC)


 * Never mind and Touché... fixed sized bins (11,11) and the sequence 8, 7, 3, 2, 2 end up wiht the same 4,3 vs 3,2,2.... I've been "solving" this wrong for years... 8-) IBitOBear (talk) 01:12, 27 November 2012 (UTC)