We employ the Monte Carlo method to study a constrained optimization problem — packing hard spheres with unequal radii (r2 > r1) into a 3D bounded region and discuss its connection with the Gamma Knife radiosurgery treatment planning. Selection of the best fit solution is based on the Boltzmann factor, e-ΔE/T, which allows us to search for the global optimal solution. As an illustration we determined the least number (≤15) of packed spheres that will occupy the largest volume for three different hypothetical tumor sizes (4115, 10 000 and 36 000 voxels). For the bounded regions and the sizes of the packed spheres that we studied here, the optimal volume packing ratio ranges from 41.3 to 48.7%. From our study, using a lower r2/r1 ratio is more desirable due to the ≤15 radiation shots constraint. The optimal volume packing ratio can be obtained within a relative short CPU computing time and could provide a good starting point for the radiosurgery treatment planning.