Minimum circle cover problem

The minimum circle cover problem - a very classic problem.
The question is probably, for n points on the plane, find a circle with the smallest radius that can cover all the points.
First of all, we can start from an empty set R, continuously add points on the plane to R, and at the same time maintain the minimum circumscribing circle of R, we can get a simple solution.
Another idea is to select two points arbitrarily first, and draw a circle with the diameter of the line connecting the two points. Then judge the remaining points to see if they are all inside the circle (or on the circle), if they are, it means that the circle has been found. If not all: Suppose the first two points we use are p[1], p[2], and the first point found not in the circle (or on the circle) is p[i], then we Use this point p[i] to find the smallest covering circle covering p[1] to p[i-1].
To find the smallest covering circle from p[1] to p[i-1] for a certain point p[i], we can first use p[1] and p[i] to make a circle, and then from 2 to i- 1 to determine whether the points are not on the circle, if they are, it means that a circle covering 1 to i-1 has been found. If not all are: Suppose we find the first point that is not on the circle as p[j], then we use two known points p[j] and p[i] to find the smallest covering 1 to j-1 Cover the circle.

And for the two known points p[j] and p[i] to find the minimum covering circle, as long as from 1 to j-1, the kth point is found to pass p[k], p[j], p[i] The circle of three points, and then judge whether k+1 to j-1 are all on the circle. If they are all, it means that the circle is found; if there is not, then use the new point p[k] to update the circle.

Therefore, this problem is transformed into several sub-problems to solve.

Since three points determine a circle, our process roughly does the work of finding a circle from no point, to one point, two points, and three points.

The proof of correctness and the calculation of complexity will not be introduced here. You can go to the complete algorithm introduction: http://wenku.baidu.com/view/162699d63186bceb19e8bbe6.html

Related question 1:
There are some ships on the sea that need to communicate with the land, and some base stations need to be arranged on the coastline. Now abstract the problem as, above the x week, give the coordinates p1, p2, ..., pn, pi=(xi,yi), xi>=0, yi<=d, 1<=i<= of N ships N, the base station of the x-axis security can cover all the points in the area of ​​radius d, and at least a few points must be placed on the x-axis to cover the points above the x-axis. Try to design an algorithm to solve this problem

Design idea:
First sort all the points according to the abscissa from small to large. When the point set is not empty, the leftmost point is taken out each time, and the point is regarded as a point on the circumference, and a circle is drawn with the distance d from the point to the point on the x-axis as the center, and d as the radius. , and then remove the points contained within the circle. Then continue to select a leftmost point, and repeat the above operations until the point set is empty, which means that all points are covered, and the number of circles obtained at this time is the desired answer.

Related Question 2:
Given the coordinates of n points on a plane, find the smallest rectangular area that covers all of these points.
First, let's think about such a problem. Given n rectangles on a plane (coordinates are integers, and there may be overlapping parts between rectangles and rectangles), find the total area covered by them. The usual idea is to open a two-dimensional Boolean array of the same size as the two-dimensional coordinates to simulate the "coverage" of the rectangle (fill in the position of the rectangle with True). Unfortunately, this idea has some problems here, because the coordinate range in this question is quite large (the coordinate range is an integer between -10^8 and 10^8). But we found that the number of rectangles n<=100 is much smaller than the coordinate range. Each rectangle will "use" two values ​​on the horizontal and vertical coordinates (the upper and lower, left and right borders of the rectangle), and the coordinates of 100 rectangles are only used between -10^8 and 10^8 in the horizontal (vertical) coordinates. 200 values. In other words, there are actually only a few useful values. These values ​​will re-divide the entire plane as new coordinate values, leaving out several coordinate values ​​in the middle has no effect. We can "discretize" the range of coordinates to numbers between 1 and 200, so a 200*200 2D array is sufficient. The implementation method is the "post-sort processing" mentioned at the beginning of this article. Sort the abscissa (or ordinate) once and map it to an integer from 1 to 2n, and record the actual distance between each two adjacent coordinates of the new coordinate before discretization (after discretization, actually The entire graphic space has become smaller, which is convenient for calculation, but for each line, there must be a mapping corresponding to the original image, so that the correct area can be calculated. different, the actual area is also different).
write picture description here
The above idea is an example of discretization. It can be seen that discretization greatly reduces the space overhead, and can effectively reduce the time complexity of the algorithm in some difficult problems, which is worth learning and learning.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325980444&siteId=291194637