Let's consider a region like this:
The aim is to find the "Chebyshev center" of the region. By using the polygons, one can approximate the perimeter of region by an $n$-gon ($n$ is large enough). Then by saving the coordinates of the perimeter in two vectors, say $x$ and $y$, and using Linear programming, compute the minimal-radius ball enclosing the region. But I want to try another way, an optimization!
I have two data sets, produced by MATLAB, (get them from here) and I want to find the Chebyshev center by optimization (not linear programming). From here I learnt how to find the nearest distance of an interior point from it's boundary:
X = "KP" /. imp // Flatten;
Y = "KI" /. imp // Flatten;
pts = Transpose[{X, Y}];
Nearest[pts, {3, 1.5}]
(* {3,1.5} is a sample interior point *)
If I denote the nearest distance by $d$, the aim is to maximize $d$ (or minimize $-d$) over box inside region. (Like $x \in [1.5 \; 4.5] , y \in [0.5 \; 2]$.) The Chebyshev center will be obtained by maximizing $d$. But I can't define to Mathematica how treat with FindMinimum
and Nearest
.
Nearest
command likeNMaximize
? I'm not sure. $\endgroup$ – user2667048 Feb 3 '14 at 17:09Nearest[...][[1]]
becauseNearest
returns a list. Also your inner function might need to be done asnearest[x_?NumberQ,y_?NumberQ] := nf[{x,y}][[1]]
wherenf
is aNearestFunction
created from your data points. Reason for this is to avoid any attempt by the outer optimization to use symbolic computations since the inner optimizer is in effect a black box. $\endgroup$ – Daniel Lichtblau Feb 3 '14 at 17:19nearest[x_?NumberQ, y_?NumberQ] := EuclideanDistance[{x, y}, nf[{x, y}][[1]]]
$\endgroup$ – Daniel Lichtblau Feb 3 '14 at 17:36Nearest
. It doesn't take arguments like 1.5<=x<=4.5. General remark: Go to basic documentation before you go to MSE. $\endgroup$ – Daniel Lichtblau Feb 3 '14 at 19:10