Model Pack Circles
Constants
n = 4 ! number of circles
End Constants
Variables
! x-coordinates of circle centers
x[1:n] >= -2.0, <= 2.0
! y-coordinates of circle centers
y[1:n] >= -2.0, <= 2.0
! radius of circumscribing circle
circrad = 2.0, >= 1.7, <= 2.5
End Variables
Intermediates
ints[1] = 1
ints[2:n] = ints[1:n-1] + 1
! radii of circles
r[1:n] = ints[1:n]**(-0.5)
End Intermediates
Equations
! distance between pairs of circles is >= sum of radii
sqrt((x[2] - x[1])^2 + (y[2] - y[1])^2) >= r[2] + r[1]
sqrt((x[3] - x[1])^2 + (y[3] - y[1])^2) >= r[3] + r[1]
sqrt((x[3] - x[2])^2 + (y[3] - y[2])^2) >= r[3] + r[2]
sqrt((x[4] - x[1])^2 + (y[4] - y[1])^2) >= r[4] + r[1]
sqrt((x[4] - x[2])^2 + (y[4] - y[2])^2) >= r[4] + r[2]
sqrt((x[4] - x[3])^2 + (y[4] - y[3])^2) >= r[4] + r[3]
! circles are inside circumscribing circle
circrad - sqrt(x[1:n]^2 + y[1:n]^2) >= r[1:n]
minimize circrad
End Equations
End Model