## Sphere packing with target volume fraction

0

I've stumbled upon this sphere packing question, and now I have another related one.

How can I have a function that returns a sphere packing with a target volume fraction? Sphere can obviously have different radii.

Thanks for your hints!

I suspect this is a special case of the NP-complete knapsack problem and hence no polynomial algorithm exists. – David G. Stork – 2017-09-20T17:49:33.500

Yes, it is, but I am also content with some brute-force approximated solutions. – senseiwa – 2017-09-21T09:52:23.273

This sounds like it could be an interesting puzzle, but I think I might be missing the point. Can you be a bit more specific? What are the constraints on the (radius distribution of/number of/placement of/etc.) spheres? Why not just stop the linked function when the right volume is reached? Why would returning a single sphere of the target volume be wrong (aside from being boring)? – aardvark2012 – 2017-10-03T02:32:38.867

The most probable constraint is passing a probability distribution to the computation, so that radii will adhere (more or less) to it. Yes, I'd like to stop when the target volume ratio is obtained, but a single sphere would be so boring, I agree with you! – senseiwa – 2017-10-05T14:16:54.190