An Efficient Algorithm for Touring n Circles

This paper proposed an intelligent algorithm, which can build the shortest path of the intersecting circle sequences in the plane. The problem is transformed to a corresponding problem of computing the shortest path of three disjoint circles. And it is also an in-depth study of the traversal problem for the disjoint circle sequences. On the basis of the previous work, the algorithms are developed to construct such shortest path in polynomial time of O(kn) where 1 ≤ k ≤ n under a given computational threshold. Since the algorithm is fully polynomial time consuming, this work can be conducted in layered manufacturing of rapid prototyping, displacement of wireless sensor networks, or other related computeraided design and manufacturing applications.


Introduction
The study on such problems can be applied to layered manufacturing (LM) [1], sensor networks and other related computer-aided design and manufacturing. For example, in the layered manufacturing technology, the required geometry in model is cut with a laser beam on a thin material, and all cut geometric shapes are superimposed to obtain a 3D physical shape. In the production process of layered manufacturing, if we control the laser beams cut each geometric shape along the shortest traversal path, we will improve the productivity. In that case, we assume that the geometry in LM is circle, then the main problem in this paper is to find the shortest path of circles.
This touring problem, to find the shortest path of circular sequences in the plane, is an extension of the TSP problem [2]. The TSP problem is a classic combinatorial optimization problem and it can be described as follow. Travelers need to visit n cities, start from one city, visit each city only one time then return to the starting city, and the access path should be the shortest. When n cities are unordered in the TSP problem, this problem will be NP-hard [3]. Otherwise, the TSP problem can be solved optimally in linear time. Furthermore, if the access targets are abstracted as the circles, then it will be the main problem in this paper, which can be described as follows. The n circles are numbered from 1 to n, i.e., O 1 ; . . . ; O n . In these circles, some of them may intersect each other, and the other may not. We need to choose one point on the border of each circle, which can yield the shortest traversal path of all the circles.
In 2008, Chou et al. proposed a function [4], which can find the shortest path between two points and a circle, by solving the equations. According to the equation, a dynamic point p on the boundary of the circle O can be deduced, which can build the shortest path between two fixed points and the circle O. This function is referred to the "point-circle-point" method, denoted as PCP.
Chou et al combined the PCP method in 2010 and proposed an algorithm, which can find the shortest path of disjoint-circle circular sequences in O(kn), where 1 ≤ k ≤ n is related to the threshold given in the article, called Odd-Even [5].
Chou et al. combined PCP and Odd-Even algorithm in 2012 to design an new algorithm, named DBB (Dominant-Branch-and-Bound) [6], which can build the shortest path of disjoint unordered circles in O(kn*e n ), where 1 ≤ k ≤ n is related to the threshold given in the article. The DBB algorithm mainly solves the problem of touring unordered circles in order, and it reduces the time complexity from the original O(kn*n!) to O(kn*e n ) by improving the branch-and-bound method.
In summary, the touring problems of disjoint circles, either ordered or unordered, have been solved in previous works. To the author's knowledge, there is no discussion about the problems of joint circles. Therefore, we analyzes this problem and designs an algorithm which can solve the traversing problem of circles in this paper, specifying that the circles are ordered and we give the start and end points to tour these circles. As shown in Figure.

The PCP method
This paper will use the PCP method to solve the optimal access point on the circle O i , so that we can compute the shortest path of three circles, called the partial shortest path, as shown in Figure. 2(a). We use this method to find the partial shortest path between O i-1 , O i and O i+1 , then the path of n circles can be optimized and shorten by computing the partial shortest path, until the shortest traversal path be solved. Therefore, PCP is a basic method for this paper. The PCP is shown in Figure.
From the above derivation, an important lemma is given. Lemma 1. The Euclidean shortest path in the twodimensional plane, from one point outside the circle via one point on the border of the circle to one point outside the circle, can be computed using Eq. (1).
The proofs of the convergence and correctness of Lemma 1 can be found in [4]. In Odd-Even, after the pre-processing mentioned in this paper, the solution of the partial shortest path is only the case of reflection, and the reflection case mean that the partial shortest path of three circles is formed by the reflection path of light, which can be solved by PCP, as shown in Figure. 3(a). However, when the circles can be intersected, there will be a situation that cannot keep with the reflection situation, as shown in Figure. 3 (b). There are two points A and B, and A is outside the circle O. B is inside the circle O. In this situation, we cannot apply the solution as the reflection situation. And it is easy to find that if we connect the two points A and B directly, then the intersection p between the line segment AB and the circle O will be the partial shortest path point. This case will be referred to as the crossing situation. Therefore, when the circles can be intersected, there are two ways to solve the partial shortest paths, such as the reflection situation and the crossing situation. So we will analyze the condition of the two situations and design corresponding traversal algorithms.

Geometric analysis
Theorem 1. There are only the reflection situation and the crossing situation in solving the partial shortest path of the circle sequences, when the circles allow to be intersected.
Proof. This paper allows circles to intersect. The positional relationship of circles is: (a) disjoint, (b) tangent, (c) intersected, (d) contained. Under these four kinds of relationships, we use three circles to analyze the partial shortest path of a circle sequence. Therefore, we divides the partial area of the circle sequence into the outer area of the circle O i , the inner area of the circle O i , and the border of the circle O i . During these divisions, we analyze all the possible positions of the circle O i , the point p i-1 and the point p i+1 in the three areas. As shown in the Fig. 4. Since the point p i-1 is symmetric to the point p i+1 , they can be interchanged without affecting the solution of the partial shortest path, which is to say one point can be the point p i-1 , and it also can be the point p i+1 . For the Figure. 4(b), either the point p i-1 or the point p i+1 is inner the circle O i , it can be seen that the solution of the partial shortest path only satisfy the crossing situation. As shown in Figure.    To sum up, all the positions of the circle O i , the point p i-1 and the point p i+1 have only the reflection situation or the crossing situation, so Theorem 1 is proved.

The division of reflection and crossing
According to Theorem 1, we can sure that the solution of the partial shortest path contains only two situations, the reflection and the crossing. According to the division of convex polygons and related problems [7,8], we divide the plane into two regions, called reflection region and crossing region, denoted by R and C. According to the position relationship between circle O i ，the point p i-1 and the point p i+1 , we divide the solution of the shortest path of the circle sequence into two cases.
In the first case, the point p i-1 is outside the circle O i . For this case, we can draw two tangent lines crossed p i-1 and touched circle O i . The tangent points are denoted by Q 1 and Q 2 , as shown in Figure. 6(a). We use C denote the inward area that enclosed by the circle O i and the tangent lines, and the region of C contains the circle boundary. As can be seen from Figure. 6(b), wherever the point p i+1 is at any position in the region of C, the partial shortest paths are all belong to the crossing situation. We use R denote the periphery area of the circle and tangent. As shown in Figure. 6(c), wherever the point p i+1 is located at any position of R, the partial shortest paths are always the reflection situation. In the second case, when the point p i-1 is inner the circle. We can see that as long as the point p i+1 is outside the circle, there is only the crossing situation, and when the point p i+1 is inner the circle, there is only the reflection situation. As shown in Figure.

Algorithm
We assume that a set of circle sequences O = {O 1 , O 2 ; . . . ; O 5 }, a starting point s, and an ending point t are on the plane.
Step.1. We initialize an access path for this circle sequences, and denote the length of the path as L 0 , then record the initialized path points ρ = {p 1 , p 2 ; . . . ; p 5 }, as shown in Figure. 8(a).
Step.2. After fixing the contact point on each even circle, then we can divide the region R and C for all odd circles so that the solution method (reflection or crossing) can be determined, and finally the partial shortest path point on each odd-numbered circle can be solved by two methods. As shown in Figure. 8(b).
Step.3. After fixing the contact point on each odd circle, then we can divide the region R and C for all even circles so that the solution method (reflection or crossing) can be determined, and finally the partial shortest path point on each even-numbered circle can be solved by two methods. As shown in Figure. 8(c).
Step.4. We calculate the absolute difference between the lengths of two adjacent paths, denoted by d.
Step.5. If d   repeat steps 2~4. If d   ( is the maximum numerical accuracy of the given computer), stop iterative calculation and output the sequence of path point ρ. The algorithm ends. As shown in Figure. 8(d).  2 We should calculate the set of initial path points of all circles in the circle sequence, denoted as ρ, and the path length of ρ is denoted as L0; The proofs of the convergence and correctness of Algorithm 2 are given below.

Algorithm feasibility and time complexity analysis
Theorem 2. Algorithm 2 can yield the shortest path of n circles, which allows circles to intersect each other.
Proof. Light traverses along the least-time path, so a shortest n-gon inside another convex n-gon can be shown to follow the light fully reflection [5,11]. The algorithm starts from the starting point s, then it finds the shortest path point on the circle sequence by using solution of the reflection situation or the crossing situation. Finally, it reaches the end point t. For the reflection situation, it satisfies the total reflection of light. For the crossing situation, it also satisfies the linear propagation of light. Therefore, the path ultimately sought by this algorithm satisfies the light propagation path, and it is the shortest path. Theorem 3. Algorithm 2 is convergent in polynomial time of O(kn), where 1 ≤ k ≤ n under a given computational threshold.
Proof. The initial length L 0 is determined by selecting arbitrary points on each circle. Clearly holds during the ''Do until" in steps. The convergence criterion now depends on j, and j depends on ε. If ε is specified, then j is bounded. Since holds in every iteration, and unlimited computing precision is not required, one j = ω exists in which the computational threshold is reached, i.e.
∃ j = ω, s.t. . Because for a sequence of n circles, calculating at least one shortest path requires O(n), so k ≥ 1. It may also require multiple iterations, and each iteration requires O(n), so the total time complexity is O(ωn)，let O(ωn) = O(kn) ， since unlimited precision is not required, a computational threshold can be specified to end the process before O(n 2 ) [5,9,10], meaning that k ≤ n. Therefore, the algorithm is convergent at O(kn) ≤ O(n 2 ), where 1 ≤ k ≤ n under a given computational threshold.

Conclusion
The problem of layered manufacturing (LM) is introduced in this work. The studied problem can be simplified as computing the shortest n-gon connecting n circles. Although the shortest path of n disjoint ordered circles can be solved by Algorithm Odd-Even, no algorithm provides the exact steps to build the shortest path of n circles, which allow circles to intersect each other. This work proposed an efficient algorithm to conquer the problem. Algorithm 2 provides the base model to steadily construct the shortest path of n circles in polynomial time of O(kn), where 1 ≤ k ≤ n under a given computational threshold.
This work does not discuss the case where the n circles are the shortest paths in the unordered case, and the time complexity in the unordered case increases by at least ，which is one of the future works. The other future work will consider optimizing the traversal algorithm proposed in this paper, and find a method that can be more concise and universally applicable than Lemma1 for solving the partial shortest path points.