Keywords

1 Introduction

The territory design problem (TDP), sometimes referred to as the districting problem or territory alignment problem, is the problem of grouping small geographical units called basic units BUs into larger geographical clusters, named territories, according to relevant planning criteria. Typical applications of the territory design problem include sales territory design [1], political districting [2], school districting [3], and public services districting [4, 5]. TDP and its variations have been researched since the 1960s [6], using a variety of models and algorithms. The territory design problem is NP-Hard [7] and thus metaheuristics were used in order to solve this problem. For state-of-the-art models, algorithms, and applications to the territory design problem we refer the reader to [8].

An essential criterion in the TDP is the compactness of districts. One way to achieve this is by minimizing a dispersion measure. A common dispersion measure used in classical problems such as p-median and p-center, is the distance to the centroid of the district. Using a center based measure has some limitations for problems where it is not clear how to define possibly “good” centers. In such cases, a dispersion measure based on the diameter of a territory is more appropriate [9].

In this paper, we address a special version of the TDP, called the Delivery Territory Design Problem (DTDP). DTDP aims to design a set of p territories such that the maximum diameter of a territory is minimized, while satisfying several planning requirements such as disjoint territories, and balancing in terms of three attributes: driver workload, commodity demand, and number of customers. Unlike in the TDP, we allow two nodes to be assigned to the same territory as long as there exists a path between them, not necessarily fully contained in the district. The problem is motivated by real-world applications from delivery companies, where a driver can be assigned two serve two BUs as long as there is a street between them.

The rest of this paper is structured as follows; In Sect. 2, we discuss the related works to the territory design problems and their applications. In Sect. 3, we describe the problem and provide the mathematical model of the TDP, while in Sect. 4 we outline the VNS heuristic and its components. We present computational experiments and results in Sect. 5 and conclude our findings in Sect. 6.

2 Related Work

The problem studied in this paper is related to the commercial territory design problem (CTDP) which was proposed by Rios-Mercado and Escalante [7]. CTDP seeks to maximize a compactness criterion of p territories subject to planning criteria such as disjoint districts, attribute balancing, and district connectivity. In their paper, compactness is measured by the distance of a node from the center it is assigned to. The authors propose a GRASP algorithm consisting of three phases: construction, adjustment, and local search. The algorithm produces good quality solutions, however that comes at a high computational cost. Rios-Mercado et. al. [9] expanded upon the CTDP with a new model that makes use of a diameter-based dispersion measure instead of its center-based counterpart. They used the GRASP metaheuristic in combination with path relinking to solve instances of 500 nodes and \(p=10\) districts. The algorithm provides good results in terms of the dispersion measure however they are computationally expensive.

In this paper, we propose to solve the DTDP by a Variable Neighborhood Search (VNS) algorithm. The core paradigm behind VNS is to systematically change neighborhood structures to prevent plateaus at local optima [10]. Over the years, VNS has been extensively researched and now boasts a wide array of extensions [11]; General VNS, Variable Neighborhood Descent, and Reduced VNS to name a few.

VNS has been successfully used to solve related problems to TDP. Mladenovic et al. [12] proposed a Basic VNS metaheuristic with vertex substitution local search to solve the p-center problem. Their results show that VNS, on average, outperforms Tabu Search, whereas Tabu Search is better for a small p.

Hindi and Fleszar [13] proposed to solve the capacitated p-median problem by a VNS metaheuristic based on the generalized assignment problem. They test their results on five standardized sets of benchmark instances and show that the proposed heuristic finds the best known solutions as well as it improves a previously best-known solution.

Brimberg et. al. [14] showed that Skewed General VNS performs well for the capacitated clustering problem. They showed that evaluating moves prior to accepting inferior solutions is preferable to random shaking procedures. The authors tested the algorithm on the largest set of instances (MDG2000). The Skewed General VNS showed to be the fastest procedure out of the tested metaheuristics with up to 1.55% improvement over other metaheuristics.

Mladenovic et. al. successfully used the Basic VNS to solve the obnoxious p-median problem in the Less-is-more approach (LIMA) [15]. They proposed a simple facility best improvement local search that lies in between the first and best improvement strategies. They found new best solutions for four instances and ties with 133 instances out of a set of 144 benchmark instances.

Contribution: In this work we propose a VNS based meta-heuristic for solving the DTDP problem, with relaxed connectivity criteria. To the best of our knowledge, this technique has not been previously applied to this problem. Via numerical experiments, we show that the VNS procedure outperforms the algorithm of [9] by \(6.35\%\) on average.

3 Problem Description and Mathematical Model

The input to the DTDP is a graph \(G=(V,E)\), where the nodes are the set of basic units (BU) and the edges represent the streets between BUs. For each node, we are given a set of attributes A such as number of customers, product demand, and workload. The value of attribute \(a\in A\) of BU \(i \in V\) will be denoted by \(w_a^i\).

We denote a p-partition of the set V by \(X = (X_1,..., X_p)\) where \(X_m \subset V\) is called a territory of V. The size of the territory \(X_m\) with respect to attribute \(a\in A\) is denoted by \(w^a(X_m) = \sum _{i\in X_m} w^a_i\).

We call a partition X balanced w.r.t an attribute a, if the size of each territory \(X_m\) in X satisfies \(\frac{w^a(X_m) }{\mu ^a} \in [1-\tau ^a,1+\tau ^a]\), where \(\mu ^a\) is the average of attribute a over all the nodes. Here, \(\tau ^a\) is a tolerance parameter that is prespecified by the user.

The goal of DTDP is to find a balanced \(p-\) partition w.r.t. each attribute, that minimizes the maximum diameter over the territories created. Moreover, we require that any two BUs in a territory are connected by a path in G.

We denote the collection of all the p-partitions of the set V by \(\varPi \). The TDTP can be formulated as a combinatorial optimization as follows:

$$\begin{aligned}&\min _{X \in \varPi } \max _{m \in M}\max _{i,j \in X_m}\{d_{ij}\} \end{aligned}$$
(1)
$$\begin{aligned}&\text {s. t.} \nonumber \\&\frac{w^a(X_m)}{\mu ^a} \in [1-\tau ^a,1+\tau ^a] \quad m \in M, a \in A \end{aligned}$$
(2)
$$\begin{aligned}&G_m = G(V_m,E) \text { is connected} \quad \quad \quad m \in M \end{aligned}$$
(3)

The formulation in this paper is based on the mathematical model outlined for the CTDP (see Rios-Mercado and Escalante [9]). The objective function (1) minimizes the maximum diameter in a \(p-\)partition X. Constraints (2) requires that the \(p-\)partition should be balanced in each attribute \(a\in A\). Constraints (3) stipulate that each node of a district must be connected by a path in graph G.

4 Variable Neighborhood Search Procedure

We propose to solve the DTDP by a Basic VNS (BVNS) procedure, in the spirit of the LIMA paradigm [15]. One of the reasons the BVNS is used is that it does not require high computational resources and provides high-quality solutions. Using this variant, we are able to diversify the solution through random neighborhood structures and intensify it through the deterministic neighborhood structures. By doing so, we are able to avoid plateauing at local optima.

The next subsections will outline the construction of the initial solution, the Basic VNS procedure, the local search variants, and the shaking procedure.

4.1 Initial Solution

To generate the initial solution, we use the construction phase of the GRASP algorithm outlined in  [9] once. The construction phase starts with a set of p randomly chosen seeds in V. The algorithm then greedily assigns nodes \(i \in V\) to the p seeds while attempting to maintain the balancing criteria. If it is not possible to maintain the balancing constraints, the unassigned nodes are allocated to the closest seed. We denote the solution obtained by \(X_{in}\).

4.2 Basic Variable Neighborhood Search

Consider a p-partition \(X=(X_1,...,X_p)\). We define a neighborhood \(S_k(X)\) as the set of solutions obtained by reallocating k nodes from a territory \(X_{m_1}\) to a territory \(X_{m_2}\).

To evaluate the quality of a solution \(X=\{X_1,\ldots ,X_p\}\), the VNS procedure uses the function \(\varPsi (X)\) introduced in [9] and defined as a linear combination between a function related to the maximum diameter and a measure of the infeasibility of X. More precisely

$$\varPsi (X) = \lambda F(X) + (1-\lambda )G(X), $$

where

$$ F(X) = \bigg (\frac{1}{d_{max}}\bigg )\max _{m \in M}\max _{i,j \in X_m}\{d_{ij}\}, $$
$$ d_{max}=\max _{i,j \in V}\{d_{ij}\}, $$

and

$$ G(X) = \sum _{m=1}^{p}\sum _{a\in A}g^a(X_m), $$

where,

$$ g^a(X_m) = \frac{1}{\mu ^a}max\{w^a(X_m)-(1+\tau ^a)\mu ^a,(1-\tau ^a)\mu ^a-w^a(X_m),0\}. $$

Furthermore, \(\lambda \) is a user specified parameter that controls whether the objective function or the infeasibility is more favored in the cost function calculation.

A general outline of the Basic Variable Neighborhood Search (BVNS) procedure is given in Algorithm 1. The BVNS uses a shake procedure and two local search procedures, called LS-NBI and LS-DBI, that will be described in Sect. 4.3.

figure a

The BVNS takes in as input the initial solution \(X_{in}\), the maximum number of neighborhoods used in the shaking procedure \(k_{max}\), and the maximum number of repetitions \(\beta _{max}\). While the number of repetitions is not reached, the algorithm executes a shake procedure followed by the the local search procedure LS-NBI (lines 6–7). If the value of \(\varPsi \) is improved, the algorithm performs a sequential neighborhood change step (lines 8–13). Lines (14–15) lead to repeating the BVNS procedure if \(k_{max}\) is reached. Finally line (16) applies the second local search variant, LS-DBI.

4.3 Local Search and Shaking Procedures

The BVNS uses two best improvement local search procedures: Node Best Improvement Local Search (LS-NBI) and District Best Improvement Local Search (LS-DBI).

In both procedures, a move(mi) is defined as re-allocating a node \(i \in V\setminus \{X_m\}\) to territory \(X_{m}\).

Node Best Improvement Local Search (LS-NBI). A pseudo-code for Node Best Improvement (LS-NBI) is given in Algorithm 2. The LS-NBI procedure iterates over all the territories of a solution X. For each territory m, move(mi), \(i \in V\setminus \{X_m\}\) that leads to the best improvement in \(\varPsi \) is performed (lines 5–11). LS-NBI terminates either when the maximum number of moves is reached (line 3) or no improved solution is found (lines 12–18).

figure b

District Best Improvement Local Search (LS-DBI). Algorithm District Best Improvement (LS-DBI) is similar to LS-NBI with the main difference being that it iterates over all nodes \(i\in V\) instead of territories. For each node i, it performs the best move(mi), where district m is such that \(i\notin X_m\). The procedure terminates either when the maximum number of moves is reached or when no improved solution is found. We refer to Algorithm 3 for the detailed pseudo-code.

figure c

Shaking Procedure. The shake procedures serves to diversify the search space. Shake(Xk) chooses two random territories \(X_1, X_2\) of the current solution X and moves k random nodes from \(X_1\) to \(X_2\).

figure d

5 Computational Experiments

In this section, we present the results of the numerical experiments we have performed in order to test the proposed algorithms. The algorithms discussed in this section were coded in Python 3.9, and all of the experiments were run on Intel® Xeon X5650 2.67GHz with 72GB RAM.

The computational experiments were performed on randomly generated planar graphs consisting of 500 nodes. We started with a grid graph of \(30\times 30\) nodes, divided into 7 regions as in Fig. 1. We generated three types of graphs; Graph Type Center, Graph Type Diagonal, and Graph Type Corners (G-C, G-D, G-CN) by randomly removing \(900-n\) nodes where \(n=500\) from certain regions while maintaining the connectivity of the nodes in the graph.

We remove \(\lfloor \frac{3}{4}(900-n) \rfloor \) nodes from the regions R3, R4, and R5 for G-C; R1, R4, and R7 for G-D; R1, R2, R6, and R7 for G-CN. Finally, we remove \(\lfloor \frac{1}{4}(900-n) \rfloor \) from the remaining regions for each graph type. When a node is removed, its adjacent edges are also removed.

Fig. 1.
figure 1

Graphical representation of the regions of the graph.

Each node in a graph G has three attributes: demand, workload, and number of customers. The attributes were generated from a uniform distribution in the ranges of [15, 400], [15, 100], and [4, 20] respectively [7]. Furthermore, to simulate real-world scenarios, we generated a distance attribute for edges from a uniform distribution in the range of [5, 20]. The value of the parameters was chosen as follows. For the cost function \(\varPsi (X)\), parameter \(\lambda \) was set to \(\lambda =0.7\). Furthermore, \(p = 10\), \(\beta _{max} = 5\), \(m_{max} = 4\), and \(max\_moves = 100\).

5.1 Impact of Local Search on Initial Solution

In Table 1, the columns LS-NBI and LS-DBI refer to the algorithms in which the initial solutions are improved by applying the respective local search once. Furthermore, the column labeled with “GRASP-LS” refers to the local search procedure described in [9].

The average improvement of LS-NBI, LS-DBI, and GRASP in terms of the objective function value over the initial solutions was \(4.00\%\), \(4.32\%\), and \(1.59\%\) respectively. Table 1 shows the average percentage improvement of the local search variants on each graph type. We note that LS-DBI outperformed the rest of the variants over graph types G-CN and G-D at \(5.26\%\) and \(3.81\%\) respectively. While LS-NBI, outperformed the rest of the variants for graph type G-C at \(4.72\%\).

Table 1. Local search procedures percentage improvement over the initial solution.

We observe that the local search variants LS-NBI and LS-DBI have a different impact based on the graph type that the variant was performed on. Furthermore, we notice that both local search procedures had a high variance in graph type G-CN. This suggests that this particular graph type is difficult to improve upon.

We note that the local search variant LS-DBI outperformed LS-NBI and GRASP-LS for graph types G-D and G-CN at \(3.81 \%\) and \(5.26 \%\) respectively. On the other hand, LS-NBI outperformed all other variants in graph type G-C at \(4.72 \%\). Due to the different performance of both LS-NBI and LS-DBI based on the graph type, we used both local search variants in \(BVNS(X,k_{max},\beta _{max})\).

5.2 Computational Experiments on BVNS

We compared the results of the proposed BVNS algorithm on all graph types with the results of the static Path-Relinking (PR) algorithm presented in [9].

Table 2. Objective Function Percentage Improvement of BVNS over PR.

Figure 2 shows an example solution and a comparison between BVNS and PR. Figure 2(a) shows the BVNS solution of that particular instance while Fig. 2(b) shows the PR solution where each have ten distinct districts. We can see that due to the shaking procedure of the BVNS algorithm, the solution was able to escape local optima regardless of the graph structure and provide significant improvements.

Fig. 2.
figure 2

Example comparison of BVNS and PR.

Table 2 summarizes the results of the objective function improvement of BVNS over PR. We show the minimum, maximum, and average improvement of BVNS over PR for each graph type. On average, BVNS outperforms PR by \(6.35\%\) over all graph types with a maximum improvement of \(20.86\%\) for G-CN. On average, BVNS outperformed PR by \(6.42\%\) for graph type G-C, \(5.21\%\) for graph type G-D, and by \(7.42\%\) for graph type G-CN. We note that BVNS outperformed PR for 27 out of the 30 graphs. PR outperformed BVNS for 3 out of the 30 graphs in terms of objective function value. We note that 2 out of the 3 graphs where PR outperformed BVNS occurred in graph type G-D.

Figure 3 shows the box plot of the percentage improvement of the relative infeasibility of BVNS over PR. We can see that the relative infeasibility of BVNS has shown consistent improvements over PR with the certain outliers in each graph type. This indicates that using the BVNS procedure with LS-NBI and LS-DBI led to improvements of the infeasibility of the solution compared to PR, on average by \(21.7\%\). The relative infeasibility in graph type G-CN has been the most unstable where 3 out of the 6 instances show PR outperforming BVNS in terms of relative infeasibility.

Fig. 3.
figure 3

Relative Infeasibility of BVNS and PR.

Furthermore, Fig. 3 along with the results presented for the average objective function improvement, suggest that the graph type G-D is difficult to improve for both algorithms.

5.3 Running Times

The average running time of BVNS was 394.49 s over all graph types. Among the local search procedures, LS-DBI was less time consuming, with an average of 13.17 s, followed by LS-NBI with an average running time of 17.24 s. Thus, the time difference between the two local search procedures is negligible and provides great benefit in tackling different types of graphs with considerable improvements.

To examine the scalability of the algorithm, we tested BVNS on graphs with nodes \(V=\{500,600,700\}\) with 10 graphs for each graph type. Table 3 shows the CPU time (in mins.) and the standard deviation of every graph type at a different number of nodes.

Table 3. CPU Time (in sec.) and the Standard Deviation of Each Graph Type.

As expected, the running time increases as the problem size grows larger at \(V=100\) increments. We note that for graph sizes \(V=500\) and \(V=700\), graph type G-CN had the lowest mean and standard deviation in their respective graph sizes. On the other hand, for graph size \(V=600\), graph type G-D had the lowest mean and standard deviation.

Furthermore, we can see that in the first increment between \(V=500\) and \(V=600\), the mean CPU time increased at a higher rate that between \(V=600\) and \(V=700\) for graph types G-C and G-CN. This suggests that graph types G-C and G-CN scale well as the problem increases in size. In addition, we note that for graph type G-D, the mean and standard deviation had their lowest rate of increase between graph sizes \(V=500\) and \(V=600\). This suggests that for this particular graph type, scaling the problem size up to \(V=600\) would not present significant increases in run time and that the algorithm would provide a solution in an adequate timeframe.

We note that the high mean and standard deviation for graph type G-D in graph size \(V=700\) can be attributed to the high convergence time caused by relatively small improvements in the balancing constraints for certain instances in this graph type.

6 Concluding Remarks

In this paper, we studied the DTDP, a districting problem often occurring in delivery operations, in which balancing and connectivity constraints are taken into account while minimizing the maximum diameter. We proposed two local search procedures that improve the objective function value and lower the relative infeasibility of a given solution. We used a Basic VNS following the LIMA paradigm under which we used both the local search variants and a simple shake procedure. We conducted computational experiments on graphs of \(V=500\) nodes and \(p=10\) districts with a competitive running time and average improvement at \(6.35 \%\) over all graph types and a maximum improvement of \(20.86 \%\). Furthermore, we conducted computational experiments on graphs of \(V=600\) and \(V=700\) to showcase the scalability of the algorithm.

There are several areas of future research that arise from this problem. One promising area of research, given the results of the Basic VNS, is exploring other variants of VNS such as the General VNS.

Furthermore, applying different local search neighborhoods in conjunction with different neighborhood change steps could allow for further diversification and intensification of the solution space.