Abstract

A new problem arises when an automated guided vehicle (AGV) is dispatched to visit a set of customers, which are usually located along a fixed wire transmitting signal to navigate the AGV. An optimal visiting sequence is desired with the objective of minimizing the total travelling distance (or time). When precedence constraints are restricted on customers, the problem is referred to as traveling salesman problem on path with precedence constraints (TSPP-PC). Whether or not it is NP-complete has no answer in the literature. In this paper, we design dynamic programming for the TSPP-PC, which is the first polynomial-time exact algorithm when the number of precedence constraints is a constant. For the problem with number of precedence constraints, part of the input can be arbitrarily large, so we provide an efficient heuristic based on the exact algorithm.

1. Introduction

A traveling salesman problem on path (TSPP for short) arises in dispatching an automated guided vehicle (AGV) to visit a set of locations along the wire which transmits signal to navigate the AGV. For the wired AGV, a slot is cut into the floor where a wire is placed, and the slot is cut along the path that the AGV is to follow. A sensor installed on bottom of the AGV detects the radio signal from the wire to navigate the AGV. The areas where AGVs are applied have increased significantly. By survey of Vis [1], typical applications of AGVs include manufacturing, distribution, and transshipment. Other contexts for TSPP can also be found in the applications of other linear service networks, such as laser drill in manufacturing, tracked crane in container terminal, and school bus shuttling in transportation.

We then illustrate the TSPP by the example in Figure 1.

In this example, the AGV is travelling along the wire (in grey) to shuttle materials between the two conveyors to the four workstations. It has in total four workstations to be visited, where conveyor 1 is the start point of salesman. We denote the start point as 0 and denote the four workstations as 1, 2, 3, and 4, respectively. There are two precedence constraints restricted on the four customers as follows: which means that customer should be visited before customer and customer should be visited before customer .

Imbedded by the special underlying network, TSPP is a special case of the classic traveling salesman problem. Without any constraints, TSPP can be solved trivially. Though there are a deluge of researches contributing to TSP and its varieties, there is no, as far as we know, literature dealing with TSPP-PC directly. Although TSP with precedence constraints, as a special case of TSP, is known to be NP-complete (Garey and Johnson [2]), whether or not TSPP-PC is NP-complete is unknown in literature. In this paper, we design dynamic programming for the TSPP-PC, which is the first polynomial-time exact algorithm when the number of precedence constraints is a constant. For the problem with number of precedence constraints, part of the input can be arbitrarily large, so we provide an efficient heuristic based on the exact algorithm.

The exact algorithm is based on dynamic programming, which takes into consideration the last vertices in all precedence constraints visited by the salesman rather than all the vertices visited. Since the number of precedence constraints is a constant , then the dynamic programming is expected to achieve a polynomial-time running time.

This paper is organized as follows: Section 2 is the literature review for the related research and Section 3 introduces the formal problem definition. The dynamic programming for TSPP-PC is provided in Section 4, and the dynamic programming can be proved to be the first polynomial-time exact algorithm for TSPP-PC with number of precedence constraints being a constant. In Section 5, we study TSPP-PC with arbitrary large precedence constraints and develop a heuristic based on the exact algorithm. We have a conclusion and give suggestions for the future work in Section 6.

2. Literature Review

TSP is intensively famous and well-studied in the literature [3], which includes two main streams of varieties: time windows (Foccaci et al. [4]) and precedence constraints (Mingozzi et al. [5]). As we know, it is a NP-hard problem; hence there is no general polynomial-time exact algorithm. However, many exact but not polynomial-time algorithms are developed to solve TSP. One may refer to Lawler et al. [6] to take a glance at general TSP solution approaches.

Though TSP is not polynomial-time solvable unless NP = , there are many special cases which are well solvable. Lawler et al. [6] and Burkard et al. [7] provide complete surveys for the well solvable special cases of TSP. The most important special case of solvable TSP is so-called pyramidally solvable TSPs. The pyramidal tours have two nice properties. First, finding a minimum cost pyramidal tour takes only time, in terms of computation complexity. Second, there exist certain structures of distance matrix which guarantee the existence of a pyramidal optimal tour. Up to now, this distance matrix structure has been found to guarantee the shortest pyramidal tour: Monge matrices, Supnick matrices, Demidenko matrices, Kalmanson matrices, Van der Veen matrices, and generalized distribution matrices. All of these special matrices impose certain conditions on the distance matrices and, therefore, guarantee the existence of pyramidal optimal tour.

Though the general Euclidean TSP is still NP-hard (Sanjeev [8]), there are some cases that are well solvable. One of them, which is similar to TSPP, is -line TSP introduced in Deĭneko and Woeginger [9], where the vertices lie on parallel (or almost parallel) lines in the Euclidean plane. TSPP is a special case of -line Euclidean TSP with . However, the previous research on this scope does not incorporate the considerations of precedence constraints.

The permuted Monge TSP introduced in Burkard et al. [10] also forms an extensive large class of solvable TSPs. A matrix is called a permuted Monge matrix if there exists a permutation such that is a Monge matrix. Similar to Euclidean TSP, although the general TSP on permuted Monge matrices is not polynomial solvable, a number of specific forms of matrices provide the possibility of polynomial solving algorithm.

For the TSP, some works contribute to the literature by providing approximation algorithms rather than exact algorithms. Based on a tree algorithm which is used to provide an approximated TSP tour, Rathinam et al. [11] have developed a -approximation algorithm for multiple traveling salesmen problem. Later, Xu et al. [12] improved this result to through providing extended Christofides heuristics for this problem. Later, Xu and Rodrigues [13] have developed a -approximation algorithm called Exchange Algorithm for the same problem, which achieves the best approximation ratio unless the Christofides heuristics for the TSP can be further improved.

Mingozzi et al. [5] proposed a dynamic programming strategy for the TSP with time windows and precedence constraints, and a nice bounding function is adopted to reduce the state space graph. In the dynamic programming of Mingozzi et al. [5], its state is defined as , which can be interpreted as the family of all possible paths from the start point, visiting all customers in the customer subset , stopping at customer , and finishing visiting at time . Since the set clearly has an exponential size to the problem scale, the dynamic programming cannot be expected to achieve a polynomial-time running time to return an optimal solution to the TSPP-PC. For TSP with precedence constraints, Moon et al. [14] presented an efficient genetic algorithm, in which a topological sort is utilized, and a new crossover operation is developed for genetic algorithm.

Though the TSP with precedence constraints has been studied in the literature, we still need to bridge the gaps for TSPP-PC. The first gap lies in lacking of an answer to the open question of whether or not the problem is NP-complete. The second gap is the absence of an efficient heuristic for the AGV industry.

3. Problem Definition

In TSPP-PC, a salesman is supposed to visit a set of vertices, which are located along a path. The distance between two vertices is measured by the Euclidean distance on the path. The objective of the TSPP-PC is to determine the optimal sequence of the vertices to be visited with the total traveling distance minimized and without violating the given precedence constraints.

Formally, we can represent the TSPP-PC as follows. Suppose the salesman is located at , so-called start point, originally, and he is expected to visit a set of vertices along a path, denoted by . For , we use to denote the coordinate of vertex and use to denote . Hence, the distance between and , denoted by , is determined by The objective of the problem is to determine a sequence of vertices, such that the total travel distance where is minimized, without violating the precedence constraints imposed. That is, the salesman starts from the start point, visits all the vertices one by one as the sequence, and finally returns to the start point, subject to the precedence constraints. Let denote the collection of all the precedence constraints, for . Strictly, where is denoted as We have for , which means that each precedence constraint must begin from vertex . For any single precedence with vertices, it is noted that has the th priority. The vertex can be visited if all vertices with higher priority () have been visited. For simplicity of notation, we denote the precedence as . Taking in the first section as an example, , where and vertex must be visited before vertex and vertex can be visited unless vertex has been visited. Thus, any instance of TSPP-PC can be described as .

One can notice that, for instance to the TSPP-PC, in a single precedence constraint, a vertex appears exactly once; otherwise, multiple in a single precedence constraint leads to a contradiction because any vertex in between consecutive ’s should be visited both after and before . Furthermore, if more than one precedence constraint shares a common vertex , the instance may have no feasible solution because two precedence constraints share common vertices that may be contradictive. For example, the two precedence constraints and share two vertices and , and the two constraints are contradictive because should be visited before in and should be visited after in , which implies there exists no feasible solution for this instance. To guarantee existence of feasible solution, we consider only those instances that all precedence constraints in share no common vertex, which implies that each vertex appears in all precedence constraints in at most once. For precedence where , any vertex can be visited if and only if all vertices in before have been visited.

In this paper, we first consider the number of precedence constraints, , is independent of the instance input and design the polynomial-time exact algorithm with time complexity based on dynamic programming. Since the exact algorithm has an exponential running time when is part of the problem instance and can be arbitrarily large, we design a heuristic algorithm based on the exact algorithm for the TSPP-PC with two precedence constraints.

Next, we show as follows that, for any instance of the TSPP-PC, finding an optimal visiting sequence in suffices an optimal visiting sequence in . Let denote the coordinate which is the biggest among all the vertices in . That is, . We further define the set of vertices that are on the right-hand side of vertex as ; that is, .

Furthermore, we define the set . Clearly, the set of is decomposed as , , and ; that is, .

We are now in position to present the first property of TSPP-PC to remove the consideration of vertices in and .

Property 1. For any instance of TSPP-PC, an optimal solution must be in the form of where the solution visits vertices in one by one after it visits the vertex .

This is true because there is no precedence constraint imposed on the vertices in and finally to reach the vertex , the distance of trip from to and from back to could not be shortened.

Due to Property 1, we can remove the consideration of the vertices in . After we obtain the optimal visiting sequence in the vertex set which excludes from , we insert the vertices in to establish the final sequence.

Furthermore, we are even able to remove the consideration of vertices in . That is because when we schedule the vertices in , to reach the vertex , the salesman would pass by all the vertices in as the continuity of the traveling. Because the vertices in have no precedence constraint, the salesman could visit these vertices when passing by them.

Based on the fact above, we can simplify this problem by removing the consideration of the vertices in and . After an optimal visiting sequence in is obtained, we can solve the problem with and as shown in Algorithm 1:

Algorithm 1 (transformation of optimal sequence in to optimal sequence in ). ⁡⁡
Input. An optimal visiting sequence in is denoted as .
Output. An optimal visiting sequence in is denoted as .(1)Set .(2)Find the sets , , and , and .(3)Insert the vertices in into when the salesman passes by them. Afterwards, we obtain a new sequence .(4)Insert the vertices in into after in a nondecreasing order to obtain .

The following theorem states the correctness for Algorithm 1.

Theorem 2. Given any optimal visiting sequence for , Algorithm 1 returns an optimal visiting sequence for .

Proof. We prove the correctness for Theorem 2 by contradiction. Suppose there exists a visiting sequence with total distance , whose travel distance is shorter than . We can construct as follows a shorter visiting sequence . Since the distance from to the farthest vertex in is a constant, denoted as , then shortcutting all vertices in from leads to a visiting sequence with distance . Note that has a shorter distance than the visiting sequence obtained in Algorithm 1 because has a distance shorter than . Finally, notice that shortcutting vertices in from obtains with the same travel distance and shortcutting vertices in from obtains with the same travel distance. One can conclude that the travel distance for is less than , which contradicts the assumption that is the optimal visiting sequence in .

4. Exact Algorithm for TSPP-PC

In this section, we focus on the TSPP-PC with constant precedence constraints. As mentioned before, our task is to find the first polynomial-time exact algorithm for this problem.

Before introducing our dynamic programming for finding the optimal sequence in , we need to state a new property for an optimal solution which is a basis of our dynamic programming.

Property 2. For any instance of the TSPP-PC, an optimal sequence must visit a new vertex (the vertex that has not been visited in the existing sequence) at each step of the salesman. Thus, an optimal sequence contains each vertex in exactly once.

This property holds by the fact that, supposing the salesman visits a vertex more than once in a sequence, we can always shortcut duplicated to obtain a new sequence with equal or shorter total length.

We use to denote the last vertex that salesman has just visited in the th precedence, and so we can use to denote the set of vertices that the salesman has just visited in the precedence constraints.

Recall that the precedence constraints are imposed by

By definition of , we can conclude that if the salesman has visited in for , then all the vertices in before have been visited and all the vertices in after have not been visited.

Let denote the state that the salesman has just visited in all the precedence constraints and stops at the vertex , where .

Let denote the minimum travel time taken by the salesman who starts from the start point and ends up with state . We use to denote all those states that can reach state by exact one step of the salesman. For any vertex in with , let denote the immediately previous vertex before in the precedence that contains . Let denote the vector obtained by replacing in by . It is noted that, for the state , since the salesman has visited all the vertices in and stops at , then before salesman’s last step, he must have visited all the vertices in and can start from any vertex of to reach in the last step. Hence, by definition of and above analysis, we can see that

With the current state being , if (the vertex has a previous vertex in ), before the step which arrives at the state , the salesman must start with a state and arrives via the edge . Meanwhile, with the current state being , if , since vertex has been visited initially, according to Property 2, we do not need to consider this state as a potential for optimal solution, and thus we let if . Then, the recursion function can be

To facilitate the dynamic programming, we define boundary conditions as follows:where in which the coordinates are all equal to zero.

Based on the recursion equation, the optimal travel time could be written aswhere and denotes the last vertex in for .

In summary, based on the dynamic programming, we describe the exact algorithm as in Algorithm 3. The exact algorithm is based on Property 2. Since the salesman visits a new vertex at each step, then it takes steps for the salesman to visit all the vertices (without the step to return to the start point). Meanwhile, it is observed that if it takes steps for the salesman to reach a state , then the salesman must start from a state in which takes exact steps. Hence, we can iteratively calculate the state values for all states which take the salesman steps with .

Algorithm 3 (exact algorithm for the TSPP-PC). ⁡⁡
Input. It is an instance to the TSPP-PC.
Output. It is an optimal objective value to .(1)For , calculate by boundary conditions (9).(2)For , do the following:(a)Find all the solutions for with and denote the set of all solutions as .(b)For each element , calculate with by recursion equation (8), where denote the th vertex (excluding vertex ) in .(3)Calculate the optimal objective value to by (10).

Next, we state the correctness and time complexity of Algorithm 3 in the following theorem.

Theorem 4. Algorithm 3 returns an optimal solution to the TSPP-PC with a time complexity in .

Proof. Based on the dynamic programming, to prove the correctness of Algorithm 3, it suffices to prove that, for any state that can be reached by the salesman, Algorithm 3 returns its state value, that is, for and any with for , Algorithm 3 returns .
We prove the correctness by induction. First, for those states that can be reached by 0 step, that is, for and , we have . For any state that can be reached by the salesman with steps, suppose the state values have been returned by Step (2) of Algorithm 3 when it is repeated for . We prove as follows, for any state that can be reached by the salesman with steps, the state values are returned by Step (2) of Algorithm 3 when it is repeated for . For any state that can be reached with steps, by definition of , since the salesman visits one new customer in each step and the total number of customers that have been visited is , it can be seen that there exists such that .
According to definition of , we know that there exists such that . By assumption of the induction, all the state values for with and have been returned, which implies that have been returned. Thus, by recursion equation (8), the state value can be returned.
We analyze the computation complexity of this exact algorithm as follows. The number of precedence constraints is . In Algorithm 3, each iteration of Step (2) needs to calculate state value with and where for , which has a running time in ( for ). Then, totally, the computation effort of Algorithm 3 is in , which has a polynomial running time only when is a constant independent of the input size.

Example 5. Let us use the example in Section 1 to illustrate the exact algorithm for TSPP-PC.
First, by boundary conditions in (9), in Step (1) Algorithm 3, when and we have Then, in Step (2)(a), when , we have For and , we have and . Then, by recursion equation (8) with and , since , we have For and , we have and . Then, by recursion equation (8) with and , since , we have Similarly, for , we have When Step (2) is repeated for , we have For , we can obtain that For , we can obtain that For , we can obtain that When Step (2) is repeated for , we have For , we can obtain that For , we can obtain that When Step (2) is repeated for , we have For , we can obtain that Thus, in Step (3), according to (10), we have that the optimal objective value equals

5. Heuristic Algorithm for the TSPP-PC

Based on the dynamic programming for the TSPP-PC, we can develop the first exact algorithm for this problem. As shown in Theorem 4, the dynamic programming has a time complexity of , which is a polynomial running time when is a constant independent of the problem instance. The constant precedence number commonly applies to the case when the AGV has loading positions. For instance, when an AGV has loading positions, it has a capacity of loading at most items simultaneously, and thus it only needs to consider precedence constraints where is a constant.

In comparison, for this AGV with no fixed loading positions, its loading capacity depends on the sizes of different objects, and thus the number of precedence constraints is part of the instance input. When is part of the problem instance and can be arbitrarily large, the dynamic programming has an exponential running time. Hence, we need to develop an efficient heuristic for the TSPP-PC with arbitrarily large .

Although the dynamic programming has an exponential running time when is part of the problem instance, it is still quite efficient when applied to the instance with (with a running time of ). Based on this observation, our heuristic for the TSPP-PC is based on an iterative insertion of vertices in one precedence constraint and applies the dynamic programming for TSPP-PC with to the current visiting sequence for the salesman (which can be taken as the first precedence) and the precedence that is to be inserted (which is the second precedence) to find an optimal visiting sequence for the TSPP-PC with two precedence constraints. The details of the heuristic algorithm can be described in Algorithm 6.

Algorithm 6 (heuristic algorithm for the TSPP-PC). ⁡⁡
Input. It is an instance to the TSPP-PC.
Output. It is a feasible solution to .(1)Let a visiting sequence . Do the following until .(a)Suppose currently has precedence constraints, denoted as . Find the precedence in such that the first vertex in has a closest distance with last vertex in .(b)Apply Algorithm 3 to obtain an optimal solution to the TSPP-PC with two precedence constraints and .(c)Let and .(2)Return .

To test the efficiency of the heuristic algorithm for the TSPP-PC, we conduct several numerical experiments for different scale of problem instances. In the first set of numerical experiments, we focus on testing the average performance of the heuristic over the greedy insertion algorithm that is usually applied by the industry.

In the subsequent numerical experiments, we use the following settings. In total 100 problem instances of different scales are generated. The problem instances contain only customers in the precedence constraints. Meanwhile, as mentioned before, we consider in the problem instances only those precedence constraints sharing no common customers. The 100 problem instances are divided into 10 groups with the th group having precedence constraints for . The biggest problem instance has in total 50 customers with 10 precedence constraints. Each customer is randomly generated with the coordination from .

In the following, we briefly introduce the greedy insertion algorithm that is usually applied in the industry. In the greedy insertion algorithm, it starts with the visiting sequence containing only the start point. In each iteration of the greedy insertion algorithm, from the current standing point of the salesman, it finds out the closest available customer that has not been visited in all precedence constraints, adds the customer to the visiting sequence, and removes the customer from the precedence. The greedy insertion algorithm repeatedly inserts customer into visiting sequence until all the customers have been inserted.

Next, we compare the average objective value and running time for each group of the problem instances. In Table 1(a), the second column and third column indicate the objective value and the running time for greedy insertion algorithm, the fourth and fifth column indicate the objective value and the running time for the heuristic algorithm, and the final column indicates the improvement of the objective of the heuristic versus the objective of the greedy insertion algorithm.

From Table 1(a), one can see that, with growth of scale of the problem instance, the heuristic algorithm has a much better average performance than the greedy insertion algorithm. For the problem instances with two precedence constraints, the objective value of the heuristic algorithm and greedy insertion algorithm is relatively close. For the problem instance with 5 precedence constraints (Group 5), the improvement ratio can be seen to be 61.1%. For the problem instance with at most 10 precedence constraints (Group 10), the improvement ratio has been raised up to 136.5%. From the perspective of the running time, when precedence constraints in each problem instance are no more than five, running times of the heuristic algorithm and the greedy insertion algorithm are comparable. With increasing of number of precedence constraints, the running time of the heuristic algorithm rises for two reasons. The first reason is that the iterations of the heuristics go up with the number of precedence constraints and the second reason is that the running time for each iteration goes up with number of the total vertices in the two precedence constraints.

To test the robustness of the heuristic, we also run the 100 problem instances in a different manner which revises Step (1)(a) of Algorithm 6 as inserting the precedence in with minimum index. We also compare the average performance and running time of revised Algorithm 6 to the greedy insertion algorithm. In the following table, the second and third column indicate the average objective value and running time for the greedy insertion algorithm, the fourth and fifth column indicate the average objective value and running time for Algorithm 6, and the final column indicates the improvement of the objective of the greedy insertion algorithm versus the objective of the revised algorithm.

From Table 1(b), we can see that, firstly, the running times of Algorithm 6 and revised Algorithm 6 for each group are very close. Moreover, revised Algorithm 6 has a relatively close improvement ratio over the heuristic when compared to the greedy insertion algorithm. In conclusion, the heuristic algorithm based on the exact algorithm is robust with the polices that determines the precedence to be inserted in Step (1)(a) of Algorithm 6.

6. Conclusion

In this note, we considered the TSPP-PC, which is a variety of TSPs. Though TSP is widely studied, whether or not TSPP-PC is polynomial-time solvable remains an open question in the literature. We provide a positive answer to this problem when number of precedence constraints is part of the input size and develop efficient heuristic for the problem with arbitrarily large .

Future work is supposed to be taken on these directions. First, we are expecting to prove the NP-hardness for the TSPP-PC with part of the input size. Second, for the case that different precedence constraints share common vertices, it remains to develop an exact algorithm or to prove its NP-hardness. Third, developing heuristic algorithm with searching part of the state space in the dynamic programming is supposed to be another interesting research direction.

Competing Interests

The authors declare that they have no competing interests.

Acknowledgments

This work was supported in part by the National Science Foundation with Grant 71201127 and National Science Foundation with Grant 71201128.