Okay so the 3 things that determine a BB's maximum range are:
3) Mass ('weight')
Now to actually work out what works best via numerical methods would be a nightmare and here's why:
The coefficient of drag over a sphere DECREASES with increasing Reynold's number. The Reynolds number is determined by the velocity of the sphere/BB (along with other constants). So what does this mean: Shoot the BB faster and it will have a lower coefficient of drag which means more range (yay!)
However: the FORCE of drag is =0.5 X coefficient of drag X Area X Density of fluid (air) X Velocity^2 . So now what that means is the faster you shoot, the bigger the drag force is on the BB and note that the velocity is SQUARED. So what this means is that the faster FPS you have, the faster the BB will slow down INITIALLY...you will still get further distance in the end.
Mass and Velocity:
So the more mass you have the less the BB is affected by drag and outside forces like wind/brush (mass does not change anything about the actual drag forces - only there is more mass for these drag forces to act on). However, the more mass you have the less velocity you have.
Okay so hop-up/backspin works on the Bernoulli principle. Basically the air travelling over the top of the BB is faster than the air travelling on the bottom of the BB. So this velocity difference creates a PRESSURE difference (low pressure on top, high pressure on bottom). So there is a new FORCE upwards (or 'lift' upwards) resulting in longer 'hang time'. Hence why we have hop-up on our guns. So now that we have a longer 'hang time' we want to maximize this by having the largest velocity possible over this time. However, as mentioned previously it is not a simple case of having the highest muzzle velocity (BB mass, coef of drag, etc come into play).
Okay, so now you need to have maximum backspin to increase this differential pressure and increase the hang time. So if you go to a heavier BB you will lose some of this backspin (Note: this is an educated guess!) and velocity.
So in conclusion:
How the hell am I supposed to figure out what works best then you ask! You're going to have to test, measure and play around to see what works best with your set up as everyones guns and hop-ups will perform differently.
Things to remember:
-Lighter BB means more FPS (more range), more backspin (more hang-time), is more affected by wind.
-Heavier BB means less FPS, less backspin, less affected by wind, *should* retain its velocity for longer (ie. velocity drop will be slower).
-Maximizing these things will be very tricky but obviously (IMO) you should focus on maximizing your hop-up to give you the most backspin, creating more 'hang time' for your BB. FPS at the muzzle is not the be all and end all for range!