1

Here is a problem I am trying to solve:

The bin packing decision problem is defined as follows: given an unlimited number of bins, each of capacity equal to $1$, and $n$ objects with sizes $s_1$, $s_2$, $\dots$, $s_n$ ($0 < s_i ≤ 1$), do the objects fit in $k$ bins (where $k$ is a given integer)? The bin packing optimization problem is to find the smallest number of bins into which the objects can be packed. Show that if the decision problem can be solved in polynomial time, then the optimization problem can also be solved in polynomial time.

I know what it is asking but I don't know what the "optimization" problem for this is. Is it the grouping of all the objects into different bins (for instance, $s_1$, $s_3$, and $s_6$ are in bin #$1$, $s_2$, $s_4$, $s_5$ are in bin #$2$, etc.)? Or is it simply the number of bins you need to store them? I feel like the number of bins is the decision problem...

André Souza Lemos
  • 3,276
  • 1
  • 14
  • 30
user2237160
  • 95
  • 1
  • 5
  • (I would've defined the optimization problem as "find a packing of the objects into the smallest $\hspace{.57 in}$ number of bins into which the objects can be packed".) $;$ –  May 31 '15 at 23:31

1 Answers1

2

In the decision problem, $k$ is given, so the answer is yes, or no (a decision). In the optimization problem $k$ is unknown, and we have to find out how small can it be (the optimal solution). The bigger question asks if there is a logical connection between possible solutions to these two problems, such that the complexity of the respective algorithms is corelated.

André Souza Lemos
  • 3,276
  • 1
  • 14
  • 30
  • so can we just increment k from 0 to infinity and find when the decision problem returns true? is that poly? we have no idea when its gonna terminate – user2237160 May 31 '15 at 19:38
  • Well, that's another question... ;-) And you seem to be very close to the answer. – André Souza Lemos May 31 '15 at 19:40
  • 1
    See, the problem you were given allows you to assume that the decision problem can be solved in polynomial time. That makes it quite easy. – André Souza Lemos May 31 '15 at 19:43
  • okay, so we just keep incrementing the k until it returns yes, then we know it can fit in k bins and the running time is O(k n^i) for some integer i (since its polynomial time to decide) and the value k is how many times we ran this? – user2237160 May 31 '15 at 19:51
  • but how do i determine the actual optimal solution for fitting the items? Which items go in which bin? – user2237160 May 31 '15 at 19:52
  • It's $O(f(n)n^i)$ (and $f(n)$ is the number of attempts - a function of $n$, investigate what could this be). The answer to your last question is: write a version of the program you just specified, and see what it gives you (of course, you will have to find an algorithm that solves the decision problem - in polynomial time, should it exist). Should be fun! – André Souza Lemos May 31 '15 at 20:17
  • @user2237160. "but how do I determine the actual optimal solution...Which items go in which bin?" You can't determine that using this construction. By the way, a binary search for $k$ is what you want to use, but in any case that will just answer the question "What is the least value of $k$ for which there is a solution?" – Rick Decker Jun 01 '15 at 01:19
  • @user2237160 Also, check this out: http://en.wikipedia.org/wiki/Bin_packing_problem. – André Souza Lemos Jun 01 '15 at 01:26