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...

  • $\begingroup$ (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".) $\;$ $\endgroup$
    – user12859
    May 31, 2015 at 23:31

1 Answer 1


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.

  • $\begingroup$ 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 $\endgroup$ May 31, 2015 at 19:38
  • $\begingroup$ Well, that's another question... ;-) And you seem to be very close to the answer. $\endgroup$ May 31, 2015 at 19:40
  • 1
    $\begingroup$ 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. $\endgroup$ May 31, 2015 at 19:43
  • $\begingroup$ 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? $\endgroup$ May 31, 2015 at 19:51
  • $\begingroup$ but how do i determine the actual optimal solution for fitting the items? Which items go in which bin? $\endgroup$ May 31, 2015 at 19:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.