Find radius such that packing circles into a fixed rectangle maximises total area of circles I want to pack equal-sized circles into a rectangle with width $w$, and height $h$. The total area of all of the circles should be maximised.
the radius of each circle can vary, but is contrained; $r\in[a,b]$
How do I go about solving this?
Would be great if I can get help with that general case. If not, the following specific case would also be good.
$w=11.2$   $h=2.8$   $a=0.45$  $b=0.9$
Thank you!
edit:
I also want the circles to be packed like this

tell me if I'm wrong, but so far I've done the following;
Suppose there are $x$ circles across the bottom width. Then the total length of all the circles is $2rx$.
Suppose the stack is $y$ "layers" of circles high. Then the hight of the stack is $r(\sqrt{3}(y-1)+2)$
So we have 
$2rx=w$
$r(\sqrt{3}(y-1)+2)\leq{h}$
or
$2rx\leq{w}$
$r(\sqrt{3}(y-1)+2)=h$
 A: This can be solved by means of integer programming regarded the size of the input is not too large. 
Details, problem formulations and numerical experiments can be found here.
A: I came across this page while working on a similar problem for the automated controls on a spooled cable. I'm solving a different problem, but I'll just address the height calculation in my answer.
Your solution looks pretty close and gets the trig right, except it doesn't pass my fat finger sanity test for height.
Its helpful to define each step on the inside as r√3 and just count them.
If we plug y=3;r=1, we get h = √3(3-1)+2 = 2√3+2. If I take my finger and plop it on the graphic counting radii, this tells the story of a full radius to the center of the bottom circle, then √3 up to the top of the first layer, then another √3 to the middle of the middle layer, then a full radius up. Thats only 2 layers...
Starting from the bottom edge of the first row, we get 1 full radius, then twice r√3 up to the center of the next layer, then twice r√3 again to the center of the top layer, then another full radius. So we lose one layer to full radii and count the rest by root3s. This becomes
height = 2r+2r√3(y-1) = r(2√3(y-1)+2) for 0<y
plugging in y=3 yields 2r + 4r√3.
