3 Multi-swap local search for k median forest

# Locating Depots for Capacitated Vehicle Routing

## Abstract

We study a location-routing problem in the context of capacitated vehicle routing. The input to -LocVRP is a set of demand locations in a metric space and a fleet of vehicles each of capacity . The objective is to locate depots, one for each vehicle, and compute routes for the vehicles so that all demands are satisfied and the total cost is minimized. Our main result is a constant-factor approximation algorithm for -LocVRP. To achieve this result, we reduce -LocVRP to the following generalization of median, which might be of independent interest. Given a metric , bound and parameter , the goal in the median forest problem is to find with minimizing:

 ∑u∈Vd(u,S)+ρ⋅d(MST(V/S)),

where and is a minimum spanning tree in the graph obtained by contracting to a single vertex. We give a -approximation algorithm for median forest, which leads to a -approximation algorithm for -LocVRP, for any constant . The algorithm for median forest is -swap local search, and we prove that it has locality gap ; this generalizes the corresponding result for median [3].

Finally we consider the median forest problem when there is a different cost function for the MST part, i.e. the objective is . We show that the locality gap for this problem is unbounded even under multi-swaps, which contrasts with the case. Nevertheless, we obtain a constant-factor approximation algorithm, using an LP based approach along the lines of [12].

## 1 Introduction

In typical facility location problems, one wishes to locate centers and connect clients directly to centers at minimum cost. On the other hand, the goal in vehicle routing problems (VRPs) is to compute routes for vehicles originating from a given set of depots. Location routing problems represent an integrated approach, where we wish to make combined decisions on facility location and vehicle routing. This is a widely researched area in operations research, see eg. surveys [4, 13, 14, 5, 16, 17]. Most of these papers deal with exact methods or heuristics, without any performance guarantees. In this paper we present an approximation algorithm for a location routing problem in context of capacitated vehicle routing.

Capacitated vehicle routing (CVRP) is an extensively studied vehicle routing problem [19] which involves distributing identical items to a set of demand locations. Formally we are given a metric space on vertices with distance function that is symmetric and satisfies triangle inequality. Each vertex demands units of the item. We have available a fleet of vehicles, each having capacity and located at specified depots. The goal is to distribute items using the vehicles at minimum total cost. There are two versions of CVRP depending on whether or not the demand at a vertex may be satisfied over multiple visits. We focus on the unsplit delivery version in the paper, while noting that this also implies the result under split-deliveries.

We consider the question “where should one locate the depots so that the resulting vehicle routing solution has minimum cost?” This is called -location capacitated vehicle routing (-LocVRP). The -LocVRP problem bears obvious similarity to the well-known median problem, where the goal is to choose centers to minimize the sum of distances of each vertex to its closest center. The difference is that our problem also takes the routing aspect into account. Not surprisingly, our algorithm for -LocVRP builds on approximation algorithms for the median problem.

In obtaining an algorithm for -LocVRP we introduce the median forest problem, which might be of some independent interest. The objective here is a combination of -median and minimum spanning tree. Given metric , bound and parameter , the goal is to find with minimizing . Here is the minimum distance between and an -vertex; is a minimum spanning tree in the graph obtained by contracting to a single vertex. Note that when we have the -median objective, and being very large reduces to MST.

### 1.1 Our Results

The main result is the following.

###### Theorem 1

There is a -approximation algorithm for -LocVRP, for any constant .

Our algorithm first reduces -LocVRP to median forest, at the loss of a constant approximation factor of four. This step is fairly straightforward and makes use of known lower-bounds [8] for the CVRP problem. We present this reduction in Section 2.

Then we prove the following result in Section 3 which implies Theorem 1.

###### Theorem 2

There is a -approximation algorithm for median forest, for any constant .

This is the technically most interesting part of the paper. The algorithm is straightforward: perform local search using multi-swaps. It is well known that (single swap) local search is optimal for the minimum spanning tree problem. Moreover, Arya et al. [3] showed that -swap local search achieves exactly a -approximation ratio for the -median objective (this proof was later simplified by Gupta and Tangwongsan [7]). Thus one can hope that local search performs well for median forest, which is a combination of both MST and -median objectives. However, the local moves used in proving the quality of local optima are different for the MST and -median objectives. Our proof shows we can simultaneously bound both MST and -median objectives using a common set of local moves. In fact we prove that the locality gap for median forest under -swaps is also . Somewhat surprisingly, it suffices to consider exactly the same set of swaps from [7] to establish Theorem 2, although [7] does not take into account any MST contribution. The interesting part of the proof is in bounding the change in MST cost due to these swaps— this makes use of non-trivial exchange properties of spanning trees and properties of the potential swaps from [7]. We remark that the -median, -tree (i.e. choose centers to minimize ), and median forest objectives are incomparable in general: Appendix A gives an instance where near-optimal solutions to these three objectives are mutually far apart.

Finally we consider the non-uniform median forest problem in Section 4. This is an extension of median forest where there is a different cost function for the MST part in the objective. Given vertices with two metrics and , and bound , the goal is to find with minimizing . Here is a minimum spanning tree in the graph obtained by contracting to a single vertex, under metric . In contrast to the uniform case , we show that the locality gap here is unbounded even for multi-swaps. In light of this, Theorem 2 appears a bit surprising. Still, we show that a different LP-based approach yields:

###### Theorem 3

There is a 16-approximation algorithm for non-uniform median forest.

This algorithm follows closely that for the matroid median problem [12]. We consider the natural LP relaxation and round it in two phases. The first phase sparsifies the solution (using ideas from [6]) and allows us to reformulate a new LP-relaxation using fewer variables; this is identical to [12]. The second phase solves the new LP-relaxation, which we show to be integral.

### 1.2 Related Work

The basic capacitated vehicle routing problem involves a single fixed depot. There are two versions of CVRP: split delivery where the demand of a vertex may be satisfied over multiple visits; and unsplit delivery where the demand at a vertex must be satisfied in a single visit (in this case we also assume ). Observe that the optimal value under split-delivery is at most that under unsplit-delivery. The best known approximation guarantee for split-delivery is  [8, 2] and for unsplit-delivery is  [1], where denotes the best approximation ratio for the Traveling Salesman Problem. We make use of the following known lower bounds for CVRP with single depot : the minimum TSP tour on all demand locations, and . Similar constant factor approximation algorithms [15] are also known for the CVRP with multiple depots which was defined in the introduction.

The median problem is a widely studied location problem and has many constant factor approximation algorithms. Starting with the LP-rounding algorithm of [6], the primal-dual approach was used in [11], and also local search [3]. A simpler analysis of the local search algorithm was given in [7]; we make use of this in our proof for the median forest problem. Several variants of median have also been studied. One that is relevant to us is the matroid median problem [12], where the set of open centers are constrained to be independent in some matroid; our approximation algorithm for the non-uniform median forest problem is based on this approach.

Recently [9] studied (among other problems) a facility-location variant of CVRP: there are opening costs for depots and the goal is to open a set of depots and find vehicle routes so as to minimize the sum of opening and routing costs. The -LocVRP problem in this paper can be thought of as the -median variant of [9]. In [9] the authors give a 4.38-approximation algorithm for facility-location CVRP. Following an approach similar to [9] one can obtain a bicriteria approximation algorithm for -LocVRP, where more than depots are opened. However more work is needed to obtain a true approximation, and this is where we need an algorithm for the median forest problem.

## 2 Reducing k-LocVRP to k median forest

Here we show that the -LocVRP problem can be reduced to median forest at the loss of a constant approximation factor. This makes use of known lower bounds for CVRP [8, 15, 9].

For any , let and be the length of the minimum spanning tree in the metric obtained by contracting . The following theorem is implicit in previous work [8, 15, 9]; this uses a natural MST splitting algorithm.

###### Theorem 4 ([9])

Given any instance of CVRP on metric with demands , vehicle capacity and depots ,

• The optimal value (of the split-delivery CVRP) is at least .

• There is a polynomial time algorithm that computes an unsplit-delivery solution of length at most .

Based on this it is clear that the optimal value of the CVRP instance given depot positions is roughly given by , which is similar to the median forest objective. The following lemma formalizes this reduction. We will assume an algorithm for the median forest problem with vertex-weights , where the objective becomes .

###### Lemma 5

If there is a -approximation algorithm for median forest then there is a -approximation algorithm for -LocVRP.

Proof: Let Opt denote the optimal value of the -LocVRP instance. Using the lower bound in Theorem 4,

 Opt≥minS:|S|=kmax{Flow(S),Tree(S)}≥minS:|S|=k[ϵ⋅Flow(S)+(1−ϵ)⋅Tree(S)],

where is any value; this will be fixed later. Consider the instance of median forest on metric , vertex weights and parameter . For any the objective is:

 ∑u∈Vqu⋅d(u,S)+ρ⋅d(MST(V/S))=Q2⋅Flow(S)+ρ⋅Tree(S)=Q2ϵ⋅[ϵ⋅Flow(S)+(1−ϵ)⋅Tree(S)]

Thus the optimal value of the median forest instance is at most . Let denote the solution found by the -approximation algorithm for median forest. It follows that and:

 ϵ⋅Flow(Salg)+(1−ϵ)⋅Tree(Salg)≤β⋅Opt (1)

For the -LocVRP instance, we locate the depots at . Using Theorem 4, the cost of the resulting vehicle routing solution is at most where we set . From Inequality (1) it follows that our algorithm is a -approximation algorithm for -LocVRP.

We remark that this reduction already gives us a constant factor bicriteria approximation algorithm for -LocVRP as follows. Let denote an approximate solution to -median on metric with vertex-weights , which can be obtained by directly using a -median algorithm [3]. Let denote the optimal solution to , which can be obtained using the greedy MST algorithm. We output as a solution to -LocVRP, along with the vehicle routes obtained from Theorem 4 applied to . Note that , so we open at most depots. Moreover, if denotes the location of depots in the optimal solution to -LocVRP then:

• since we used a -approximation algorithm for -median [3].

• since is an optimal solution to the MST part of the objective.

Clearly and , so:

 12⋅Flow(Sbi)+12⋅Tree(Sbi)≤3+δ2⋅[Flow(S∗)+Tree(S∗)]≤(3+δ)⋅Opt

Using Theorem 4 the cost of the CVRP solution with depots is at most . So this gives a bicriteria approximation algorithm for -LocVRP, where is any fixed constant. We note that this approach combined with algorithms for facility-location and Steiner tree immediately gives a constant factor approximation for the facility location CVRP considered in [9]. The algorithm in that paper [9] has to do some more work in order to get a sharper constant. For -LocVRP this approach clearly does not give any true approximation ratio, and for this purpose we give an algorithm for median forest.

## 3 Multi-swap local search for k median forest

The input to median forest consists of a metric , vertex-weights and bound . The goal is to find with minimizing:

 Φ(S)=∑u∈Vqu⋅d(u,S)+d(MST(V/S)),

where and is a minimum spanning tree in the graph obtained by contracting to a single vertex. Note that this is slightly more general than the definition in Section 1 (which is the special case when for all ).

We analyze the natural -swap local search for this problem, for any constant . Starting at an arbitrary solution consisting of centers do the following until no improvement is possible: if there exists and with and then . Clearly each local step can be performed in time which is polynomial for fixed . The number of iterations to reach a local optimum may be super-polynomial; however this can be made polynomial by the standard method [3] of performing a local move only if the cost reduces by some factor. Here we omit this (minor) detail and bound the local optimum under the swaps as defined above.

Let denote the local optimum solution (under -swaps) and the global optimum. Note that . Define map as for all . For any , let , and be the length of the minimum spanning tree in the metric obtained by contracting ; so . For any and with we refer to the swap as a “ swap”. We use the following swap construction from [7] for the -median problem.

###### Theorem 6 ([7])

For any with , there are partitions of and of such that ; and there is a unique (for each ) with for all and for all . Define set of -swaps with multipliers as:

• For any , if then swap with .

• For any , if then for each and swap with .

Then we have:

• .

• For each , the extent to which is added .

• For each , the extent to which is dropped .

We use the same set of swaps for the median forest problem and will show the following:

 ∑(D,A)∈Sα(D,A)⋅(Tree(F−D+A)−Tree(F))≤(3+2/t)⋅Tree(F∗)−Tree(F) (2)

Combined with the similar inequality in Theorem 6 (for ) and using local optimality of , we would obtain the main result of this section:

###### Theorem 7

The -swap local search algorithm for median forest is a -approximation.

It remains to prove (2), which we do in the rest of the section. Consider a graph which is the complete graph on vertices (for a new vertex ). If denotes the edges in the metric, has edges ; the edges are called root-edges and edges are true-edges. Let denote the spanning tree of consisting of edges ; similarly is the spanning tree . For ease of notation, for any subset , when it is clear from context we will use to also denote the set of root-edges. We start with the following exchange property (which holds more generally for any matroid), see Equation (42.15) in Schrijver [18].

###### Theorem 8 ([18])

Given two spanning trees and in a graph and a partition of the edges of , there exists a partition of edges of such that is a spanning tree in for each . (This also implies for all ).

We will apply Theorem 8 on trees and . Throughout, and represent the corresponding edge-sets. Recall the partition of from Theorem 6; we refine by splitting parts of size larger than into singletons, and let denote the resulting partition (see Figure 1). The reason behind splitting the large parts of is to ensure the following property (recall swaps from Theorem 6).

###### Claim 9

For each swap , appears as a part in . Moreover, for each part in there is some swap .

Consider the partition of with parts , i.e. each true edge lies in a singleton part and the root edges form the partition defined above. Let denote the partition of obtained by applying Theorem 8 with partition of ; note also that there is a pairing between parts of and . Let denote the true edges of that are paired with true edges of ; and are the remaining true edges of (see also Figure 1). We will bound the cost of and separately.

###### Claim 10

.

Proof: Fix any . By the definition of it follows that there is an such that part in is paired with part in . In particular, is a spanning tree in . Note that the root edges in are exactly , and so is a spanning tree in the original metric graph when we contract vertices . Since is the minimum such tree, we have or . Summing over all and observing that each edge can be paired with at most one , we obtain the claim.

Consider the connected components (in fact a forest) induced by true-edges of : for each let denote the vertices connected to . Note that partitions .

Now consider the forest induced by true edges of (i.e. ) and direct each edge towards an -vertex (note that each tree in this forest contains exactly one -vertex). Observe that each vertex has exactly one out-edge , and -vertices have none.

For each , define the set of out-edges from .

###### Claim 11

.

Proof: It is clear that partitions .

We are now ready to bound the increase in the cost under swaps . By Claim 9 it follows that for each swap , is a part in (and so in ); define as the true-edges of (possibly empty) that are paired with the part of .

###### Claim 12

is a partition of .

Proof: Consider the partition of given by Theorem 8 applied to . By definition, are the true edges of paired (by and ) with true edges of ; and are paired with parts from (i.e. root edges of ). For each part (and also ) let denote the -edges paired with . It follows that partitions . Using the second fact in Claim 9 and the definition s, we have , a partition of .

We prove the following key lemma.

###### Lemma 13

For each swap , .

Proof: By Claim 9, is a part in . Recall that denotes the true-edges of paired with ; let denote the root-edges of paired with . Then using Theorem 8 it follows that is a spanning tree in . Hence is a forest with each component containing some vertex from ; for any let denote vertices in the component containing . In other words, connects connects each vertex to some vertex of .

Consider the edge set . We will add some edges so that connects each -vertex to some vertex of . Since already connects all vertices to , it would follow that connects all vertices to , i.e.

 Tree(F+A−D)≤d(S′A)+d(N)≤Tree(F)−d(EA)+∑f∈Dd(Tf)+d(N).

To prove the lemma it now suffices to construct a set with , such that connects each -vertex to . Below, for any we use to denote the edges of between and .

#### Constructing N

Consider any minimal such that ; recall that s are the connected components of . By minimality of , it follows that is connected in . We now prove two simple claims:

###### Claim 14

For any we have .

Proof: By construction of the swaps in Theorem 6.

###### Claim 15

There exists and such that contains a path between and .

Proof: Let any . Consider the directed path from obtained by following out-edges until the first occurrence of a vertex or . Since -vertices are the only ones with no out-edge , and is acyclic, there must exist such a vertex . Observe that for all ; recall that s (resp. s) are the connected components in (resp. ). So . Suppose that vertex , then which implies since path leaves . So we have and is a path from to .

Consider and as given Claim 15. If then the component of is already connected to . Otherwise by Claim 14 we have ; in this case we add edge to which connects component to . Now using Claim 15, .1 In either case, is connected to in , and cost of increases by at most .

We apply the above argument to every minimal with . The increase in cost of due to each such is at most . Since such minimal sets s are disjoint, we have . Clearly connects each -vertex to .

Using this lemma for each weighted by (from Theorem 6) and adding,

 ∑(D,A)∈Sα(D,A)⋅[Tree(F−D+A)−Tree(F)] (3) ≤ 2⋅∑(D,A)∈Sα(D,A)⋅∑f∈Dd(Tf)−∑(D,A)∈Sα(D,A)⋅d(EA) = 2∑f∈F⎛⎝∑(D,A)∈S:f∈Dα(D,A)⎞⎠⋅d(Tf)−∑e∈M′′⎛⎝∑(D,A)∈S:e∈EAα(D,A)⎞⎠⋅de (4) ≤ 2(1+1t)∑f∈Fd(Tf)−∑e∈M′′de (5) = 2(1+1t)⋅d(E∩M∗)−d(M′′) (6)

Above (3) is by Lemma 13, (4) is by interchanging summations using the fact that (for all ) from Claim 12. The first term in (5) uses the property in Theorem 6 that each is dropped (i.e. ) to extent at most ; the second term uses the property in Theorem 6 that each is added to extent one in and Claim 12. Finally (6) is by Claim 11.

Adding the inequality from Claim 10 yields:

 ∑(D,A)∈Sα(D,A)⋅[Tree(F−D+A)−Tree(F)]≤(3+2t)⋅d(E∩M∗)−d(E∩M),

since and partition the true edges . Thus we obtain Inequality (2).

## 4 Non-uniform k median forest

In this section we study the following extension of median forest. There is a set of vertices with weights , two metrics and defined on , and a bound . The goal is to find with minimizing . Here is a minimum spanning tree in the graph obtained by contracting to a single vertex under metric . The difference from the median forest problem is that the cost functions for the -median and MST parts in the objective are different.

It is natural to consider the local search algorithm in this setting as well, since local search achieves good approximations for both -median and MST. However the next lemma shows that the locality gap is unbounded even if we allow multiple swaps. The example is similar to the locality gap in [12].

###### Lemma 16

The locality gap of non-uniform median forest with multi-swaps is unbounded.

Proof: Fix values . Let , so . Define vertex-weights as follows: and all other vertices have weight . The metric for the -median part is:

 d(x,y)={0 if either x=y or {x,y}={ui,2,ui+1,1} for some i∈[k−1]1 otherwise

The second metric for the MST part of the objective is:

 c(x,y)={0 if either x=y or {x,y}={ui,1,ui,2} for some i∈[k]M otherwise

Observe that for any with , we have iff for all . So the non-uniform median forest objective is smaller than only if .

We claim that the optimal value is at most one. Consider the solution . It is clear that . Moreover, with vertex being the only contributor.

We now claim that the solution is locally optimal under even -swaps. First, observe that and with vertex being the only contributor. So has objective value of . Secondly, notice that every solution obtained by some -swap of has either MST-objective of or median-objective of . Thus is a local optimum and the locality gap is .

We remark that the near-optimality proof of local search in the previous section only requires the following consistency property between the two metrics: for any pair of edges . In spite of the large locality gap, we show that non-uniform median forest admits a constant factor approximation algorithm via an LP approach.

#### The algorithm.

We make use of the following natural LP relaxation for non-uniform median forest. The variables denote the probability of locating a depot at ; denotes the extent to which vertex is connected to a depot at (for the -median part); and denotes the extent to which edge is used in the MST part of the objective. Also is the set of all edges in the metric. Define to be the complete graph on vertices (for a new vertex ) with edges .

 minimize ∑u∈Vqu⋅∑v∈Vd(u,v)xuv +∑e∈Ece⋅ze ($\mathsf{LP}$) subject to ∑v∈Vxuv =1 ∀u∈V (7) xuv ≤yv ∀u∈V,v∈V (8) ∑v∈Vyv ≤k (9) (y,z) ∈SP(H) (10) xuv,yv,ze ≥0 ∀u,v∈V,∀e∈E (11)

Above denotes the spanning tree polytope of graph , which admits a linear description in terms of its edge variables; see eg. [18]. Also corresponds to the fractional spanning tree in with values on edges and value on each edge . It can be checked directly that this is a valid relaxation of non-uniform median forest. Moreover this LP can be solved exactly in polynomial time to obtain solution using the Ellipsoid algorithm.

We now describe the rounding procedure. Let denote the instance of median forest and denote the median part of the optimal LP solution. Apply Stage I of the rounding algorithm in [12] to modify variables to (here and remain unchanged), with the following properties:

• Set of representatives with weights for each , which defines a new instance of non-uniform median forest (the weights of vertices in are zero).

• Any solution to the new instance with objective is a solution to the original instance having objective at most .

• is feasible for .

• Disjoint collection of subsets with for all .

• Collection of pseudoroots with each representative in at most one pseudoroot.

• Map where lies in a pseudoroot for each .

• Each is connected (under ) only to .

• .

Now apply the LP reformulation from Stage II in [12] to eliminate -variables in , using the above structure of , and obtain:

 minimize ∑u∈Rwu⋅[∑v∈P(u)du,v⋅yv+du,σ(u)⋅ ⎛⎝1−∑v∈P(u)yv⎞⎠]+ ∑e∈Ece⋅ze ($\mathsf{LP_{new}}$) subject to ∑v∈P(u)yv ≤1 ∀u∈R (12) ∑v