3

I have a problem from homework where I need to find an O(n.log(n)) greedy algorithm for the minimum number of lines required to intersect all circles in the plane, as shown with the example below.

The minimum number of lines is 4

The starting point of all the lines is (0,0) which is the origin point. The set C contains n circles, where each circle c_i has information about its radius r_i and its centre coordinate (x_i, y_i).

I have tried making greedy rules:

  1. iterate over each circle in the set C and pick c_i
  2. construct 3 lines from origin to c_i, where 2 lines are tangent lines that only intersect 1 point in the circle, and 1 line is secant line that goes through the circle via its center.
  3. iterate over other remaining circles c_j (j != i) and look how many circles intersect with these lines
  4. choose the line L_i and remove the circles that intersect with it from the plane.
  5. continue until the plane is empty.

But I don't think that this greedy rule will achieve the optimum solution and its complexity won't be O(n.log(n)).

Any hints or full solution is OK. It is also mentioned in the problem sheet that greedy rules that give minimum + 1 lines is fine.

psmears
  • 26,070
  • 4
  • 40
  • 48
BolbazarMarme
  • 1,221
  • 2
  • 13
  • 25
  • I'm not sure that 2 x tangent + secant lines is correct, because you could have smaller circles missed: https://imgur.com/a/RhHU6 But it seems like a good idea, perhaps upgrade to a triangle from the same points and then check for polygon intersection with other triangles instead. – BurnsBA Apr 18 '18 at 15:52
  • So a line from the origin going perfectly to the north can't be continued perfectly to the south - they will count as 2 lines, not as one? – user unknown Apr 18 '18 at 21:12
  • @userunknown yes – BolbazarMarme Apr 18 '18 at 23:44

2 Answers2

1

Since you can use one line more than the minimum, you may start with an arbitrary line. Continue line by line clockwise until all circles are intersected. Each new line should have the greatest possible angle to the last as long as no circle lies between them. The 2 tangent lines you found is useful to find how far you can go in each step, but it will be time consuming to check every circle for each step. See if you can figure out how to speed it up.

Centih
  • 86
  • 1
  • 4
1

This problem looks like “covering segments by points”. You can google for that or look here https://medium.com/competitive/covering-segments-by-points-fc2c56c4b038 for instance. In your case instead of segments you have angles for each of your circles. And lines instead of points.

The only difference is that the segments don’t lie on a line but on a circle. That’s why you’re allowed one extra line in your response to be able to pick a starting point arbitrarily.

algrid
  • 5,600
  • 3
  • 34
  • 37