J Optim Theory Appl https://doi.org/10.1007/s10957-018-1221-9
An Algorithm for Solving the Shortest Path Improvement Problem on Rooted Trees Under Unit Hamming Distance Binwu Zhang1 · Xiucui Guan2 · Panos M. Pardalos3,4 · Chunyuan He1
Received: 4 August 2017 / Accepted: 15 January 2018 © Springer Science+Business Media, LLC, part of Springer Nature 2018
Abstract Shortest path problems play important roles in computer science, communication networks, and transportation networks. In a shortest path improvement problem under unit Hamming distance, an edge-weighted graph with a set of source–terminal pairs is given. The objective is to modify the weights of the edges at a minimum cost under unit Hamming distance such that the modified distances of the shortest paths between some given sources and terminals are upper bounded by the given values. As the shortest path improvement problem is NP-hard, it is meaningful to analyze the complexity of the shortest path improvement problem defined on rooted trees with one common source. We first present a preprocessing algorithm to normalize the problem. We then present the proofs of some properties of the optimal solutions to the problem. A dynamic programming algorithm is proposed for the problem, and its time complexity is analyzed. A comparison of the computational experiments of the dynamic programming algorithm and MATLAB functions shows that the algorithm is efficient although its worst-case complexity is exponential time.
B
Xiucui Guan
[email protected] Binwu Zhang
[email protected]
1
Department of Mathematics and Physics, Hohai University, Changzhou Campus, Changzhou 213022, China
2
School of Mathematics, Southeast University, Nanjing 210096, China
3
Department of Industrial and Systems Engineering, Center for Applied Optimization, University of Florida, Gainesville, FL, USA
4
LATNA, Higher School of Economics, Moscow, Russia
123
J Optim Theory Appl
Keywords Shortest path problem · Rooted trees · Network improvement problem · Hamming distance · Dynamic programming Mathematics Subject Classification 90C27 · 90C35 · 90C39
1 Introduction Owing to the theoretical and practical values of shortest path problems, they play a very important role in the field of network optimization and have been extensively studied in recent years. Shortest path algorithms can be extensively applied in computer science, communication networks, transportation networks, and other engineering areas. Recently, several researchers have conducted research on inverse shortest path problems and shortest path improvement problems. In such problems, an edge-weighted graph with a set of source–terminal pairs is given, and we are required to modify the weights of the edges at a minimum cost under a given norm such as l1-norm, l2-norm, l-infinity-norm, and Hamming distance. In an inverse shortest path problem, the aim is to modify the weights of edges such that a set of given paths become the shortest source-terminal paths, while in a shortest path improvement problem, the aim is to modify the distances of the shortest paths such that they are upper bounded by the given values. Details of inverse optimization problems may be referred to in the survey paper by Heuberger [1]. Burton and Toint [2] solved an inverse shortest path problem under l2-norm using a nonlinear programming technique. Zhang et al. [3] proposed a column generation method for the inverse shortest path problem under l1-norm. Zhang and Lin [4] showed that the shortest path improvement problem under l1-norm is NP-complete and proposed polynomial-time algorithms for a case comprising trees and that comprising a single source–terminal path. Since He et al. [5] first studied the inverse optimization problems under the Hamming distance, they have been investigated by several researchers (Duin and Volgenant [6], Guan and Zhang [7], Guan et al. [8], Jiang et al. [9], Liu and Yao [10], Zhang etal. [11–13]). However, it is still unknown whether there exists a polynomial-time algorithm for a shortest path improvement problem under unit Hamming distance on tree networks. This article presents a study on shortest path improvement problems on rooted trees under unit Hamming distance using dynamic programming methods. The rest of this article is organized as follows. Basic concepts and notations will be presented in Sect. 2. Some properties of shortest path improvement problems on rooted trees under unit Hamming distance are presented in Sect. 3. A dynamic programming algorithm is proposed for solving the problem in Sect. 4. The results obtained with computational experiments of the dynamic programming algorithm and MATLAB functions are compared in Sect. 5. The conclusions of this study are presented in Sect. 6.
123
J Optim Theory Appl
2 Preliminaries Shortest path improvement problems under the Hamming distance (denoted by SPIH) can be described as follows. Let G = (V, E) be a connected undirected network, where V is the vertex set and E = {e1 , e2 , · · · , em } is the edge set. Let wi ≥ 0 be the weight of edge ei , li be the lower bound on the modified weight of ei , and ci be the cost incurred by modifying the weight of ei , where i = 1, 2, . . . , m. Let {(sk , tk ), k = 1, 2, · · · , r } be the set of source–terminal pairs of vertices. Let dk be the upper bound of the shortest distance connecting the source–terminal pair (sk , tk ). The shortest distance from sk to tk under the weight vector w is denoted by dw (sk , tk ). The objective of the SPIH problem is to derive a new edge weight vector w∗ that satisfies l ≤ w ∗ ≤ w such that the modified shortest distance dw∗ (sk , tk ) is upper bounded by dk . In addition, the total edge modification cost is minimized under the Hamming distance. It can be formulated using the following mathematical model. min s.t
m
ci H (wi∗ , wi ) i=1 dw∗ (sk , tk ) ≤ dk , li ≤ wi∗ ≤ wi ,
k = 1, 2, . . . , r, i = 1, 2, . . . , m,
(1)
where the Hamming distance H (wi∗ , wi ) is defined as H (wi∗ , wi ) :=
1, if wi∗ = wi , 0, if wi∗ = wi .
The shortest path improvement problems under Hamming distance are based on practical applications; for details, please refer to [13], [14], and [15]. For example, let us consider that a large earthquake has occurred in some towns, and the relief supplies are required to be quickly handed out to the people in the stricken area. However, several roads have been badly damaged and require maintenance as soon as possible. Consider the network G = (V, E) of towns, where v ∈ V denotes a town and e = (u, v) ∈ E denotes a road connecting u to v. Let li be the traveling time for traveling over road ei if ei is repaired, and wi be the traveling time for traveling over road ei if ei is not repaired. It should be noted that some places of the road ei are damaged (instead of the whole road being destroyed), and thus, the maintenance time for road ei may be a fixed amount ci instead of ci (wi − li ). We are required to transport the relief goods from a supplier town sk to a stricken town tk within the stipulated time. Our objective is to design a repair scheme that satisfies the above transportation requirement such that the total maintenance time is minimized, which is the SPIH problem. In the SPIH problem, if ci = 1 for each i = 1, 2, · · · m, then the problem is called a shortest path improvement problem under unit Hamming distance, which is denoted by SPIUH problem. Zhang et al. [13] showed that the SPIH is strongly NP-hard on general graphs and is still NP-hard even in the case of a chain network. Zhang et al. [14] considered an SPIUH problem in an arborescent network. Firstly, a 0-1
123
J Optim Theory Appl
integer programming model was formulated for the problem. Secondly, some strongly polynomial-time algorithms were designed for the problems on a few special arborescent networks. Thirdly, a heuristic algorithm was proposed for solving the problem using general networks. Zhang et al. [15] showed the N P-hardness of developing an algorithm with a worst-case ratio of O(log |V |) for an SPIUH problem. A heuristic algorithm of the problem was then proposed in [15]. In this paper, we discuss a special SPIUH problem called the shortest path improvement problem on rooted trees under unit Hamming distance (denoted by SPIUH-RT problem). A rooted tree T = (V, E) is rooted at source s ∈ V , where V = {s, v1 , v2 , · · · , vn−1 }, and E = {e1 , e2 , · · · , en−1 }, ci = 1 for all i = 1, 2, . . . , n − 1. Let dk be the upper bound of the shortest distance connecting the source–terminal pair (s, tk ). The SPIUH-RT problem can be formulated using the following mathematical model. min s.t
n−1
H (wi∗ , wi ) i=1 dw∗ (s, tk ) ≤ dk , li ≤ wi∗ ≤ wi ,
k = 1, 2, . . . , r, i = 1, 2, . . . , n − 1.
(2)
For convenience, in the rest of paper, we use the following useful notations. If e ∈ E, we define w(e) as the w-weight of edge e. Pk denotes the unique path from s to tk in T , and the set of terminals tk is defined as Q(e j ) = {tk |e j ∈ Pk , k = 1, 2, . . . , r } to which Pk passes e j . Z = {tk |k = 1, · · · , r } denotes the set of terminals.
3 Properties of the SPIUH-RT Problem In this section, we first present a preprocessing algorithm for normalizing the SPIUHRT problem. Some main concepts are then introduced for describing the structure of the problem. Finally, we present the proofs of some properties of the optimal solutions to the SPIUH-RT problem. Lemma 3.1 In problem (2), the terminal node tk ∈ Z can be considered as a leaf node. Proof If there exists a terminal node t j ∈ Z that is not a leaf node, we can then obtain problem (3) defined on a new rooted tree T (V , E ), where V = V ∪ {t j }, e = (t j , t j ), E = E ∪ {e }, Z = Z \ {t j } ∪ {t j }, w(e ) = 0, and l(e ) = 0. min H (w ∗ (e), w(e)) e∈E
s.t dw∗ (s, tk ) ≤ dk , tk ∈ Z \ {t j }, dw∗ (s, tk ) ≤ dk , k = j, l(e) ≤ w ∗ (e) ≤ w(e), e ∈ E .
(3)
It should be noted that based on the construction of T , t j is a leaf node of T . Furthermore, the weight of the edge e cannot be changed as l(e ) = w(e ). Thus, H (w ∗ (e ), w(e )) = 0, and then
123
J Optim Theory Appl
e∈E
H (w ∗ (e), w(e)) =
H (w ∗ (e), w(e)).
e∈E
Thus, problem (3) is equivalent to an SPIUH-RT problem (2).
Thus, in this paper, we can consider each terminal node as a leaf node. Lemma 3.2 In problem (2) , each leaf node v (v = s) can be considered as a terminal node. Proof If there exists a leaf node v ∈ / Z that is not a terminal node, we can delete the leaf node v and the unique edge adjacent to v. This will not affect the optimal solution of the problem, because the deleted edge will not be modified in any optimal solutions. Similarly, we can delete all the leaf nodes that are not terminal nodes.
Without the loss of generality, we assume that the degree of the source s is 1. If degr ee(s) > 1, we can construct a rooted tree T (V , E ), where V = V ∪ {s }, e = (s , s), E = E ∪ {e }. Let w(e ) = l(e ) = 0, then problem (2) is equivalent to the SPIUH-RT problem on a rooted tree T . Next we present the preprocessing algorithm for normalizing the SPIUH-RT problem. Algorithm Preprocess Preprocessing the problem Input: A rooted tree T (V, E) with root s, set VL of leaves, set Z of terminals, and two edge vectors w and l. Output: A rooted tree T (V, E) with root s, set VL of leaves, set Z of terminals, and two edge vectors w and l, where VL = Z and degr ee(s) = 1. 1: If degr ee(s) > 1, construct a new tree network T (V , E ), where V := V ∪ {s } and E := E ∪ {e = (s , s)}, and let w(e ) = l(e ) := 0. The remaining node set and edge set are denoted by V and E respectively. 2: While there is a leaf node v ∈ / Z (v = s), delete v and the unique edge adjacent to v. Update VL := VL −v. Denote the remained node set by V , edge set by E and leaf set by VL . 3: While there is a terminal node t j ∈ Z that is not a leaf node, define a new rooted tree T = (V , E ), where V := V ∪ {t j }, E := E ∪ {e = (t j , t j )}, Z := Z \ {t j } ∪ {t j }, and VL := VL ∪ {t j }. Let w(e ) = l(e ) := 0. The remaining node set, edge set, terminal set, and leaf set are denoted by V , E, Z , and VL respectively.
Thus, in this paper, the set of leaf nodes and set of terminal nodes are equivalent in problem (2). In order to study the construct of the optimal solutions to the SPIUH-RT problem, we first introduce some definitions. Definition 3.1 Let α(v) be the number of vertices having a degree greater than 2 on the only path from s to v (excluding v). The Tab of any node v ∈ V is defined as follows. α(v) + 1, i f degr ee(v) ≤ 2, T ab(v) := (4) α(v) + 2, i f degr ee(v) > 2.
123
J Optim Theory Appl
w1=2 2
s
2
e1
v1
1
e2
v2
e3
v3 2
e9
e11 3
2
e4
3
v4
v9
e
3
1
3
e6
v6
5
e7
e10
v5 v7
3
e8
v8
Tv 4
v10 Tv ,v 2 12
v11 e122 v12
4
e13
v13
3
e14
v14
4
e15
v15
3
e16
v16
3
e17
v17
Fig. 1 The definitions of Tab, layer number, critical child, Tv , and Tv,vh in a rooted tree
It should be noted that degree(s)=1 and α(s) = 0, then T ab(s) = 1. Definition 3.2 For each e = (u, v) ∈ V , if T ab(u) ≤ T ab(v), we define L(e) := T ab(u) as the layer number of the edge e. In Fig. 1, notice that α(v2 ) = 0 and degr ee(v2 ) = 4 > 2, then T ab(v2 ) = 2; notice that α(v11 ) = 1 and degr ee(v11 ) = 2, then T ab(v11 ) = 2; notice that α(v12 ) = 1 and degr ee(v12 ) = 3 > 2, then T ab(v12 ) = 3; notice that e11 = (v2 , v11 ) and T ab(v2 ) ≤ T ab(v11 ), then L(e11 ) = T ab(v2 ) = 2. Notice that e12 = (v11 , v12 ), T ab(v11 ) < T ab(v12 ), then L(e12 ) = T ab(v11 ) = 2. In Fig. 2, V = {s, v1 , v2 , t1 , t2 }, E = {e1 , e2 , e3 , e4 }, w = (2, 3, 2, 6), l = (1, 1, 1, 1), and d = (6, 6). Thus, w = (2, 3, 1, 1) is an optimal solution of the instance in Fig. 2 with dw (s, t1 ) = 6 = dw (s, t2 ). It should be noted that w3 − l3 < w2 − l2 , w3 = l3 , w2 = w2 , L(e3 ) = 2, L(e2 ) = 1, Q(e3 ) = {t1 }, Q(e2 ) = {t1 , t2 }, L(e3 ) > L(e2 ), and Q(e3 ) ⊆ Q(e2 ). Obviously, modifying e2 can result in a greater reduction in the weights of the paths passing e2 and e3 than that obtained on modifying e3 . Hence, w ∗ = (2, 1, 2, 1) is also an optimal solution of the instance with dw∗ (s, t1 ) = 5 and dw∗ (s, t2 ) = 4. We describe this property in the following lemma. Lemma 3.3 Let us assume that w is an optimal solution of problem (2). If wi − li ≤ w j − l j , wi < wi , w j = w j , L(ei ) ≥ L(e j ), and Q(ei ) ⊆ Q(e j ), then w ∗ is also an optimal solution of problem (2), where ⎧ ⎨ wi , wk∗ := l j , ⎩ wk ,
123
if k = i, if k = j, other wise.
J Optim Theory Appl
t1
e3 S
e1
(2, 1)
(w1, l1)
v1
e2
(3, 1)
(2, 1)
v2
e
4 (6, 1)
t2
Fig. 2 An example to demonstrate the properties of Lemmas 3.3 and 3.4
Proof We first prove that w ∗ is a feasible solution of problem (2). We consider three cases based on the relationship between ei , e j , and Pk . Let us consider any path Pk from s to terminal tk , such that 1 ≤ k ≤ r . (1) If e j ∈ Pk and ei ∈ / Pk , then dw∗ (s, tk ) = dw∗ (Pk \ {e j }) + w ∗j ≤ dw (Pk \ {e j }) + w j = dw (s, tk ) ≤ dk . / Pk and ei ∈ / Pk , then (2) If e j ∈ dw∗ (s, tk ) = dw∗ (Pk ) = dw (Pk ) = dw (s, tk ) ≤ dk . (3) If e j ∈ Pk and ei ∈ Pk , it follows from wi − li ≤ w j − l j that wi + l j ≤ w j + li . It should be noted that wj = w j , then dw∗ (s, tk ) = dw∗ (Pk \ {ei , e j }) + wi∗ + w ∗j = dw (Pk \ {ei , e j }) + wi + l j ≤ dw (Pk \ {ei , e j }) + li + w j ≤ dw (Pk \ {ei , e j }) + wi + w j = dw (s, tk ) ≤ dk . H (w ∗ (e), w(e)) = Thus, w ∗ is a feasible solution of problem (2). Moreover, e∈E H (w (e), w(e)). Hence, w ∗ is also an optimal solution of problem (2).
e∈E
In Fig. 2, V = {s, v1 , v2 , t1 , t2 }, E = {e1 , e2 , e3 , e4 }, w = (2, 3, 2, 6), l = (1, 1, 1, 1), and d = (6, 6), and thus, w = (1, 3, 2, 1) is an optimal solution of the problem in Fig. 2. It should be noted that w1 − l1 < w2 − l2 , w1 = l1 , w2 = w2 , L(e1 ) = L(e2 ) = 1, and Q(e1 ) = Q(e2 ) = {t1 , t2 }. Obviously, modifying e2 is more beneficial than modifying e1 . Hence, w ∗ = (2, 1, 2, 1) is also an optimal solution in this instance. We describe this special case of Lemma 3.3 as follows. Lemma 3.4 Let us assume that w is an optimal solution of problem (2). If wi − li < w j − l j , wi < wi , w j = w j , L(ei ) = L(e j ), and Q(ei ) = Q(e j ), then w ∗ is an optimal solution of problem (2), where ⎧ ⎨ wi , if k = i, if k = j, wk∗ := l j , ⎩ wk , other wise.
123
J Optim Theory Appl
Proof We first prove w ∗ is a feasible solution of problem (2). We consider two cases based on the relationship between ei , e j , and Pk . Let us consider any path Pk from s to terminal tk , such that 1 ≤ k ≤ r . (1) If e j ∈ / Pk and ei ∈ / Pk , then dw∗ (s, tk ) = dw∗ (Pk ) = dw (Pk ) = dw (s, tk ) ≤ dk . (2) If e j ∈ Pk and ei ∈ Pk , it follows from wi − li < w j − l j that wi + l j < w j + li . It should be noted that wj = w j , then dw∗ (s, tk ) = dw∗ (Pk \ {ei , e j }) + wi∗ + w ∗j = dw (Pk \ {ei , e j }) + wi + l j < dw (Pk \ {ei , e j }) + li + w j ≤ dw (Pk \ {ei , e j }) + wi + w j = dw (s, tk ) ≤ dk . H (w ∗ (e), w(e)) = Thus, w ∗ is a feasible solution of problem (2). Moreover, e∈E H (w (e), w(e)). Hence w ∗ is also an optimal solution of problem (2).
e∈E
Let E j := {e : L(e) = j} be the set of edges with layer number j. For any terminal tk ∈ Z , let E kj := E j ∩ Pk be the set of edges with layer number j on path Pk , for j = 1, 2, · · · , pk = T ab(tk ), k = 1, 2, · · · , r . Given a terminal node tk and layer number j, let us assume that E kj = {ekj 1 , ekj 2 , · · · , ekj τ }. Based on Lemma 3.4, without loss of generality, we can rearrange the edges so that the differences w(ekj i ) − l(ekj i ) between the original weights and their lower bounds are sorted non-increasingly as follows. w(ekj 1 ) − l(ekj 1 ) ≥ w(ekj 2 ) − l(ekj 2 ) ≥ · · · ≥ w(ekj τ ) − l(ekj τ ).
(5)
For example, in Fig. 1, for terminal t5 and j = p5 = T ab(t5 ) = 3, E 35 = {e15 , e16 , e17 }, we can assume that w(e15 ) − l(e15 ) ≥ w(e16 ) − l(e16 ) ≥ w(e17 ) − l(e17 ). In order to describe the problem easily, in the following sections, we denote ei = (u, vi ) ∈ Pvi by the label of the farthest endpoint in the path from s to vi .
4 Dynamic Programming Algorithm for Solve the SPIUH-RT Problem In this section, we introduce a dynamic programming algorithm (denoted by Algorithm DP) for solving the SPIUH-RT problem. We first present some definitions. We then define two important functions followed by the description of Algorithm DP. Next, we analyze the time complexity of Algorithm DP. Finally, we present some methods for enhancing the ease of calculation in Algorithm DP. Definition 4.1 For the source node s and node u ∈ V that satisfy degr ee(u) > 2, we define a set of critical children (denoted by CC(u)) of the node u (including u = s) as
123
J Optim Theory Appl
follows. Let u be in the path from s to v. If degr ee(v) > 2 and T ab(v) = T ab(u) + 1, then v ∈ CC(u); if v is a leaf node with T ab(v) = T ab(u), then v ∈ CC(u). In Fig. 1, degr ee(v2 ) > 2 and T ab(v2 ) = 2. We then determine the set of critical children of v2 . It should be noted that degr ee(v4 ) > 2 and T ab(v4 ) = 3 = T ab(v2 )+ 1. Thus, v4 and v12 are critical children of node v2 . It should be noted that v10 is a leaf node with T ab(v10 ) = T ab(v2 ), and thus, v10 ∈ CC(v2 ). Hence, CC(v2 ) = {v4 , v10 , v12 }. Let V ∗ := {v ∈ V : deg(v) > 2}. For any v ∈ V ∗ , let Pv be the only path from s to v and CC(v) = {v1 , v2 , . . . vq } be the set of critical children of v, where q = degr ee(v) − 1. Let Sv (i 1 , . . . , i p ) be the set of first i j edges in each layer Pv ∩ E j for all j = 1, . . . , p = T ab(v) − 1 and i 1 ∈ {0, 1, . . . , s1 }, i 2 ∈ {0, 1, . . . , s2 }, . . . , i p ∈ {0, 1, . . . , s p }, where s j = |Pv ∩ E j |, j = 1, . . . , p. In Fig. 1, we consider Sv12 (i 1 , . . . , i p ) as an example. p = T ab(v12 ) − 1 = 2, s1 = |Pv12 ∩E 1 | = 2, and s2 = |Pv12 ∩E 2 | = 2. There are a total of nine values of Sv12 (i 1 , i 2 ) for i 1 ∈ {0, 1, 2}, i 2 ∈ {0, 1, 2}. For example, Sv12 (1, 0) = {e1 }, Sv12 (1, 1) = {e1 , e11 }, and Sv12 (1, 2) = {e1 , e11 , e12 }. In order to solve the SPIUH-RT problem using a dynamic programming algorithm, we define the following functions. Fs : the optimal value of the SPIUH-RT problem. Fv (i 1 , i 2 , . . . , i p ) : the minimum number of modified edges in Tv when the edges in Sv (i 1 , . . . , i p ) are modified, for any v ∈ V ∗ (i 1 ∈ {0, 1, . . . , s1 }, i 2 ∈ {0, 1, . . . , s2 }, . . . , i p ∈ {0, 1, . . . , s p }), where Tv is the subtree of T rooted at v. Fv (i 1 , i 2 , . . . , i p ) is the optimal value of the following SPIUH-RT problem for the subtree Tv rooted at v. min
ei ∈Tv
H (wi∗ , wi )
s.t dw∗ (v, tk ) ≤ dk , for each terminal tk of subtree Tv , li ≤ wi∗ ≤ wi , ei ∈ Tv ,
(6)
where dk := dk −
ei ∈Sv (i 1 ,...,i p )
li −
wi .
(7)
ei ∈Pv \Sv (i 1 ,...,i p )
If problem (6) is infeasible, then Fv (i 1 , i 2 , . . . , i p ) = +∞. For any node v ∈ s ∪ V ∗ , for each vh ∈ CC(v), let Tv,vh = Pv,vh ∪ Tvh , where Pv,vh is the only path from v to vh . The examples of Tv and Tv,vh are shown in Fig. 1. G vh (i 1 , i 2 , . . . , i p ) : the minimum number of modified edges in Tv,vh when the edges in Sv (i 1 , . . . , i p ) are modified, for any v ∈ V ∗ and vh ∈ CC(v) (i 1 ∈ {0, 1, . . . , s1 }, i 2 ∈ {0, 1, . . . , s2 }, . . . , i p ∈ {0, 1, . . . , s p }). Then the value G vh (i 1 , i 2 , . . . , i p ) is the optimal value of the following SPIUH-RT problem for the subtree Tv,vh rooted at v.
123
J Optim Theory Appl
min
ei ∈Tv,vh
H (wi∗ , wi )
s.t dw∗ (v, tk ) ≤ dk , li ≤ wi∗ ≤ wi ,
for each terminal tk of subtree Tvh , ei ∈ Tv,vh ,
(8)
where dk is defined as shown in (7). If problem (8) is infeasible, then G vh (i 1 , i 2 , . . . , i p ) = +∞. The values for F and G can be computed by traversing the rooted tree in postorder (from leaves to the root s) using the following relations. For each non-leaf node vh ∈ CC(v), G vh (i 1 , i 2 , . . . , i p ) = min{Fvh (i 1 , . . . , i p , i p+1 ) + i p+1 : i p+1 ∈ {0, 1, . . . , s p+1 }, s p+1 = |Pvh ∩ E p+1 |}. (9) For each leaf node vh ∈ CC(v), Tv,vh is just a chain from v to vh . In this case, G vh (i 1 , i 2 , . . . , i p ) can be easily obtained by using a greedy algorithm G A in [15] (refer Algorithm GA). For each node v ∈ V ∗ , we have Fv (i 1 , i 2 , . . . , i p ) = G vh (i 1 , i 2 , . . . , i p ), (10) vh ∈CC(v)
where i 1 ∈ {0, 1, . . . , s1 }, i 2 ∈ {0, 1, . . . , s2 }, . . . , i p ∈ {0, 1, . . . , s p }. For v = s, there is only one non-leaf critical child vs of s, and p = T ab(s)−1 = 0. Hence, G vs = min{Fvs (i 1 ) + i 1 : i 1 ∈ {0, 1, . . . , s1 }}.
(11)
Therefore, the optimal value of the SPIUH-RT problem can be calculated as Fs = G vs .
(12)
Algorithm GA Greedy algorithm for solving the SPIUH problem on chains Input: A chain P1 with a source–terminal pair (s, t1 ), two edge weight vectors l and w, and a value d1 . Output: An optimal solution w˜ or the infeasibility of the instance. 1: If e∈P1 l(e) > d1 , then output that the instance is infeasible and stop. 2: Let w 0 := w − l. Rearrange the vector w 0 in a non-increasing order, that is, w 0j ≥ w 0j ≥ · · · ≥ w 0j , m 1 2 where m := |P1 |. Let i := 0, and W := e∈P1 w(e). 3: while W > d1 do 4: Put i := i + 1, and W := W − w 0j . i 5: end while 6: Output an optimal solution w˜ defined as w˜ jq = l jq if 1 ≤ q ≤ i and w jq otherwise.
The dynamic programming algorithm can be described in Algorithm DP concretely. Now we analyze the time complexity of Algorithm DP. Firstly, the time complexity
123
J Optim Theory Appl
of Algorithm G A is O(m log m) as the main computation involves the sorting of the values of w 0 , where m is the number of edges in the chain. Algorithm DP Dynamic programming algorithm for solving the SPIUH-RT problem Input: A tree T rooted at s with source–terminal pairs (s, tk ), k = 1, 2, · · · , r , two edge weight vectors l and w, and d1 , d2 , · · · , dr . Output: The optimal value and an optimal solution of the SPIUH-RT problem. 1: for k = 1 → r do 2: Call Algorithm GA for calculating all the values G tk (i 1 , . . . , i pk ), where i 1 ∈ {0, 1, . . . , s1k }, i 2 ∈ {0, 1, . . . , s2k }, . . . , i pk ∈ {0, 1, . . . , s kpk }, s kj := |Ptk ∩ E j |, j = 1, · · · , pk and dk := dk − ei ∈St (i 1 ,...,i p ) li − ei ∈Pt \St (i 1 ,...,i p ) wi . k k k k k 3: end for 4: Let L := max{L(e) : e ∈ E} be the maximum layer number. 5: for a = L − 1 → 1 do 6: Let CCa := {v : T ab(v) = a + 1, v ∈ / Z is a critical child o f some node}. 7: while there is a node vτ ∈ CCa do 8: for i 1 ∈ {0, 1, . . . , s1τ }, i 2 ∈ {0, 1, . . . , s2τ }, . . . , i a ∈ {0, 1, . . . , saτ }, where s τj := |Pvτ ∩ E j |, j = 1, · · · , a do 9: Calculate all the values Fvτ (i 1 , i 2 , . . . , i a ) = vh ∈CC(vτ ) G vh (i 1 , i 2 , . . . , i a ). G vτ (i 1 , i 2 , . . . , i a−1 ) =
min
{Fvτ (i 1 , . . . , i a ) + i a , saτ = |Pvτ ∩ E a |}.
i a ∈{0,1,...,saτ }
Denote the set of modified edges corresponding to Fvτ (i 1 , i 2 , . . . , i a ) and G vτ (i 1 , i 2 , . . . , i a−1 ) by S Fvτ (i 1 , i 2 , . . . , i a ) and SG vτ (i 1 , i 2 , . . . , i a−1 ), respectively. 11: Update CCa := CCa \vτ . 12: end for 13: end while 14: end for 15: Let vs be the only non-leaf critical child of the source node s. 16: Output the optimal value Fs = G vs of the SPIUH-RT problem. The corresponding set of modified edges is given by SG vs . Then an optimal solution is w ∗ , where wi∗ := li if ei ∈ SG vs and wi otherwise. 10:
Theorem 4.1 Algorithm DP can be computed in O(r · K L−1 · (K (L + log K ) + R)) time, where L := maxe∈E L(e) is the maximum layer number, R := maxv∈V {deg(v)} − 1, K := 1 + maxe∈E |H (e)| and H (e) := {e : L(e) = L(e ), Q(e ) = Q(e)} for any e ∈ E. Proof In Lines 1–3 of Algorithm DP, we are required to compute all the r values G tk (i 1 , . . . , i pk ) for k = 1, · · · , r . Given a fixed terminal tk , we are required to calculate K L−1 values G tk (i 1 , . . . , i pk ) as each i j ∈ {0, 1, . . . , s kj } and s kj = |Ptk ∩E j | ≤ K , j = 1, · · · , pk ≤ L − 1. Furthermore, for a set of given numbers i 1 , . . . , i pk , each value G tk (i 1 , . . . , i pk ) can be computed in O(K · log K ) steps using Algorithm GA, and each dk can be computed in O(K · L) steps using (7). Hence, Lines 1–3 can be executed in O(r · K L−1 · (K · log K + K · L)) = O(r · K L · (L + log K )).
123
J Optim Theory Appl
s
e11 e13 e14 e15 v v v v11 v13 v14 e1 v1 e2 v2 e3 v3 e4 4 e6 v6 e7 7 e8 8 e9 v9 e12 e5 e10
v5
v10
v15e16 v16
v12
Fig. 3 An example for explaining the definitions of H (e), Ω, and Ω in Corollary 4.2
In Lines 4-14, for each a from L − 1 to 1, the number |CCa | is upper bounded by the number r of terminals, which is the number of iterations in the while circulation. For each vτ ∈ CCa , we are required to calculate K a values of Fvτ (i 1 , i 2 , . . . , i a ), as each i j ∈ {0, 1, . . . , s τj } and s τj = |Pvτ ∩ E j | ≤ K , j = 1, · · · , a. For each value of Fvτ (i 1 , i 2 , . . . , i a ), we are required to summarize R values of G vh (i 1 , i 2 , . . . , i a ) for each vh ∈ CC(vτ ) in O(R) time. Furthermore, each value G vτ (i 1 , i 2 , . . . , i a−1 ) can be computed in O(K ) time by finding the minimum value among saτ (≤ K ) values Fvτ (i 1 , . . . , i a ) + i a for i a ∈ {0, 1, . . . , saτ }. Therefore, for a set of given parameters i 1 , i 2 , . . . , i a , Fvτ (i 1 , i 2 , . . . , i a ) and G vτ (i 1 , i 2 , . . . , i a−1 ) can be computed in O(R + K ) time. As a result, the worst-case time complexity in Lines 4-14 can be computed as follows. O
L−1
r · K · (R + K ) = r (R + K ) · O a
a=1
= r · (R + K ) · O
L−1
K
a
a=1
KL −1 − 1 = O r · K L−1 · (R + K ) . K −1
In Lines 15–16, we are only required to compute the optimal value Fs = G vs , which can be done in O(K ) time. As a conclusion, the time complexity of Algorithm DP can be obtained as shown below.
O(r · K L · (L +log K )+r · K L−1 · (R + K )) = O r · K L−1 · (K (L +log K )+ R) .
From Theorem 4.1, it is easy to obtain the following corollary. Corollary 4.1 If the maximum layer number L of the rooted tree is a constant, then problem (2) can be solved in polynomial time. Corollary 4.2 Let Ω := {H (e) : ∀e ∈ E} and Ω := {H : H ∈ Ω, and |H | → +∞ when n → +∞}. If the maximum layer number L = O(log n), and there exists a constant C such that |Ω | < C, then problem (2) can be solved in polynomial time. Before we prove Corollary 4.2, we use Fig. 3 to explain some definitions used in the corollary.
123
J Optim Theory Appl
In Fig. 3, H (e1 ) = H (e2 ) = H (e3 ) = H (e4 ) = {e1 , e2 , e3 , e4 }, H (e10 ) = {e10 }, and Ω = {H (e1 ), H (e5 ), H (e6 ), H (e10 ), H (e11 ), H (e12 ), H (e13 )}. It should be noted that n = 17, log n = 4, |H (e1 )| = |H (e6 )| = |H (e13 )| = log n → +∞ when n → +∞, then Ω = {H (e1 ), H (e6 ), H (e13 )}. Proof (1) If K is a constant, then Ω = ∅ and |Ω | = 0 < C. If L = O(log n) = C1 log n, let b = log K , then K L ≤ 2bL = 2bC1 log n = n bC1 , where C1 and b are constants. It should be noted that R ≤ r < n, then
R . O r · K L−1 · (K L + K log K + R) = O r · n bC1 · L + log K + K Hence, if K is a constant, then problem (2) can be solved in polynomial time. (2) If there exists a constant C such that |Ω | < C and L = O(log n), let K˜ = 1 + max{| H˜ | : H˜ ∈ Ω \ Ω } be 1 plus the maximum cardinality of H˜ that has a constant-bounded number of edges. In the proof of Theorem 4.1, we count the number of values Fvτ (i 1 , i 2 , . . . , i a ) as K a . We then compute the time complexity in Lines 4–14 of Algorithm DP in greater detail. Let J1 = { j|s τj → +∞ when n → +∞} and J2 = {1, 2, · · · , a} \ J1 , thus, |J1 | ≤ |Ω | < C and |J2 | = a − |J1 | ≤ a. If j ∈ J2 , then s τ ≤ K˜ . If j ∈ J1 , then j
s τj ≤ K . Therefore, it is necessary to calculate K |J1 | · K˜ |J2 | ≤ K C · K˜ a values of Fvτ (i 1 , i 2 , . . . , i a ). The worst-case time complexity of Lines 4–14 of Algorithm DP can be calculated as shown below. L−1 L−1 C a−|J | C a 1 r · K · K˜ · (R + K ) = O r · (R + K ) · K · O K˜ a=1
= O r · (R + K ) · K C ·
K˜ L − 1 K˜ − 1
a=1
= O r · (R + K ) · K C · K˜ L−1 .
Similarly, the worst-case time complexity of Lines 1–3 of Algorithm DP can be calculated as shown below. O(r · K |J1 | · K˜ (L−1−|J1 |) · K · (L + log K )) = O(r · K C+1 · K˜ (L−1) · (L + log K )). Consequently, the total time complexity is O(r · K C · K˜ (L−1) · (K L + K log K + K + R)). It should be noted that L = O(log n), R ≤ r < n, and the parameters K˜ and C are constants. Then, it follows from Case (1) that problem (2) can be solved in polynomial time.
Remark 4.1 If L = O(n) in the rooted tree, then Algorithm DP runs in exponential time in the worst case. In the rooted tree T given in Fig. 4, L = n2 , r = n2 , R = 2, and K = 2. Then using Theorem 4.1, we can obtain the complexity of the dynamic programming algorithm as
123
J Optim Theory Appl
s
e1
v1 e2 v2
e3
v3 e4
e5
v4
v5
e7 e6
v7
v6
e9 e8 v8
vn-3
v9 e10 v10
v en-1 n-1 en-2 vn-2
Fig. 4 An extremal rooted tree for the SPIUH-RT problem
n n · 2 2 −1 2 log 2+2 · + 2 2 2 √ n 2 = O(n 2 ).
O(r · K L−1 · (K (log K + L)+ R)) = O
n
Next, we present some lemmas for improving the calculation process during the execution of Algorithm DP. Lemma 4.1 For v ∈ V ∗ , if there is a critical child vh ∈ CC(v) such that G vh (i 1 , i 2 , . . . , i p ) = +∞, then Fv (i 1 , i 2 , . . . , i p ) = +∞. G vl (i 1 , i 2 , . . . , i p ). Proof From (10), we know that Fv (i 1 , i 2 , . . . , i p ) = vl ∈CC(v)
It should be noted that for node vh ∈ CC(v), G vh (i 1 , i 2 , . . . , i p ) = +∞, then
Fv (i 1 , i 2 , . . . , i p ) = +∞. Lemma 4.2 Let us assume that vh ∈ CC(v). If G vh (i 1 , i 2 , . . . , i p ) = +∞, then G vh ( j1 , j2 , . . . , j p ) = +∞, where j1 ≤ i 1 , j2 ≤ i 2 , . . . , j p ≤ i p and i 1 , j1 ∈ {0, 1, . . . , s1 }, i 2 , j2 ∈ {0, 1, . . . , s2 }, . . . , i p , j p ∈ {0, 1, . . . , s p }. Proof Let us assume that G vh (i 1 , i 2 , . . . , i p ) = +∞. Thus, it is not difficult to prove that G vh ( j1 , j2 , . . . , j p ) ≥ G vh (i 1 , i 2 , . . . , i p ) for j1 ≤ i 1 , j2 ≤ i 2 , . . . , j p ≤ i p and i 1 , j1 ∈ {0, 1, . . . , s1 }, i 2 , j2 ∈ {0, 1, . . . , s2 }, . . . , i p , j p ∈ {0, 1, . . . , s p }. Hence,
G vh ( j1 , j2 , . . . , j p ) = +∞. Lemma 4.3 If Fv (i 1 , i 2 , . . . , i p ) = +∞, then Fv ( j1 , j2 , . . . , j p ) = +∞, where j1 ≤ i 1 , j2 ≤ i 2 , . . . , j p ≤ i p and i 1 , j1 ∈ {0, 1, . . . , s1 }, i 2 , j2 ∈ {0, 1, . . . , s2 }, . . . , i p , j p ∈ {0, 1, . . . , s p }. Proof Let us assume that Fv (i 1 , i 2 , . . . , i p ) = +∞. It follows from Lemma 4.1 that there is a critical child vh ∈ CC(v), such that G vh (i 1 , i 2 , . . . , i p ) = +∞. From Lemma 4.2, G vh ( j1 , j2 , . . . , j p ) = +∞ for j1 ≤ i 1 , j2 ≤ i 2 , . . . , j p ≤ i p and ∈ {0, 1, . . . , s2 }, . . . , i p , j p ∈ {0, 1, . . . , s p }. Therei 1 , j1 ∈ {0, 1, . . . , s1 }, i 2 , j2 G vl ( j1 , j2 , . . . , j p ) = +∞.
fore, Fv ( j1 , j2 , . . . , j p ) = vl ∈CC(v)
5 Computation Experiments with the Dynamic Programming Algorithm In this section, we first use Example 5.1 for demonstrating the detailed computing process of Algorithm DP to solve the SPIUH-RT problem and then compare the computational performance of Algorithm DP with that of the bintprog function in MATLAB 7.0, which is used to solve 0-1 integer programming problems.
123
J Optim Theory Appl
w1 =6 3
s
6
e1
v1
2
e2
v2
e3
v3 3
e9
e11 4
3
e4
6
v4
v9
e
6
2
4
e6
v6
5
e7
e10
v5 v7
4
e8
w8=4
v8
v10
v11 e123 v12
7
e13
v13
4
e14
v14
7
e15
v15
4
e16
v16
4
e17
v17
Fig. 5 An example of the SPIUH-RT problem
5.1 A Computational Example In this subsection, we use Example 5.1 to demonstrate the detailed computing process of Algorithm DP. We calculate the values of F and G in Algorithm DP from the terminals to the root s. Example 5.1 As shown in Fig. 5, let V = {s, v1 , v2 , . . . , v17 }, E = {e1 , e2 , . . . , e17 }, w = (6, 2, 3, 3, 6, 4, 6, 4, 3, 2, 4, 3, 7, 4, 7, 4, 4), and l(ei ) = 1 for all i = 1, 2, . . . , 17. t1 = v6 , t2 = v8 , t3 = v10 , t4 = v14 , t5 = v17 , and (d1 , d2 , d3 , d4 , d5 ) = (14, 13, 8, 17, 19). Next, for Example 5.1, we present the detailed process for calculating Fv2 (2) using Algorithm DP. For convenience, we refer to lines 1–3, lines 4–14, and lines 15–16 of Algorithm DP as Step 1, Step 2, and Step 3, respectively. Step 1 For k = 1, i 1 = s11 = 2, i 2 = s12 = 2, and d1 = d1 − 4 = 10. Thus, G t1 (2, 2) = 0 and SG t1 (2, 2) = ∅. When i 2 = 1, d1 = d1 − 3 − 3 = 8, and thus, G t1 (2, 1) = 1 and SG t1 (2, 1) = {e5 }. When i 2 = 0, d1 = d1 − 2 − 6 = 6, and thus, G t1 (2, 0) = 1 and SG t1 (2, 0) = {e5 }. For k = 2, i 1 = s11 = 2, i 2 = s12 = 2, and d2 = d2 − 4 = 9. Thus, G t2 (2, 2) = 1 and SG t2 (2, 2) = {e7 }. When i 2 = 1, d2 = d2 − 3 − 3 = 7, and thus, G t2 (2, 1) = 1 and SG t2 (2, 1) = {e7 }. When i 2 = 0, d2 = d2 − 2 − 6 = 5, and thus, G t2 (2, 0) = 1 and SG t2 (2, 0) = {e7 }. For k = 3, i 1 = s11 = 2 and d3 = 6, and thus, G t3 (2) = 0 and SG t3 (2) = ∅. For k = 4, i 1 = s11 = 2,
123
J Optim Theory Appl
i 2 = s12 = 2, and d4 = d4 − 4 = 13. Thus, G t4 (2, 2) = 0 and SG t4 (2, 2) = ∅. When i 2 = 1, d4 = d4 − 3 − 3 = 11, and thus, G t4 (2, 1) = 0 and SG t4 (2, 1) = ∅. When i 2 = 0, d4 = d4 −2−7 = 8, and thus, G t4 (2, 0) = 1 and SG t4 (2, 0) = {e13 }. For k = 5, i 1 = s11 = 2, i 2 = s12 = 2 and d5 = d5 − 4 = 15. Thus, G t5 (2, 2) = 0 and SG t5 (2, 2) = ∅. When i 2 = 1, d5 = d5 − 3 − 3 = 13, and thus, G t5 (2, 1) = 1 and SG t5 (2, 1) = {e15 }. When i 2 = 0, d5 = d5 − 2 − 7 = 10, and thus, G t5 (2, 0) = 1 and SG t5 (2, 0) = {e15 }. Step 2 Step 2.1 For a = L − 1 = 3 − 1 = 2, CC2 = {v4 , v12 }. Step 2.1.1 When vτ = v4 , then Fv4 (2, 2) = G t1 (2, 2) + G t2 (2, 2) = 1 and S Fv4 (2, 2) = SG t1 (2, 2) ∪ SG t2 (2, 2) = {e7 }. Fv4 (2, 1) = G t1 (2, 1) + G t2 (2, 1) = 2 and S Fv4 (2, 1) = SG t1 (2, 1) ∪ SG t2 (2, 1) = {e5 , e7 }. Fv4 (2, 0) = G t1 (2, 0) + G t2 (2, 0) = 2 and S Fv4 (2, 0) = SG t1 (2, 0) ∪ SG t2 (2, 0) = {e5 , e7 }. G v4 (2) = min{Fv4 (2, 2) + 2, Fv4 (2, 1) + 1, Fv4 (2, 0) + 0} = Fv4 (2, 0) + 0 = 2, SG v4 (2) = {e5 , e7 }. Step 2.1.2 When vτ = v12 , then Fv12 (2, 2) = G t4 (2, 2) + G t5 (2, 2) = 0 and S Fv12 (2, 2) SG t5 (2, 2) = ∅. Fv12 (2, 1) = G t4 (2, 1) + G t5 (2, 1) = 1 and S Fv12 (2, 1) SG t5 (2, 1) = {e15 }. Fv12 (2, 0) = G t4 (2, 0) + G t5 (2, 0) = 2 and S Fv12 (2, 0) SG t5 (2, 0) = {e13 , e15 }. G v12 (2) = min{Fv12 (2, 2)+2, Fv12 (2, 1)+1, Fv12 (2, 0)+0} = andSG v12 (2) = {e13 , e15 }.
= SG t4 (2, 2) ∪ = SG t4 (2, 1) ∪ = SG t4 (2, 0) ∪ Fv12 (2, 0)+0 = 2
Step 2.2 For a = L − 1 − 1 = 1, CC1 = {v2 } and vτ = v2 . Thus, Fv2 (2) = G v4 (2) + G t3 (2)+G v12 (2) = 4, and S Fv2 (2) = SG v4 (2)∪SG t3 (2)∪SG v12 (2) = {e5 , e7 , e13 , e15 }. The computation results of Fv2 (2) are presented in Table 1. For the sake of brevity, we omit the process of calculating Fv2 (1) and Fv2 (0) and present the computation results in Tables 2 and 3, respectively. Table 2 shows that Fv2 (1) = 5 and S Fv2 (1) = {e3 , e5 , e7 , e13 , e15 }. Table 3 shows that Fv2 (0) = +∞, which means that the instance is infeasible if neither of the two edges e1 and e2 is updated. It should be noted that in Table 3, it follows from Lemma 4.1 that the values Fv12 (0, i 2 )(i 2 = 2, 1, 0) and G v12 (0) are not required to be computed as G t3 (0) = +∞.
123
J Optim Theory Appl Table 1 Computational process of Fv2 (2) and S Fv (2) in Example 5.1 2
SG t (2, i 2 )
dk
Fv (2, i 2 ) (S Fv (2, i 2 ))
G v (2) (SG v (2))
Fv2 (2) (S Fv (2))
G t1 (2, 2) = 0
∅
d1 = 10
Fv4 (2, 2) = 1 ({e7 })
G v4 (2) = 2 ({e5 , e7 })
G t2 (2, 2) = 1 G t1 (2, 1) = 1
{e7 } {e5 }
d2 = 9 d1 = 8
Fv2 (2) = 4 ({e5 , e7 , e13 , e15 })
G t2 (2, 1) = 1
{e7 }
d2 = 7
G t1 (2, 0) = 1
{e5 }
d1 = 6
G t2 (2, 0) = 1
{e7 }
G t3 (2) = 0
∅
d3 = 6
G t4 (2, 2) = 0
∅
d4 = 13
G t5 (2, 2) = 0
∅
d5 = 15
G t4 (2, 1) = 0
∅
d4 = 11
G t5 (2, 1) = 1
{e15 }
d5 = 13
G t4 (2, 0) = 1
{e13 }
d4 = 8
G t5 (2, 0) = 1
{e15 }
d5 = 10
G t j (2, i 2 )
j
Fv4 (2, 1) = 2 ({e5 , e7 })
2
Fv4 (2, 0) = 2 ({e5 , e7 })
d2 = 5 G t3 (2) = 0 (∅) Fv12 (2, 2) = 0 (∅)
G v12 (2) = 2 ({e13 , e15 })
Fv12 (2, 1) = 1 ({e15 }) Fv12 (2, 0) = 2 ({e13 , e15 })
Step 3 For vs = v2 , Fs = G v2 = min{Fv2 (2) + 2, Fv2 (1) + 1, Fv2 (0) + 0} = Fv2 (1) + 1 = 6, and SG v2 = S Fv2 (1) ∪ {e1 } = {e1 , e3 , e5 , e7 , e13 , e15 }. Output the optimal value Fs = 6 and an optimal solution w ∗ = (1, 2, 1, 3, 1, 4, 1, 4, 3, 2, 4, 3, 1, 4, 1, 4, 4),
where the updated edge weights are indicated in bold. It should be noted that in this instance, there is another optimal solution w∗ shown below, where the updated edges are SG v2 = S Fv2 (2) ∪ {e1 , e2 } = {e1 , e2 , e5 , e7 , e13 , e15 }. w ∗ = (1, 1, 3, 3, 1, 4, 1, 4, 3, 2, 4, 3, 1, 4, 1, 4, 4),
where the updated edge weights are indicated in bold.
123
J Optim Theory Appl Table 2 Computational process of Fv2 (1) and S Fv (1) in Example 5.1 2
G t j (1, i 2 )
SG t (1, i 2 ) j
dk
Fv (1, i 2 ) (S Fv (1, i 2 ))
G v (1) (SG v (1))
Fv2 (1) (S Fv (1))
Fv4 (1, 2) = 2 ({e5 , e7 })
G v4 (1) = 3 ({e3 , e5 , e7 })
Fv2 (1) = 5 ({e3 , e5 , e7 , e13 , e15 })
G t1 (1, 2) = 1
{e5 }
d1 = 9
G t2 (1, 2) = 1
{e7 }
d2 = 8
G t1 (1, 1) = 1
{e5 }
d1 = 7
G t2 (1, 1) = 1
{e7 }
d2 = 6
G t1 (1, 0) = 1
{e5 }
d1 = 5
G t2 (1, 0) = 2
{e7 , e8 }
d2 = 4
G t3 (1) = 0
∅
d3 = 5
G t4 (1, 2) = 0
∅
d4 = 12
G t5 (1, 2) = 1
{e15 }
d5 = 14
G t4 (1, 1) = 1
{e13 }
d4 = 10
G t5 (1, 1) = 1
{e15 }
d5 = 12
G t4 (1, 0) = 1
{e13 }
d4 = 7
G t5 (1, 0) = 1
{e15 }
d5 = 9
2
Fv4 (1, 1) = 2 ({e5 , e7 }) Fv4 (1, 0) = 3 ({e5 , e7 , e8 }) G t3 (1) = 0 (∅) Fv12 (1, 2) = 1 ({e15 })
G v12 (1) = 2 ({e13 , e15 })
Fv12 (1, 1) = 2 ({e13 , e15 }) Fv12 (1, 0) = 2 ({e13 , e15 })
Table 3 Computational process of Fv2 (0) and S Fv (0) in Example 5.1 2 SG t (0, i 2 )
dk
Fv (0, i 2 ) (S Fv (0, i 2 ))
G v (0) (SG v (0))
Fv2 (0) (S Fv (0))
G t1 (0, 2) = 2
{e5 , e6 }
d1 = 4
Fv4 (0, 2) = 4 ({e5 , e6 , e7 , e8 })
G v4 (0) = 5 ({e3 , e5 , e6 , e7 , e8 })
Fv2 (0) = +∞ (infeasible)
G t2 (0, 2) = 2
{e7 , e8 }
d2 = 3
G t1 (0, 1) = 2
{e5 , e6 }
d1 = 2
G t2 (0, 1) = 2
{e7 , e8 }
d2 = 1
G t1 (0, 0) = 2
{e5 , e6 }
d1 = 0
G t2 (0, 0) = +∞
Infeasible
d2 = −1
G t3 (0) = +∞
Infeasible
G t j (0, i 2 )
123
j
d3 = 0
Fv4 (0, 1) = 4 ({e5 , e6 , e7 , e8 }) Fv4 (0, 0) = +∞ (infeasible) G t3 (0) = +∞ (in f easible)
2
J Optim Theory Appl
5.2 Comparison of Computational Experiments Using Algorithm DP with MATLAB Functions In this subsection, we first transform the SPIUH-RT problem into a 0-1 integer programming problem and then compare the computational performance of Algorithm DP with that of the bintprog function in MATLAB 7.0, which is used to solve 0-1 integer programming problems. By using the same method as that used in [14], we can transform the SPIUH-RT problem into a 0-1 integer programming problem. For each edge ei ∈ E, if we define a 0-1 variable xi as 1, if the weight of edge ei is not reduced, xi := 0, if the weight of edge ei is reduced, and let wi0 = wi − li and dk0 = dk − dl (Pk ), then the SPIUH-RT problem becomes equivalent to solving the 0-1 integer programming problem below. min s.t
n−1
(1 − xi )
i=1
ei ∈Pk
wi0 xi ≤ dk0 , k = 1, 2, . . . , r,
xi = 0, 1,
(13)
i = 1, 2, . . . , n − 1.
Next, we compare the computational experiments performed with Algorithm DP and the bintprog function in MATLAB 7.0 (denoted by Algorithm 0-1). The algorithms were coded in MATLAB 7.0 and run on a Windows 7 PC with Intel(R), Core(TM)i7-3770 CPU, and 3.40 GHz. Till date, we have not found any study on the SPIUH-RT problem that provides any typical instances of rooted trees, and thus, we have generated some instances randomly. Furthermore, we have generated some extremal rooted trees as shown in Fig. 4 to investigate the effectiveness of Algorithm DP for the instances that run in exponential time. We have tested the two algorithms on nine classes of randomly generated rooted trees, with the number n of nodes varying from 30 to 5000: 30, 40, 50, 64, 100, 200, 1000, 2000, and 5000. Given the number n of nodes in the rooted trees, the number r of terminal nodes is generated randomly, and these are uniformly distributed over the interval [ n3 , n2 ]. Next, the structure of the root trees with n nodes and r leaves is generated randomly. For these rooted trees, we consider li = 0. For the instances with li = 0, we can transform them such that they are equivalent to instances with li = 0 based on the 0-1 integer programming problem (13). The edge weight wi is generated randomly and uniformly distributed over [1, n2 ]. Each dk can be generated randomly and uniformly k) k) distributed over [ dw (s,t , 2dw (s,t ] for each source–terminal pair (s, tk ). The time 3 3 limit for solving a single instance is 7200 s, which means a failure occurs if the running time exceeds this limit. The computational results are presented in Table 4, which displays the average CPUtimes in seconds of the two algorithms for a number of instances of each class of rooted trees. In Table 4, the symbol * indicates that an instance could not be solved using the
123
J Optim Theory Appl Table 4 Performances of Algorithm DP and Algorithm 0-1 NI
n
Algorithm DP
Algorithm 0-1
100
30
0.0023
0.2282
100
40
0.0025
1.0310
50
50
0.0028
4.8622
30
64
0.0042
14.8638
20
100
0.0070
821.7165
100
200
0.0172
*
100
1000
0.3223
*
100
2000
1.0004
*
100
5000
1.4019
*
NI number of instances; n number of nodes Algorithm DP average time in CPU seconds using algorithm DP Algorithm 0-1 average time in CPU seconds using the bintprog function in MATLAB 7
Table 5 Performances of Algorithm DP and Algorithm 0-1 on extremal rooted trees NI
n
Algorithm DP
Algorithm 0-1
100
20
0.0211
0.1493
100
25
0.0736
0.3810
100
30
0.5540
1.2454
100
35
2.0079
4.2685 38.2255
50
40
14.8915
20
45
61.553
30
50
508.5659
20
55
4272.8752
190 789.0406 *
NI number of instances, n number of nodes Algorithm DP average time in CPU seconds using algorithm DP Algorithm 0-1 average time in CPU seconds using 0-1 bintprog function in MATLAB 7
Algorithm 0-1 for the classes of rooted trees with n ≥ 100. The table shows that the running time of Algorithm DP given in the paper is much better than that obtained with Algorithm 0-1 even when n is not too large (for example, 30 ≤ n ≤ 100). Moreover, when n is sufficiently large (for example, n ≥ 200), Algorithm 0-1 cannot solve the SPIUH-RT problem efficiently, while Algorithm DP can solve such instances rapidly and efficiently. Based on Remark 4.1, for the extremal rooted trees in which the maximum layer number L = n2 and the number r = n2 of terminals, Algorithm DP runs in √ n an exponential time O(n 2 2 ). It should be noted that for these extremal rooted trees, Algorithm 0-1 also runs in an exponential time. We compare the performances of the two algorithms on randomly generated extremal rooted trees and present the computational results thus obtained in Table 5. Based on the data in Table 5, the following can be concluded:
123
J Optim Theory Appl
(1) The performances of Algorithms DP and 0-1 deteriorate quickly as n increases from 20 to 50 for the extremal rooted trees. In particular in the case of n ≥ 55, Algorithm 0-1 would require several hours to obtain the optimal solutions. (2) The performance of Algorithm DP is better than that of Algorithm 0-1 for extremal cases when n ≤ 50. This may be due to O(n 2 ·2 L ) running time of Algorithm DP, which mainly depends on the maximum layer number L = n2 of the rooted trees. Hence, Algorithm DP is an efficient algorithm for solving most instances of SPIUH-RT problems, although its worst-case complexity is exponential time. However, for extremal rooted trees, more efficient algorithms should be developed.
6 Conclusions In this study, shortest path improvement problems on rooted trees under unit Hamming distance are studied. Based on some properties and the special structure of the problem, a dynamic programming algorithm is proposed for solving the problem, followed by an analysis of its time complexity. Finally, the results of the performed computational experiments of the problem are reported. As compared with the MATLAB function bintprog for the 0-1 integer programming problem, the dynamic programming algorithm is more efficient, although its worst-case complexity is exponential time. It is yet to be determined whether the SPIUH problem on rooted trees can be solved in polynomial time. We intend to develop a more efficient polynomial-time algorithm for solving this problem. If this is not possible, we will attempt to prove its NP-hardness. In future research, it is meaningful to discuss whether it is possible to develop a polynomial-time algorithm for solving the SPIUH problem on general trees and on other special networks. We can design efficient polynomial-time algorithms, if such a problem belongs to P. Else, we can attempt to prove its NP-hardness and propose approximation algorithms or heuristic algorithms. Acknowledgements This work was supported by the National Natural Science Foundation of China (11471073) and Chinese Universities Scientific Fund (2015B27914). The work of P.M. Pardalos was conducted at the National Research University Higher School of Economics and supported by the RSF Grant 14-41-00039.
References 1. Heuberger, C.: Inverse optimization: a survey on problems, methods, and results. J. Comb. Optim. 8, 329–361 (2004) 2. Burton, D., Toint, P.: On an instance of the inverse shortest path problem. Math. Program. 53, 45–61 (1992) 3. Zhang, J., Ma, Z., Yang, C.: A column generation method for inverse shortest path problems. ZOR Math. Method Oper. Res. 41, 347–358 (1995) 4. Zhang, J., Lin, Y.: Computation of the reverse shortest-path problem. J. Global Optim. 25, 243–261 (2003) 5. He, Y., Zhang, B., Yao, E.: Weighted inverse minimum spanning tree problems under Hamming distance. J. Comb. Optim. 9(1), 91–100 (2005) 6. Volgenant, D.C.: A some inverse optimization problems under the Hamming distance. Eur. J. Oper. Res. 170, 887–899 (2006)
123
J Optim Theory Appl 7. Guan, X.C., Zhang, B.W.: Inverse 1-median problem on trees under weighted Hamming distance. J. Global Optim. 54(1), 75–82 (2012) 8. Guan, X.C., He, X.Y., Pardalos, P.M., Zhang, B.W.: Inverse max+sum spanning tree problem under hamming distance by modifying the sum-cost vector. J. Global Optim. 69(4), 911–925 (2017) 9. Jiang, Y., Liu, L., Wu, B., Yao, E.: Inverse minimum cost flow problems under the weighted Hamming distance. Eur. J. Oper. Res. 207, 50–54 (2010) 10. Liu, L., Yao, E.: Inverse min–max spanning tree problem under the weighted sum-type Hamming distance. Theor. Comput. Sci. 396, 28–34 (2008) 11. Zhang, B., Zhang, J., He, Y.: The center location improvement under Hamming distance. J. Comb. Optim. 9(2), 187–198 (2005) 12. Zhang, B., Zhang, J., He, Y.: Constrained inverse minimum spanning tree problems under bottlenecktype Hamming distance. J. Global Optim. 34, 467–474 (2006) 13. Zhang, B., Zhang, J., Qi, L.: The shortest path improvement problem under Hamming distance. J. Comb. Optim. 12(4), 351–361 (2006) 14. Zhang, B., Guan, X., He, C., Wang, S.: Algorithms for the shortest path improvement problems under unit Hamming distance. J. Appl. Math. (2013). https://doi.org/10.1155/2013/847317 15. Zhang, B., Guan, X., Wang, Q., He, C., Samson, H.: The complexity analysis of the shortest path improvement problem under the Hamming distance. Pac. J. Optim. 11(4), 605–608 (2015)
123