! Find minimum circle radius that encloses (CircleMin.lng)
a set of points in 2-space;
! Keywords: Circle, Circumscribe, Cone, Enclosing circle, Euclidean distance,
Hull, LINGO, Radius, Second order cone, SOC;
SETS:
POINT: x, y;
ENDSETS DATA:
! These happen to be corner points of a maximum area polygon for which
the distance between any pair is <= 1;
x = 0.4514926 0.2357990 -0.1126499 -0.4473675 -0.5421421 0.000000;
y = 0.4561146 0.9718018 0.9936347 0.8943502 0.3434647 0.000000;
ENDDATA
! Variables:
x0 = x coordinate of the center of enclosing circle,
y0 = y coordinate of the center of enclosing circle
R = radius of circle;
! Minimize the radius;
MIN = R;
@FREE( x0); @FREE( y0);
! Each point must be distance <= r from center of circle,
using Euclidean distance.
This happens to be a second order cone constraint;
@FOR( POINT(i):
( x(i) - x0)^2 + ( y(i) - y0)^2 <= r^2;
);
|