1 Introduction

The network design problem with relays (NDPR) is a challenging multi-commodity network design problem with side constraints limiting the distance that a commodity can traverse a network without visiting a special node called relay. Given a network and a set of commodities, a path is to be determined to route each commodity from its source node to its target node. In order to continue its journey, a commodity must be reprocessed at certain distance intervals on its route. The reprocessing of a commodity takes place at special nodes, called relays, which must be strategically located on the network such that the total distance on any path segment without a relay node is less than an upper bound \(\lambda \). Being a combination of the network design and facility location problems, the NDPR and its variants have several application areas such as telecommunications networks and distribution systems. In fiber-optic networks, for example, light-wave signals must be regenerated at certain intervals along their routes in order to overcome attenuation (Winters et al. 1993). In natural gas distribution networks, compressors are used to maintain the proper gas pressure (Andre et al. 2009; Kabirian and Hemmati 2007; Tabkhi et al. 2009). In multi-zone truck dispatching systems, loads are transferred to new trucks or exchange drivers at the dispatching hubs en route to their destinations (Ali et al. 2002; Taylor et al. 2001; Üster and Kewcharoenwong 2011). This strategy ensures the continuous movement of loads. In variants of the problem adopted in transportation networks, relay locations (charging stations) should be located within the range of electrical vehicles (Schneider et al. 2014).

In this paper, a partial hybrid algorithm is proposed to solve the version of the problem that includes three types of decisions as defined by Cabral et al. (2007): (1) deciding which edges to be included in the network, (2) determining a route for each commodity, and (3) allocating relay nodes on the commodity routes. In this general form, the NDPR has been sporadically studied in the literature since it was first defined by Cabral et al. (2007) in the context of the wireless network design. Cabral et al. (2007) proposed a mathematical model where both routing and relay location decisions are expressed by a single type of decision variable, which makes the problem separable in terms of commodities. Because the combinations of all feasible paths and relay locations must be generated as input into the model, Cabral et al. (2007)’s model includes a prohibitively large number of decision variables. To address this challenge, Cabral et al. (2007) introduced a column generation approach where only a subset of all feasible path and relay combinations are considered. Although this method does not guarantee optimality, solutions close to optimality can be found in reasonable CPU times. In addition, Cabral et al. (2007) proposed four different construction heuristics to the problem. The common characteristic of these construction heuristics is that a solution is constructed by adding a commodity to the solution one at a time. These construction heuristics differ depending on the computational complexity to select the commodity to add to the partial solution. Kulturel-Konak and Konak (2008) proposed a network flow-based formulation of the problem and developed a genetic algorithm (GA) combined with local search. Their GA’s crossover is a greedy construction heuristic, and solutions are improved by local search operators. Konak (2012) showed that relay locations could be optimally determined for a given set of paths by solving a set-covering problem and developed a hybrid-GA where routes are searched by the GA, and relay locations are determined by solving a set-covering problem. Later on, Konak (2014) applied the same principle to solve the two-edge disjoint NDPR where the relay locations are determined by a Lagrangian heuristic. Kabadurmus and Smith (2015) also studied the two-edge disjoint NDPR by considering edge capacities and proposed a three-stage heuristic based on the mathematical formulation of the problem. Laporte and Pascoal (2011) developed a labeling algorithm to find the minimum cost path with a feasible relay assignment for a single commodity. The authors also extended their labeling algorithm to solve the bi-criteria version of the problem where the cost of paths and relays are minimized concurrently. Li et al. (2012) introduced a column generation approach for the directed version of the problem. Their algorithm is similar to the approach of Cabral et al. (2007) in the sense that the same formulation and column generation approach are used, but Lin et al. (2014) utilized MIP and a variant of the labeling algorithm of Laporte and Pascoal (2011) to solve pricing sub-problems for each commodity. In addition, Lin et al. (2014) proposed a tabu search (TS) to the problem.

Optimal relay assignment on a given network, which is a sub-problem of the NDPR, has also been studied in the literature as a stand-alone problem, particularly within the context of fiber-optic telecommunications networks. Gouveia et al. (2003) aimed to determine the optimal locations of switching stations in an optical network under two conditions: (1) the distance that a light path is routed between two switching stations is less an upper bound (a technological limit); and (2) a light path can be routed through only a few number of hops (a quality-of-service requirement). Chen et al. (2010) defined the optimal regenerator assignment problem as minimizing the number of regenerators to be located in an optical network under the constraint that each node pair is connected through at least one path such that the total distance of each subsequence of the edges on the path without regenerators placed on its internal nodes is less than an upper bound. They also showed that the optimal regenerator assignment problem is NP-complete. In a follow-up work, Chen et al. (2015) studied a generalized version of the problem where only a subset of node-pairs is expected to be connected. They also devised a branch-and-cut approach based on a node-weighted directed Steiner forest formulation of the problem, which was shown to solve instances with up to 200 nodes to optimality.

As briefly summarized above, a limited number of heuristic approaches have been proposed to the NDPR although the exact approaches are only applicable to solve small-sized problem instances. One of the challenges of developing effective heuristics to the NDPR is the dependency between the routing and relay decisions. If a combinatorial optimization problem includes multiple types of decisions variables, it is usually difficult to develop effective encoding schemes and search operators that can take advantage of the special structure of the problem. In the case of the NDPR, the researchers exerted a great deal of effort to devise effective crossover/mutation operators for GA (Konak et al. 2009; Kulturel-Konak and Konak 2008) or local move operators for TS (Lin et al. 2014) because traditional ones are not viable alternatives due to the dependency between the route and relay decisions. In such cases, the problem can be decomposed into sub-problems, each having its own solution space based on the type of decision variables, and then each sub-solution space is searched by its specialized algorithm. In the literature, this approach is called partial hybrid algorithms (Talbi 2002). In this paper, a new partial hybrid algorithm is proposed to solve the NDPR. The contributions of this paper are as follows:

  • We propose an exact algorithm to assign relays for a given set of commodity routes using dynamic programming.

  • We develop a label-setting heuristic to solve the NDPR with a single commodity.

  • These two algorithms are embedded within a variable neighborhood search (VNS) framework to generate new solutions from a current solution. It should also be noted that VNS is applied to the NDPR for the first time in this paper.

The rest of the paper is organized as follows. In Sect. 2, we present the description of the NDPR and a mathematical programming model. In Sect. 3, two dynamic programming-based algorithms for the relay location problem (RLP) are proposed for the single-commodity and multi-commodity cases. In Sect. 4, we present a label-setting algorithm for the one-commodity NDPR to initialize the VNS algorithm. The VNS algorithm with the exact approach for the RLP is provided in Sect. 5. In Sect. 6, computational experiments are carried out using 40 existing problem instances and 40 new problem instances, and the results are compared to the existing algorithms in the literature. Finally, Sect. 7 concludes the paper.

2 Formulation of the problem

We re-formulate the NDPR based on the undirected models by Kulturel-Konak and Konak (2008) and the directed model by Li et al. (2012). The parameters and decision variables of the model are listed as follows:

V :

set of nodes

n :

number of nodes, \(n=\hbox {card}(V)\)

ij :

index of nodes, i=1,2,...,n

\(d_{ij}\) :

distance between nodes i and j

\(c_{ij}\) :

cost for installing an edge between nodes i and j

\(\lambda \) :

maximum distance that a commodity can travel without visiting a relay

A :

set of arcs (ij) that satisfy \(d_{ij} \le \lambda \)

\(r_{i}\) :

cost of locating a relay at node i

H :

set of commodities

m :

number of commodities, \(m=\hbox {card}(H)\)

k :

index of commodities, \(k=1,2,{\ldots },m\)

\(h_{ik}\) :

1 if node i is the source node of commodity \(k; -1\) if node i is the target node of commodity k; and 0, otherwise.

The decision variables used in the model are defined as follows:

\(x_{ij}\) :

binary variable indicating whether arc (ij) is selected (\(x_{ij}=1\)) or not (\(x_{ij}=0\))

\(y_{i}\) :

binary variable indicating whether node i is selected to locate a relay (\(y_{i}=1\)) or not (\(y_{i}=0\))

\(p_{ijk}\) :

binary variable indicating whether arc (ij) is used by commodity \(k (p_{ijk}=1)\) or not (\(p_{ijk}=0\))

\(f_{ik}\) :

non-negative continuous variable indicating the cumulative travel distance of commodity k when arrived at node i without visiting a relay. If node i is the source node of commodity k or is not visited by commodity k, then \(f_{ik}\) is zero; otherwise, it is a positive number.

The objective function is to minimize the total cost, including edge and relay costs.

Problem NDPR:

$$\begin{aligned}&\hbox {Minimize} \sum \limits _{(i,j)\in A,i<j} {c_{ij} x_{ij} } +\sum _{i\in N} {r_i y_i}\nonumber \\&\hbox {S.t.}\nonumber \\&\qquad \sum \limits _{(i,j)\in A} {p_{ijk} } -\sum \limits _{(j,i)\in A} {p_{jik} } =h_{ik}\qquad \qquad \qquad \forall k\in H,i\in V \end{aligned}$$
(1)
$$\begin{aligned}&\qquad \sum \limits _{(j,i)\in A} {p_{jik} } \le 1\qquad \qquad \qquad \qquad \qquad \qquad \,\,\quad \quad \forall k\in H,i\in V \end{aligned}$$
(2)
$$\begin{aligned}&\qquad x_{ij} \ge p_{ijk} \qquad \quad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \forall k\in H,(i,j)\in A \end{aligned}$$
(3)
$$\begin{aligned}&\qquad x_{ij} =x_{ji} \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \forall (i,j)\in A \end{aligned}$$
(4)
$$\begin{aligned}&\qquad f_{jk} -f_{ik} \ge p_{ijk} d_{ij} -\lambda (1-p_{ijk} +y_i ) \qquad \forall k\in H,(i,j)\in A \end{aligned}$$
(5)
$$\begin{aligned}&\qquad \sum \limits _{(i,j)\in A} {p_{ijk} d_{ij} } \le f_{jk} \le \lambda \sum _{(i,j)\in A} {p_{ijk} } \qquad \qquad \forall k\in H,j\in V \end{aligned}$$
(6)
$$\begin{aligned}&\qquad x_{ij} ,p_{ijk} ,y_i \in \{0,1\};f_{ik} \ge 0 \qquad \qquad \qquad \qquad \forall (i,j)\in A,k\in H \end{aligned}$$
(7)

Constraints (1) is the standard node-balance constraints for multicommodity network design problems. Constraint (2) ensures that an arc can be used by a commodity at most once. Constraint (2) also eliminates sub-tours in the solutions. Constraint (3) and (4) requires that edge (ij) is selected if it is used by any commodity. Constraint (5) is used to calculate the cumulative distance traveled by commodity k without visiting a relay node. Constraint (6) guarantees the cumulative travel distance at any node j must be greater than or equal to the distance it has traveled directly from the predecessor to node j and less than or equal to the upper bound \(\lambda \). Constraint (6) also forces \(f_{jk}\) to be zero if node j is not visited by commodity k, which is indicated by \(\sum \limits _{(i,j)\in A} {p_{ijk} } =0\).

Problem NDPR uses one less type of decision variables than the model presented in Kulturel-Konak and Konak (2008). Additionally, Constraint (2) ensures that a node appears in a commodity route at most once. Constraint (2) also eliminates sub-tours in a commodity route, reducing the degeneracy of the model. For example, route \(\{1\rightarrow 2 \rightarrow 3\rightarrow 2\rightarrow {\ldots }3\rightarrow 2\rightarrow 3\rightarrow 4\}\) has the same cost as that of \(\{1\rightarrow 2\rightarrow 3\rightarrow 4\}\). Note that Constraint (5) alone cannot prevent this phenomenon if nodes 2 and 3 are relays.

The NDPR has the property of symmetry on commodity routes. If a commodity can be sent through the route \(P(i\rightarrow j)\), where i is the source node and j is the destination node, with relay set \(R_{p}\) along in the tour, then a commodity can also be sent back through the reverse route \(P'(j\rightarrow i)\) with the same relay set \(R_{p}\). Furthermore, because the network is undirected (i.e., \(d_{ij}=d_{ji}\) and \(c_{ij}=c_{ji})\), exchanging the source and destination nodes of a commodity (or multiple commodities) will not change the optimal solution.

To solve large-sized NDPR with a heuristic algorithm, the NDPR is partitioned into two sub-problems: (1) the routing problem, which deals with selecting edges to route the commodities from their source nodes to target nodes and (2) the relay location problem (RLP), which deals with placing relays on the given routes. We propose a VNS approach for the routing problem and develop an exact algorithm to solve the RLP for given routes.

3 Exact and heuristic algorithms for the relay location problem

The relay location problem (RLP) is a sub-problem of the NDPR. In this section, two exact algorithms are introduced for the single-route RLP (S-RLP) and multi-route RLP (M-RLP). These algorithms are used within the VNS algorithm proposed in this paper.

3.1 A dynamic programming (DP) method for the single-route RLP (S-RLP)

In this section, a dynamic programming (DP) algorithm is introduced to determine the optimal relay locations for a given single route. The S-RLP can be described as follows. A given commodity route consists of n nodes that are indexed from 1 (the source node) to n (the target node). The distance between node i and its succeeding node i+1 is denoted as \(d_{i}\) such that \(d_{i}\le \lambda \). Each node i has a relay installation cost of \(r_{i}\). The goal of the RLP is to find a set of relays with the minimum relay installation cost such that the total distances between the first node and the first relay, between any two consecutive relays, and between the last relay and last node are all less than \(\lambda \).

The DP algorithm starts from the target node and moves backward toward the source node to determine the optimal objective function values and decision variables. The backward recursive equation of the DP algorithm for the S-RLP is given as follows:

$$\begin{aligned} f_i =\left\{ {\begin{array}{ll} 0 &{}\quad i=n \\ r_i +\min \{f_j |j=i+1,...,\;i^{*}\},&{}\quad i=n-1,n-2,...,2 \\ \min \{f_j |j=2,...,\;i^{*}\},\; &{}\quad i=1 \\ \end{array}} \right. , \end{aligned}$$

where \(f_{i}\) represents the optimal total relay cost (including the relay cost at node i) for sending the commodity from node i to the target node, and node \(i^{*}\) is the farthest node that the commodity can be routed from node i without visiting a relay in the middle. For each node i, node \(i^{*}\) can be pre-calculated as \(i^{*}=\max \{{i}'|{i}'=i,...,n;\;\sum \limits _{j=1}^{{i}'-1} {d_{j,j+1} \le \lambda } \}\). Using the backward recursive equation, the DP algorithm calculates \(f_{i}\) from \(i=n\) to 1, where \(f_{1}\) is the optimal total relay cost for the route. The pseudo-code of the DP algorithm is given in Fig. 1. In the pseudo code, \(j^{*}\) represents the best relay location between nodes \(i+1\) and \(i^{*}\)(Lines from 5 to 10). The optimal relay cost \(f_{i}\) is associated with a set of optimal relay nodes, denoted by \(U_{i}\), which is obtained by \(U_{i}=\{i\} \cup U_{j*}\) (Line 12). The DP algorithm has O(\(n^{2}\)) time complexity. Due to its special structure of the routes, the problem can be effectively solved for a single commodity using dynamic programming.

Fig. 1
figure 1

Pseudo-code of dynamic programming for the S-RLP

Figure 2 illustrates an example of the S-RLP, where the relay and edge costs are displayed above the nodes and edges, and the maximum distance \(\lambda \) is 5. The commodity is routed from node 1 to node 9. Table 1 shows the detailed steps of calculating \(f_{i}\) from \(i=9\) to \(i=1\).

Fig. 2
figure 2

An example of S-RLP

3.2 A recursive dynamic programming method for multi-route RLP (M-RLP)

The M-RLP is much more complex than the S-RLP because commodity routes may share paths and relay nodes. Figure 3 illustrates an example of the M-RLP where three commodities share common route segments. Therefore, applying the DP algorithm to the M-RLP one route at a time may yield a good solution but does not guarantee optimality.

Table 1 The calculation steps of dynamic programming
Fig. 3
figure 3

An example of the M-RLP with three overlapping routes

Nevertheless, we can apply the DP algorithm within a recursive implicit enumeration framework to obtain the optimal solution for the M-RLP. The algorithm is referred to as the Recursive Dynamic Programming (RDP) algorithm. Let \(\pi (k)=\{s_{k1} ,s_{k2} ,\cdots ,s_{kl_k } \}\) represent the route of commodity k such that \(s_{kp}\) is the index of the \(p^{\mathrm{th}}\) node and \(l_{k}\) is the number of the nodes in the route (\(p=1\) for the source node and \(p=l_{k}\) for the target node). We define \(f_{kp}\) as the optimal total relay cost of the sub-problem consisting of route k from the \(p^{\mathrm{th}}\) node to the last node and the remaining routes from k+1 to m. For example in Fig. 3, \(f_{1,1}\) will be the optimal objective value of the original problem, \(f_{1,3}\) represents the optimal solution of the sub-problem consisting of routes \(\{3\rightarrow 4\rightarrow 5\rightarrow 6\}\), \(\{9\rightarrow 5\rightarrow 4\rightarrow 3\rightarrow 2\rightarrow 8\rightarrow 7\}\), and \(\{11\rightarrow 4\rightarrow 3\rightarrow 10\}\), and \(f_{2,2}\) represents the optimal solution for sub-problem composed of routes \(\{5\rightarrow 4\rightarrow 3\rightarrow 2 \rightarrow 8\rightarrow 7\}\) and \(\{11\rightarrow 4\rightarrow 3\rightarrow 10\}\). Note that \(f_{kp}\) includes only the relay cost of newly installed relays for the current sub-problem and excludes the cost of existing relays installed by the higher level of sub-problem (the original problem is the highest level). The recursive dynamic programming equation can be formulated as follows:

$$\begin{aligned} f_{kp} =\left\{ {\begin{array}{ll} 0 &{}\quad \forall p=l_m ;k=m \\ f_{k+1,1}&{}\quad \forall p=l_k ;k=m-1,...,2,1 \\ r_i +\min \{f_{kq} |q\in [p+1,p^{*}]\}&{}\quad \forall i=S_{kp} ;p=l_k -1,...,2,1;k=m,...,2,1; \\ \end{array}} \right. \end{aligned}$$

where \(p^{*}\) is the farthest node that commodity k can be sent to without visiting a relay node if the commodity starts from the \(p^{{\mathrm{th}}}\) node. Node \(p^{*}\) can be determined by \(p^{*}=\max \{{p}'|p<{p}'\le l_k ,\;\sum \limits _{q=p}^{{p}'-1} {d_{s_{kq} ,s_{k,q+1} } \le \lambda } \}\). The RDP algorithm for M-RLP starts from the first node (\(p=1\)) of the first commodity (\(k=1\)) and moves to the last node (\(p=l_{m}\)) of the last commodity (\(k=m\)) through a series of recursive calls. Note that the backward recursive procedure used in the DP algorithm for the S-RLP introduced in Sect. 3.1 is not directly applicable to the M-RLP. In the M-RLP, each \(f_{kp}\) needs to be calculated multiple times due to sharing of nodes among commodity routes. Figure 4 illustrates this difference and the logic of recursion on an example with two commodity routes, Route 1 \([1\rightarrow 2\rightarrow 3\rightarrow 4\rightarrow 5\rightarrow 6]\) and Route 2 \([7\rightarrow 8\rightarrow 3\rightarrow 4\rightarrow 9\rightarrow 10]\), such that nodes 3 and 4 are shared by these two routes. The steps of the backward recursive procedure to calculate the values of \(f_{kp}\) from \(f_{26}\) to \(f_{11}\) are given in Table 2. In step 9, \(f_{15}\) and \(f_{16}\) need to be recalculated after fixing \(y_{4}=1\) because placing a relay at node 4 will affect the optimal values for \(f_{15}\) and \(f_{16}\) (i.e., node 4 is also shared by Route 1). The same rule applies to step 10 because node 3 is also shared by the previous route.

Fig. 4
figure 4

A numeric example of the M-RLP with \(\lambda =4\)

Table 2 Steps of M-RLP with dynamic programming

The RDP algorithm is a forward recursive procedure that starts from \(f_{11}\) and works toward \(f_{kp}\). The pseudo-code of the RDP algorithm is described in Fig. 5, where the procedure \({\textit{Main}}()\) is the starting point of recursion and returns the optimal \(f_{11}\) as well. The function \({\textit{Get}}\_f(k,p)\) calculates \(f_{kp}\) using recursion. A global array is needed to store the optimal relay position calculated at Line 20 of Fig. 5 (temporary variable \(q^{*})\). The main functions of the procedure \({\textit{Get}}\_f({\textit{cur}}\_k, {\textit{cur}}\_p)\) are to find the optimal position \(q^{*}\) between [\({\textit{last}}\_{\textit{station}}+1\), \(p-1\)] (from Line 16 to 22) and to assign a relay to node \(q^{*}\). During recursion, \(f_{kp}\) may be calculated several times as shown in the example above. In each level of recursion, the algorithm stops after the optimal relay station behind the starting node is found. The function \({\textit{Get}}\_f({\textit{cur}}\_p, {\textit{cur}}\_k)\) returns the optimal \(f_{{\textit{cur}}\_p,{\textit{cur}}\_k}\) if an optimal \(q^{*}\) exists (Line 23) or returns 0 otherwise (Line 27), which means that the existing assignment of relays is already feasible.

Fig. 5
figure 5

Pseudo-code of the RDP algorithm for multi-route RLP

The RDP algorithm is a depth-first-like recursive algorithm, which is known to be P-complete (Reif 1985). In the worst case scenario, the RDP algorithm requires O(n!) recursions. In practice, however, many recursive calls can be avoided by using the following properties.

Property 1

For a commodity route k of the M-RLP, a relay must be located at node i if \(d_{ji}+d_{ij^{\prime }}>\lambda \).

Property 1 is straightforward. It simply states that if the total distance of any two consecutive edges of any route is greater than \(\lambda \), then a relay must be placed at the middle node of the two consecutive edges. According to Property 1, relays can be assigned to some nodes of the routes in advance to reduce the computational burden.

Property 2

For any route k of the M-RLP, if the commodity can be sent through \(P(s\rightarrow t)\), with relay set \(R_{p}\), then the commodity can also be sent through the reverse route \(P'(t\rightarrow s)\) with the same relay set \(R_{p}\).

Property 3

For any two routes \(k_{1}\) and \(k_{2}\) of the M-RLP, if route \(k_{1}\) is a sub-route of or equal to route \(k_{2}\), then route \(k_{1}\) can always share the relays of route \(k_{2}\), without installing any additional relay for route \(k_{1}\).

Property 3 indicates that if route \(k_{1}\) is a part of route \(k_{2}\), we can remove route \(k_{1}\) before calling the RDP to optimize the relay cost, and the resulting solution will be the same because the removed route \(k_{1}\) can always utilize the relays of route \(k_{2}\).

The above properties can significantly reduce the computational burden of the RDP algorithm in large-sized problems because commodities tend to share route segments. The approach is first to use Property 1 to divide the commodity routes into multiple sub-routes and then use Property 2 to identify those sub-routes that are part of or equal to other routes and remove them (Property 3). After that, we can use the RDP algorithm to optimize the relay cost of remaining sub-routes. For example, given a M-RLP instance with two commodity routes: \([1\rightarrow 2\rightarrow 3\rightarrow 4\rightarrow 9]\) and \([5\rightarrow 6\rightarrow 3\rightarrow 4\rightarrow 9\rightarrow 8]\) such that \(d_{23}+d_{34} \ge \lambda \), node 3 must have a relay according to Property 1, and the original two-commodity M-RLP is then divided into a four-commodity M-RLP with routes: \([1\rightarrow 2\rightarrow 3]\), \([3\rightarrow 4\rightarrow 9]\), \([5\rightarrow 6\rightarrow 3]\), and \([3\rightarrow 4\rightarrow 9\rightarrow 8]\). According to Property 3, route \([3\rightarrow 4\rightarrow 9]\) is a sub-route of route \([3\rightarrow 4\rightarrow 9\rightarrow 8]\) so it can be removed. As a result, we need only to apply the RDP to the remaining routes \([1\rightarrow 2\rightarrow 3]\), \([5\rightarrow 6\rightarrow 3]\), and \([3\rightarrow 4\rightarrow 9\rightarrow 8]\) to obtain the optimal relay cost.

4 A label-setting algorithm

In this section, a label-setting heuristic, called \(\textit{LSA}(s,t)\), is introduced to construct a route with feasible relay assignments from a source node s to a target node t such that the total cost of the edges and relays are minimized. The main idea of \(\textit{LSA}(s,t)\) is to construct the route one node at a time by selecting the lowest cost node among a set of candidate nodes in a similar way to Dijkstra’s Shortest Path Algorithm. A notable difference is that the optimal cost of the route is calculated by the DP procedure. In Fig. 6, we present the pseudo-code of the \(\textit{LSA}(s,t)\) procedure. In the procedure, \(v_{i}\) denotes the label of node \(i (v_{i}=0\) for unvisited and \(v_{i}=1\) for visited), \(C_{i}\) is the cost (edge and relay costs) of a feasible route from node s to node i, and \(P_{i}\) is the predecessor of node i on the route from node s to node i. In the beginning, each node \(i\in N\) is labeled as unvisited and assigned to a large temporary cost. In each iteration, \(C_{i}\) is updated for each unvisited node using the DP procedure and the node with the lowest \(C_{i}\) is labeled as visited, i.e. its route from node s is fixed.

Fig. 6
figure 6

Pseudo-code of the LSA(st) for the one-commodity NDPR problem

The \(\textit{LSA}(s,t)\) procedure is used to repair disconnected routes during the process of creating candidate solutions in the VNS algorithm. In addition, the \(\textit{LSA}(s,t)\) procedure is also used to construct a random feasible initial solution for the VNS algorithm. The procedure to construct a random solution is presented in Fig. 7. In each iteration of the procedure, a commodity k that has not been routed yet is randomly selected, and the \(\textit{LSA}(s,t)\) procedure is applied to determine the route (\(Q_{k})\) and relay assignments (\(R_{k}\)) of commodity k. Before constructing the route for the next commodity, the cost of the arcs and relays that are already installed for the previous commodities are set to zero. Thereby, a solution is constructed one commodity at one time in a random order of commodities.

Fig. 7
figure 7

Initial solution construction procedure

5 Variable neighborhood search (VNS) for the NDPR

Variable neighborhood search (VNS) is a high-level metaheuristic that has been successfully applied to different optimization problems in various fields (Mladenović and Hansen 1997; Hansen and Mladenović 1997; Xiao et al. 2014). In this section, a VNS algorithm is proposed to iteratively improve a current solution that is constructed by the LSA(st) procedure. The VNS algorithm removes a randomly selected segment of a randomly selected commodity route from the current solution and constructs new paths to reconnect the disconnected segments. If the resulting solution has a better objective function value, it is accepted as the new current solution; otherwise, it is rejected. We define the neighborhood structure of the current solution in terms of the difference between the numbers of the nodes in the disconnected route and the newly constructed route, i.e., \({\textit{length}}(z^\prime )-{\textit{length}}(z)\) where z and \({\textit{z}}^\prime \) denote the selected existing route and the new route, respectively, and length(z) represents the number of the nodes of route z. Thus, given a number K, a new route \({\textit{z}}^\prime \) is generated from the current route z as follows:

  1. (i)

    Two random nodes i and j of the current route z are selected.

  2. (ii)

    All arcs of the nodes on the path connecting nodes i and j are removed temporarily from the current solution.

  3. (iii)

    A random new path from node i to node j is found by using a random depth-first search such that \({\textit{length}}(z^\prime )-{\textit{length}}(z) \le K\).

Parameter K is the neighborhood index that restricts a candidate solution to be generated within the Kth neighborhood of the current solution and limits the extent to which the current solution is allowed to change in the process of generating the candidate solution. The VNS algorithm searches for new solutions in the neighborhood structures by increasing K from zero to \(K_{max}\) sequentially. In Fig. 8, we provide an example to illustrate how the neighborhood structures are defined. Figure 8a shows the current route of commodity k starting from source node \(s_{k}\) to target node \(t_{k}\). In the figure, the solid nodes indicate the route segment to be removed while the arcs between any two empty nodes of the route remain intact. In Fig. 8b–f, the five routes represent candidate solutions generated from different neighborhoods of the current solution.

Fig. 8
figure 8

Examples of neighborhood structures used in the VNS algorithm a current solution b a new route path with \(K=-1\) c a new route path with \(K=0\) d a new route path with \(K=1\) e a new route path with \(K=2\) f a new route path with \(K=3\)

After the initial solution is set as the current solution, the VNS algorithm first searches for new better solutions with \(K=0\). That means only the candidates with route length shorter than or equal to the current solution will be generated. If a better one is found, then it is accepted as the new current solution (the first improvement principle), and the search is restarted by setting \(K\leftarrow 0\). If the current solution is not improved after \(N_{\max }\) consecutive new solution generations in the neighborhood K, a broader neighborhood is tried by setting \(K\leftarrow K+1\). After the highest level of the neighborhood (i.e, \(K=K_{\max })\) is searched without any improvement, the VNS algorithm is restarted with a new initial solution. The search is terminated when either a maximum elapsed CPU time \(T_{max}\) has been reached, or the search has been consecutively restarted for \(P_{\max }\) times without any improvement in the best solution. In Fig. 9, we present the overall VNS algorithm for the NDPR. The lines (8), (9), and (10) implement the shaking concept in VNS, which generates random candidate solutions. Lines (10), (11), and (12) serve as the role of a greedy local search procedure that uses procedure \(\textit{LSA}(s,t)\) and the RDP procedures to construct new routes and determine the optimal relays. In other words, the process of generating new candidate solutions (from line (8) to (12)) includes both a random search to discover diverse solutions and a greedy approach to increase the effectiveness of the search.

Fig. 9
figure 9

Framework of VNS algorithm for NDPR

Note that in line 9 of Fig. 9, the arcs of the removed route segment may also be shared by other commodity routes. Therefore, removing these arcs may disconnect other routes, and these broken routes are reconstructed using the \(\textit{LSA}(s,t)\) procedure. Although the \(\textit{LSA}(s,t)\) procedure is a deterministic greedy algorithm, different solutions can be discovered because the path between the selected nodes i and j is randomly repaired. An example of this process is shown in Fig. 10 where Route 1 (from node \(s_{1}\) to node \(t_{1})\) is selected to create a new solution. When the arcs of the nodes on the path between nodes i and j are removed (from Fig. 10a, b), Route 2 is also broken from node \(i'\) to node \(j'\). Therefore, after the selected route is reconnected using a random depth-first search as shown in Fig. 10c, (line 10), the \(\textit{LSA}(s,t)\) procedure is used (line 11) to rebuild any remaining disconnected routes (Fig. 10d).

Fig. 10
figure 10

An example of neighborhood search

6 Computational experiments

This section presents the results of computational experiments to test the VNS algorithm and compare its performance with other algorithms from the literature. First, the VNS algorithm is used to solve the problem set defined by Konak (2012). This problem set includes 40 instances of two types—Type-I and Types-II as given in Tables 4 and 6. In Type-I problems, cost \(c_{ij}\) and distance \(d_{ij}\) of edge (ij) are defined as the Euclidian distance between nodes i and j. In Type-II problems, the cost is defined as \(c_{ij}=\lambda -d_{ij}\) so that there is a strict tradeoff between the edge distance and cost. As shown in Tables 4 and 6, two different levels of \(\lambda \) and |H| values are used for each problem group. In addition, a new set of test problems, referred to as Type-III, are considered in this paper. The Type-III problem set uses the same networks with those of the Type-I and Type-II sets, but cost \(c_{ij}\) for edge (ij) is a random number generated between 0 and \(\lambda \), and larger numbers of commodities are considered to make the problems more challenging. The parameters of these new test problems are given in Table 8. The VNS algorithm was coded in VC++ 6.0 and run on a PC computer equipped with 3.4GHz \(\hbox {Intel}\circledR \) \(\hbox {Core}^{{\textsc {tm}}}\) i5 3570 CPU and MS Windows 7 system (Fig. 11).

Fig. 11
figure 11

Two optimal solutions verified by AMPL/CPLEX (nodes with circle indicating relays) a No. 1 instance of Type-III (\(\hbox {cost}=367\)) b No. 2 instance of Type-III (\(\hbox {cost}=176\))

The first set of experiments involved testing the effectiveness of the \(\textit{LSA}(s,t)\) procedure, which is used to initialize solutions and repair disconnected routes while generating new solutions in the VNS algorithm. The \(\textit{LSA}(s,t)\) procedure was used to find the route and relay assignments for each single commodity of the test problems individually and compared the solutions to the optimal solutions found by Problem NDPR. Note that the optimal route and relay assignments can be determined effectively for a single commodity. In Table 3, the summary of this comparison is presented. The \(\textit{LSA}(s,t)\) procedure found all the optimal solutions of the 300 problem instances of Type-I and Type-II successfully. For Type-III problems, the \(\textit{LSA}(s,t)\) procedure found 361 optimal solutions for the 500 test instances. On the average, the \(\textit{LSA}(s,t)\) procedure yielded 2.1% higher cost than the optimal solutions for 500 problem instances of Type-III.

Table 3 The comparisons of single commodity solutions found by \(\textit{LSA}(s,t)\) to the optimal solutions

Table 4 presents the comparative results for the problem instances of Type-I (i.e., \(c_{ij}=d_{ij})\). Each problem instance was repeatedly solved for 10 random replications with the same parameter settings of \(P_{\max }=10\), \(K_{\max }=3\), and \(N_{\max }=3000\). In the table, the column Dev. indicates the deviation from the best of 10 runs of the VNS algorithm to the previous best-known solutions from Kulturel-Konak and Konak (2008), Konak (2012), or Lin et al. (2014). New best-known solutions were found for instances No. 15, No. 19, and No. 20, and these new solutions are given in Figs. 12, 13 and  14 in “Appendix”. The overall performance of the VNS algorithm is compared to the existing algorithms in Table 5, where column Avg. cost indicates the average objective function value of 20 Type-I problems, column Best solutions found shows the number of problems in which the algorithm is able to find the best-known solution, column Avg. dev. from best indicates the average value of the deviations (in percentage) of the solutions from their individual new best-known solutions, and column Avg. time(s) indicates the average CPU time (in seconds). It can be seen that the VNS algorithm had the best performance (best of 10) in terms of Avg. cost, Best solutions found, and Avg. dev from best. The VNS algorithm found the best-known solution for all the problem instances. The second best method is the GA(avg. of 10) with the relatively higher computational efficiency, the third one is LSGA(best of 10), and CH1 is the worst one with only one best solution found.

Table 4 Results of the computational experiment for Type-I problems
Table 5 Comparison with the existing algorithms on Type-I problems

In Tables 6 and 7, the VNS algorithm is compared to the previous methods using Type-II problems (i.e., \(c_{ij}=\lambda -d_{ij})\). These results were also found with the same parameters settings of \(P_{\max }=10\), \(K_{\max }=3\), and \(N_{\max }=3000\), and each problem instance was solved for 10 random replications. It can be seen in Table 6 and 7 that although the VNS algorithm did not improve the best-known solutions of the Type-II problems, it is very competitive. Notably, for 19 out of 20 instances (excluding No. 18 instance), the VNS algorithm could always find their previous best-known solutions in each of the 10 replications, indicating a robust performance for Type-II problems. The comparison with the existing algorithms is summarized in Table 7. Since Lin et al. (2014) did not solve Type-II problems, the performance of the TS algorithm is not available for comparison. It can be seen that the VNS (best of 10) and the GA (best of 10) are identical. In terms of the average performance, however, the VNS outperformed the GA for the Type-II problem set.

Table 6 Results of the computational experiment on 20 instances of Type-II
Table 7 Comparison with existing algorithms on 20 instances of Type-II
Table 8 Results of the computational experiment on 40 Type-III problems
Table 9 Summarization of experiments on 40 new instances of Type-III

In Tables 8 and 9, the VNS algorithm and the GA (Konak 2012) are compared using Type-III problems. The VNS algorithm was run with the same setting of \(P_{\max }=10\), \(K_{\max }=3\), and \(N_{\max }=3000\) for ten random replications. The GA was also run for 2000 generations with the population size of 50 as used in Konak (2012). The best and average solutions of the both algorithms are listed in Table 8. Column Dev. of GA from VNS presents the deviations of the results of the VNS algorithm from the GA in terms of the average solution of 10 runs, best solution of 10 runs, and average computational time. In terms of the best solution of 10 runs, the VNS algorithm outperformed the GA in 33 problems, found the same solutions with the GA in six problems, and performed worse than the GA only in one problem. Regarding the average solution of 10 runs, the VNS algorithm significantly outperformed the GA. Table 9 provides the summary of the comparison between the GA and VNS. The average computational times used by the GA and VNS algorithm can be considered comparable considering hardware differences. It is clear that the VNS algorithm performed much better for Type-III problems than the GA did. The solutions found by the GA were 11.06% worse than those of the VNS algorithm. The VNS algorithm determines the optimal relay assignments for each candidate solution while the GA uses the exact approach only for the best solution and utilizes a construction heuristic to determine the relay assignments for other candidate solutions. Therefore, the VNS algorithm is even more competitive than the GA for the problem instances with a higher number of commodities, for which solving the relay assignment sub-problem is more challenging. As seen in Table 9, the average gap between the solutions of the VNS algorithm and the GA increases significantly as the commodity number increases. The edge costs in Type-III problems are randomly assigned, not correlated to the edge’s distance such as in the case of Type-I and Type-II problems. Therefore, the interaction between the route selection and relay assignment becomes much more complex in this problem set. Another difference between the GA and the VNS algorithm is that the GA starts with randomly generated solutions while the VNS algorithm starts with more promising solutions generated by the \(\textit{LSA}(s,t)\) procedure.

In Fig. 11, the optimal solutions of two small-sized problems of Type-III (No. 1 and No. 2) are provided. The optimality of the solutions is verified by using CPLEX 12.1 in 2.5 h for No. 1 and 13 h for No. 2.

Finally, the performance of the VNS algorithm was tested for different values of parameters \(K_{\max }\) and \(N_{\max }\), and the relationship between CPU times and problem size was investigated. The 40 Type-III problems were solved once with parameter combinations by \(P_{\max }=5\), \(K_{\max }=2\), 3, and 4, and \(N_{\max }=1000\), 2000, 3000, and 4000. The results were analyzed using ANOVA to investigate the impact of these parameter settings on solution quality and computational time. Table 10 summarizes the average objective value of 40 problems (column AVG obj) and the average CPU time used (column AVG time), as well as their corresponding percent deviations (column Dev.(%)) from the mean values obtained in the previous experiments reported in Table 7 with parameters \(P_{\max }=10\), \(K_{\max }=3\), and \(N_{\max }=3000\). It can be observed that solution quality is slightly improved by running the algorithm longer or using a larger range of neighborhood structures at the expense of CPU times. However, the slight improvement observed in the average objective value was not statistically significant (\(F=0.498\), \(p=0.608\) for \(K_{\max }\) and \(F=0.732\) and \(p=0.533\) for \(N_{\max }\) in ANOVA) while the impact of \(K_{\max }\) on CPU times was significant (\(F=4.308\), \(p=0.014\)) as expected (\(N_{\max }\) was included in the ANOVA model for CPU times). In summary, these results indicate that the VNS algorithm performs robustly within the ranges of the parameters used in this study.

We used several linear and non-linear regression models to investigate the relationship between the CPU time requirement of the VNS algorithm and the problem size parameters m, n, |A|, and \(\lambda \). Although the VNS algorithm’s procedures that are used to repair solutions and assign optimal relays depend on dynamic programming that has exponential time complexity, the CPU time requirement seems to be a linear function of m|A|. The best regression model included m|A| and \(\lambda \) as dependent variables (with adjusted \(R^{2}\) of 0.725). The empirical study showed that the CPU time strongly depended on m|A| (\(p=0.000\)) and was negatively correlated with \(\lambda \) (the relationship was not statically significant with \(p=0.625\)).

Table 10 Performances of VNS with different parameters on 40 Type-III problems

7 Conclusions

In this paper, a variable neighborhood search (VNS) algorithm is proposed for the NDPR with an exact algorithm for the relay location problem (RLP). The VNS algorithm systematically searches different neighborhoods of the current solution using a random construction heuristic to optimize the routes of commodities. The dynamic programming (DP) for single-route RLP and the recursive dynamic programming (RDP) for the multi-route RLP work within the framework of the VNS algorithm to optimize the relay assignments. Computational experiments on the three sets of problems have shown that the VNS algorithm is a very efficient algorithm for the NDPR, outperforming all existing heuristics in the literature. The VNS algorithm performed particularly well in Type-III problems with random edge costs and larger numbers of commodities. A label-setting algorithm is also proposed for constructing a commodity route with relay assignments. Experiments show that the label-setting algorithm is effective in finding good starting solutions. With these features, the VNS algorithm can solve large-sized problem instances effectively and efficiently.

The VNS algorithm is a partial hybrid algorithm where a complex problem is first decomposed into sub-problems, and then each sub-problem is solved by a specialized algorithm, and a metaheuristic guides the overall optimization process. This approach is applicable to many real-life problems that involve multiple types of interdependent decision variables such as Time-dependent Vehicle Routing Problem with Recharging/Refueling Stations, Facility Layout Problem, Facility Location and Routing Problems in supply chains. For further research, the proposed algorithms can be applied to the capacitated NDPR and the survivable version of the problem. In this paper, edges and relays are assumed to have infinite capacities. Therefore, the commodities tend to share routes or relays. Considering edges and relays with limited capacities will make the problem more applicable to telecommunications networks in particular.