A Polynomial-Time Exact Algorithm for 
 k
 -Depot Capacitated Vehicle Routing Problem on a Tree

This paper proposes a polynomial-time exact algorithm for the 
 
 k
 
 -depot capacitated vehicle routing problem on a tree for fixed 
 
 k
 
 (
 
 k
 
 -depot CVRPT for short), which involves dispatching a fixed number of 
 
 k
 
 capacitated vehicles in depots on a tree-shaped graph to serve customers with the objective of minimizing total distance traveled. The polynomial-time exact algorithm improves the 2-approximation algorithm when 
 
 k
 
 is a constant.


Introduction
is article investigates routing k capacitated vehicles in fixed depots to serve customers. According to [1], this problem is equivalent to dispatching k vehicles located at distinct depots (referred to as k-depot CVRP). e k-depot CVRP can be described as follows: Given a complete, undirected graph G � (V, E) with vertex set V and edge set E, there is a given depot set D with |D| � k, where a vehicle of capacity Q is located at each depot in D, and a nonempty set of customer locations J � V∖ D. Each edge e ∈ E is associated with a nonnegative edge weight w(e). e k-depot CVRP involves determining a set of k tours to cover all the customers in J such that the total customer demand served by each vehicle does not exceed Q.
e objective is to minimize the total edge weight of all tours.
If demand of a customer cannot be split, the k-depot CVRP has a feasible solution if and only if its corresponding Bin Packing Problem [2], with the number of bins equal to that of depots and bin capacity equal to vehicle capacity, has a feasible solution. en, polynomial-time exact algorithm is unavailable even for the tree-shaped graph. According to Li and Simchi-Levi [3], if demand of a customer can be split (demand of a customer can be served by more than one vehicle), the problem reduces to a k-depot CVRP with each customer having unit demand and with vehicle capacity Q of each vehicle equal to the maximum number of customers that can be served by a vehicle. is paper considers the splittable demand case and develops polynomial-time exact algorithm under the assumption that each customer has a unit demand.
We use I � (G, D, J, w, Q) to denote an instance of the k-depot CVRP. A feasible solution to I can be defined as a k-cycle collection C which satisfies the following: (i) Each customer is served by exactly one cycle in C. (ii) Number of customers served by each cycle in C does not exceed Q. (iii) Each cycle in C contains a distinct depot in D. It is noted that if there exists a k-tree collection T which also satisfies (i), (ii), and (iii), we call it a k-tree cover of G. Duplicating each edge in a k-tree cover T constitutes a k-cycle collection C.
For the min-max k-traveling salesmen problem on a tree (min-max k-TSPT), which involves determining a set of k tours for k salesmen who have infinite capacity to serve all customers located on a tree-shaped network T, with the objective of minimizing the greatest weight among all tours, Xu et al. [4] developed a pseudo-polynomial-time exact algorithm through dynamic programming. Supposing that the underlying tree T is a fully binary tree [4], the basic idea underlying the dynamic programming for the min-max k-TSPT is to join subtrees in T l (the subtree of T rooted at vertex l) and T r (a subtree of T rooted at vertex r) to form subtrees in T v , in which l and r are the left child and right child of v, respectively. However, in the k-depot CVRPT, each vehicle has a capacity of Q. Although the dynamic programming in [4] has been extended to solve a k-TSPT under a min-sum objective in the same article, it cannot be directly extended to the capacitated case. Meanwhile, it is noted that the best approximation algorithm for the k-depot CVRPT was provided in the thesis of Hu [5] and achieved an approximation ratio of 2. e CVRPT with number of depot part of the instance has been proved to be NP-hard by [5], and the 2approximation algorithm was proposed for this NP-hard case.
Concerning the k-depot TSP, a special case of the k-depot CVRP with infinite capacity, and the first constant approximation algorithm was obtained by [6], which achieves an approximation ratio of 2. For the same problem, Xu et al. [7] provided an extended Christofides heuristic, which is proved to achieve a tight approximation ratio of 2 − (1/k).
To answer the question of whether or not there exists a 3/2-approximation algorithm for the k-depot TSP, Xu and Rodrigues [8] designed an edge exchange algorithm which is proved to achieve an approximation ratio of 3/2.
For the multiple-depot CVRP with unlimited vehicles, Li and Simchi-Levi [3] first provided a tour partitioning approximation algorithm for the problem and analyzed the worst-case performance ratios of the approximation algorithms. Moreover, Cardon et al. [9] also considered multiple-depot CVRP with unlimited vehicle number and extended the Polynomial Time Approximation Scheme (PTAS) for CVRP in [10] to the multiple-depot case and obtained a PTAS with its time complexity corresponding to both the number of vehicles and the vehicle capacity. For the k-depot CVRP on a general graph, which has a fixed number of k vehicles in depots, there is no constant ratio approximation algorithm as far as we know.
We propose the first, as far as we are aware, polynomial-time exact algorithm for the CVRPT with the number of depot k a constant. e proposed algorithm in this article is based on a novel network-flow-based dynamic programming rather than the existing subtreejoining-based dynamic programming in Xu et al.'s work [4]. e network-flow-based dynamic programming provides a more general framework to solve both capacitated and uncapacitated vehicle routing problems on trees. e contribution and significance of this article can be summarized as follows: (1) is article designs a novel polynomial-time exact algorithm based on a network-flow-based dynamic programming for the k-depot CVRPT (2) e polynomial-time exact algorithm for this problem improves the existing 2-approximation algorithm when k is a constant

Dynamic Programming for the k-Depot CVRPT
To simplify the presentation, we first define a "standard" instance of the k-depot CVRPT as follows.
Definition 1. An instance of the k-depot CVRPT is standard if, and only if, the underlying tree is a full binary tree, which means that each vertex in the tree other than the leaves has exactly two children.
According to [11], given any instance I of the k-depot CVRPT defined on an arbitrary tree, we can transform it to a standard instance I ′ of the k-depot CVRPT defined on a full binary tree as follows: (1) Let T ′ � T and w ′ � w.
(2) For each v in T ′ that has only one child, insert a new vertex v ′ into T ′ to be the second child of v by adding Consider each v in T ′ that has more than two children. For each child u of v, other than the first child, move u to be a child of a new vertex v ′ by replacing the edge (v, u) with an edge (v ′ , u) and Similar to the arguments in [11], it can be verified that any feasible solution of I can be transformed to a feasible solution of I ′ with the same objective value, and vice versa. Accordingly, if there exists a polynomial-time exact algorithm for I ′ , then the same algorithm can be applied to obtain a polynomial-time exact algorithm for I, and vice versa.
Based on the definition of standard instance, we assume without loss of generality that the instances in this article are standard and introduce the dynamic programming for the k-depot CVRPT for those standard instances. An outline of dynamic programming is presented in Section 2.1. e dynamic programming has two main phases, (1) flowenumerating phase and (2) flow-splitting phase, which are introduced in Sections 2.2 and 2.3, respectively. Finally, the correctness and time complexity for the dynamic programming are proved in Section 2.4.
Furthermore, to facilitate the presentation, we can assume without loss of generality that vertices in V � v 1 , v 2 , . . . , v n are labeled in a nonincreasing order on their depths in T. We assume without loss of generality that v n is the root of T, and the tree satisfies that all the customers and depots are at the leaves [5]. Figure 1 shows an example of the mentioned tree. In the tree T, there are in total three customers, v 1 , v 4 , and v 6 , and two depots, v 5 and v 2 . Furthermore, the edge weights are shown near the edges. For each v ∈ V, let T v denote the subtree of T that contains v and all descendants of v. In this problem instance, the vehicle capacity Q � 2.

Algorithm.
Denote any edge e as (u, v) and u is the parent of v. Given any feasible solution to the k-depot CVRPT, let the flow f(u, v) be the total customer number within T v served by the depots outside T v minus the total number of customers outside T v served by depots within T v (also called the net customer number). us, for a leaf vertex v which is a customer, the flow f(u, v) equals 1; for a leaf vertex v which is a depot, the flow f(u, v) equals − s and s equals the total number of customers served by the depot. For any nonleaf vertex v, the flow f(u, v) satisfies the flow conservation property [5]; that is, where v 1 and v 2 denote the two children of v. erefore, given any feasible solution C to the k-depot CVRPT, there exists a unique flow f(C) corresponding to C, in which the flow f(e) equals the total net customer number on edge e. In the flow-enumerating phase of the dynamic programming, we try to figure out the flow f(C * ) corresponding to the optimal solution C * . Let Since the flow f * (e) on each edge e, connected to a customer vertex, equals 1 in any optimal solution C * , the flow f(C * ) can be found by an enumeration of flows In an optimal solution, since the total net customer number Based on the flows on all edges connected to the leaves, the flow f(C * ) can be constructed according to the flow conservation property.
en, after we have obtained the flow f(C * ), in the flowsplitting phase, we further figure out the number of customers served in an optimal solution, via a specific edge e, by the depot where f i (u, v) denotes the net customer number served by d i in T v for i � 1, 2, . . . , k. Noticing that, given any T v , the depot d i is either outside T v or inside T v , we can conclude as the minimum total edge length traversed by all vehicles with the ith vehicle serving f i (u, v) net customers within T v for i � 1, 2, . . . , k (including the length traversed on (u, v)). en, one can notice that, for any leaf vertex v, if v is a customer, it can be served by exactly one depot, and thus the state where s i denotes the number of customers served by d i . erefore, the states for any edge (u, v) connected to a leaf vertex v can be computed by a boundary procedure, and the states are further added to a state collection H (v) . Based on the state collections for all the leaves, the dynamic programming constructs a state collection H (v) for any nonleaf vertex v in an increasing order, iteratively. In such a manner, when we construct the state collection for a nonleaf vertex v, the state collections H (v 1 ) and H (v 2 ) have been constructed for the two children of v, respectively. en, the state collection H (v) can be constructed based on H (v 1 ) and H (v 2 ) , by a state recursion procedure.
After all the state collections H (v) have been constructed for v � v 1 , v 2 , . . . , v n , the optimal solution to the k-depot CVRPT can be returned as the "feasible" state with minimum state value in H (v n ) . e details of the dynamic programming can be found in Algorithm 1.
Note that the feasible solution returned by Algorithm 1 is a k-tree cover T. erefore, the optimal objective value to I is exactly twice the value of the minimum length of k-tree cover of T.

Flow-Enumerating Phase.
As mentioned before, we present in this section a flow-enumerating procedure, denoted as Flow(T, D), which finds the flow f(C * ).

) (Construction of flows on edges connected to customers) (4) for each customer v in T do (5)
Let f(u, v) � 1, where u is the parent of v. In the following lemma, it is stated that the flow f(C * ) corresponding to C * is in F.

Lemma 1.
e flow f(C * ) corresponding to C * is in F , and the flow collection F returned by Procedure 1 has a cardinality in O(Q k ).

Proof.
Consider the flow f(C * ). First, for any edge e connected to a customer vertex, the flow on e is equal to one. Second, for any edge e connected to a depot d i , the flow on e where v i denotes the parent of depot d i for i � 1, 2, . . . , k. Meanwhile, due to Step 12, according to the flow conservation property, it can be verified that f(u, v) equals the net customer number in T v in the optimal solution C * . Meanwhile, consider the k edges connected to D. Procedure 1 constructs at most Q k flow combinations on the k edges. erefore, the cardinality of F can be seen to be O(Q k ). □ Example 1. Consider the tree shown in Figure 1 6 , and Q � 2. We apply the flow-enumerating procedure to construct the flow collection F . e flow-enumerating procedure is shown for the case in which s 1 , For v 7 , noticing that v 4 and v 3 are two children of v 7 , the flow f(v 9 , v 7 ) is constructed by the flow conservation property; that is, erefore, the flow f(2, 1) in F is shown in Figure 2, in which the flows are indicated near the edges.
For the case s 1 , s 2 � 1, 2 { }, the flow constructed by the flow-enumerating procedure is shown in Figure 3.
Since the capacity Q � 2 and the customer number |J| � 3, it can be seen that any feasible solution to I satisfies that s 1 , s 2 � 2, 1 { } or s 1 , s 2 � 1, 2 { }. In summary, the flow collection F contains the flows f (2, 1) and f(1, 2), as indicated in Figures 2 and 3.

Flow-Splitting Phase.
In this section, we present the procedures developed to construct H (v) for a leaf vertex and a nonleaf vertex, respectively. Procedure 2. Boundary procedure, Bound(v, F). any f(s 1 , s 2

Input: A leaf vertex v and a given flow collection
Example 2. Let us continue Example 1. We construct the state collection H (v) for all the leave vertices, v 1 , v 2 , v 4 , v 5 , v 6 , respectively. Note that the flow collection F contains two flows f (2, 1) and f(1, 2). For v � v 1 , since v 1 is a customer, for f(2, 1), the boundary procedure adds two states for f(1, 2), the boundary procedure adds the same states [0, 1], erefore, the state collection H (v 1 ) contains two states  Table 1.
Next, we present the state recursion procedure. For any nonleaf vertex v ∈ V, it constructs H (v) based on H (v 1 ) and H (v 2 ) , where v 1 and v 2 are the two children of v. (1) Let H (v) � ∅.
(2) for any (S 1 , , H (v 8 ) , and H (v 9 ) , respectively. First, we construct H (v 3 ) based on H (v 1 ) and H (v 2 ) . In Table 2, all combinations of (S 1 , S 2 ) ∈ H (v 1 ) × H (v 2 ) are shown in the first column, the states constructed based on (S 1 , S 2 ) are shown in the second column, and their state values are indicated in the third column.
Furthermore, based on H (v 3 ) and H (v 4 ) , the state collection H (v 7 ) can be constructed as depicted in Table 3 (those states with " * " are kept in H (v 7 ) ).
Similarly, we can construct H (v 8 ) as in Table 4, in which (S 1 , S 2 ) ∈ H (v 6 ) × H (v 5 ) are shown in the first column.
Finally, we can construct H (v 9 ) based on H (v 7 ) and H (v 8 ) . Since v n � v 9 , we add one more vertex v 10 into the graph with w(v 10 , v 9 ) � 0 and f(v 10 , v 9 ) � 0. Next, we construct the state collection H (v 9 ) as depicted in Table 5.
According to Algorithm 1, only those flows with f 1 (v 10 , v 9 ) � 0 and f 2 (v 10 , v 9 ) � 0 are added to H (v 9 ) . en, the two states with " * " are kept. Since the minimum state value in the state collection H (v 9 ) is 8, Algorithm 1 returns an optimal objective value as 8. Since the minimum total edge length for serving customers in J equals 8, by the fact that each edge is traversed exactly twice in any tour in a tree, the optimal solution to the instance can be seen to be 16.

Correctness and Time Complexity for Dynamic
Programming. We first establish Lemma 2 to prove the feasibility of all the states in H (v n ) .

Lemma 2.
For each v � v 1 , v 2 , . . . , v n , and for each state . . , f k (u, v)] ∈ H (v) obtained in Algorithm 1, it satisfies that (i) each customer in T v is served by exactly one depot and (ii) each depot serves no more than Q customers.
Proof. First, according to Step 6 of the boundary procedure, it can be verified that each customer is served by exactly one depot. Second, according to Step 7 of the state recursion procedure, it can be verified that each depot serves no more than Q customers. us, (i) and (ii) can be verified 1, 2, . . . , k, one can see that the total customer number assigned to d i equals s i , where s i denotes the flow on (u, d i ) in the flow f(s 1 , s 2 , . . . , s k ), which implies that each state in H (v n ) corresponds to a feasible solution to the k-depot CVRPT.
We then establish Lemma 3 to prove the optimality of Algorithm 1, which, together with Lemma 2, will be used to prove the correctness of Algorithm 1 in eorem 1.
Mathematical Problems in Engineering can be applied to solve the k-depot TSPT. It is worth noting that although the dynamic programming devised in this paper can solve the k-depot CVRPT and k-depot TSPT with a min-sum objective, it cannot be applied directly to the min-max k-depot TSPT in Xu et al.'s work [4]. Furthermore, the exact algorithm may set a basis for developing approximation algorithms for k-depot CVRP on general graphs. e approximation algorithms can be designed as in the following two steps: (1) Find a capacitated constrained spanning forest, in which each tree in the forest contains enough vehicles to serve all the customers within the tree. (2) Apply the exact algorithm for the k-depot CVRPT to find an optimal solution for the subinstance restricted on each tree, respectively. Finally, the optimal solution on the capacitated constrained spanning forest is returned as the approximated solution to the k-depot CVRP. However, we can see that developing approximation algorithms for the k-depot CVRP has the following two difficulties: (1) Polynomial-time exact algorithm for finding a capacitated constrained spanning forest is unknown in the literature. (2) How to bound the total edge weight for the optimal solution to the k-depot CVRPT remains an issue.

Data Availability
e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare that they have no conflicts of interest.