# If the decision problem can be solved in poly time, show the optimization problem also can [duplicate]

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

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

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.