Characterizing the optimality gap and the optimal packings for the bin packing problem