EUROPEAN JOURNAL OF OPERATIONAL RESEARCH ELSEVIER
European Journal of Operational Research 83 (1995) 237-244
Theory and Methodology
A suboptimal solution to a hierarchial network design problem using dynamic programming N.G.F. Sancho Department o f Mathematics and Statistics, McGill University, Burnside Hal~ 805 Sherbrooke Street West, Montrea~ Que., Canada IDA 2K6 Received October 1993; revised December 1993
Abstract E a c h arc of a n e t w o r k h a s two n o n n e g a t i v e costs. T h e p r i m a r y cost is larger t h a n t h e secondary cost for e a c h arc. G i v e n a source n o d e a n d a d e s t i n a t i o n n o d e , it is r e q u i r e d to c o n n e c t t h e s e in a p a t h P, to w h i c h all o t h e r n o d e s are linked in o n e or m o r e tree-like structures. T h e cost of t h e resulting tree is f o u n d f r o m t h e primary costs o f t h e arcs u s e d in P a n d t h e s e c o n d a r y costs of all o t h e r arcs. A d y n a m i c p r o g r a m m i n g f o r m u l a t i o n is p r e s e n t e d w h i c h finds a s u b o p t i m a l solution to t h e p r o b l e m , a n d t h e p a p e r indicates t h e r e a s o n s for this f o r m u l a t i o n failing u n d e r c e r t a i n
circumstances.
Keywords: Networks; Dynamic programming; Shortest spanning tree; Shortest path Introduction
We are given an undirected graph, G(M, A) of a network, where M is the set of nodes, A is the set of arcs and for which each arc of the network has a primary link cost and a secondary link cost. The objective of the problem is to minimize the total cost of a primary path, P, from a predetermined starting node to a predetermined terminal node and for each node not on P withsecondary paths meeting P. It is normally assumed that for each arc (i, j) the primary link cost T/j is greater than the secondary link cost tij. Transportation network problems frequency involve a hierarchy of network ~ircs. For example in the design of the road infracture a primary path might be a hard surface road connecting two strategic nodes (or sites). The secondary paths might be gravel roads connecting other nodes to the primary path. A heuristic solution of this problem was proposed by Current, ReVelle and Cohon (1986) using k shortest paths and shortest spanning trees. Most recently Pirkul, Current and Nagarajan (1991) have proposed a new solution using Lagrangian relaxation. The problem has been shown to be NP-complete (see for example Magnanti and Mirchandani, 1993), hence the need for an efficient algorithm for a suboptimal solution. In the next section a dynamic programming formulation of the problem is proposed. If the principle of optimality is obeyed then the proposed algorithm similar to Ford's shortest path method ig of order O(I N [3); however in certain cases it is shown that the principle of optimality may not be obey~ed, but a functional equation for the solution of the problem is still given. , :~ o
0377-2217/95/$09.50 © 1995 Elsevier Science B.V. All rights reserved SSDI 0 3 7 7 - 2 2 1 7 ( 9 4 ) 0 0 0 5 6 - I
•
.
N.G.F. Sancho/European Journal of OperationalResearch 83 (1995) 237-244
238
Formulation of problem In the network described previously it is assumed that each arc (i, j) has two link values given by (T~j, tij) , where T~j is the primary link cost and tij is the secondary link cost. It is normally assumed that Zij > tij. In our example we are required to find the shortest spanning tree (SST), i.e. a connected graph of minimum length without a circuit and consisting of secondary link costs. Let the secondary link costs which form the SST be defined as ~ij = tij, i.e. if (i, j) ~ SST and tij -- 0 otherwise. The length of SST is then = Etii. The methods for finding the SST are described in Christofides (1975) and will not be repeated here. The procedure to be described uses the fact that if we can somehow find the minimum total cost of a primary path P from an origin node 1 to any node i plus cost of secondary paths meeting P with nodes not in P, then it is possible to find the minimum total cost of a primary path from 1 to i to j (1 ~ i ~ j ) plus cost of secondary paths meeting extended primary path. Let us now define f(i) to be the minimum total cost of a primary path P from a predetermined source node 1 (say) to a node i and secondary link costs meeting P (whose path form part of SST) with nodes not in P. The value of f(i) can then be defined as the optimum 2-level solution with node 1 as one end point of the primary path P and node i as the other end point. Note the secondary paths joining P must form part of SST as any other secondary paths would give a value greater than minimum total cost and the definition of f(i) would be no longer valid. If there are alternative optima for SST i.e. the same optimal value for different trees, then we can define SST k to be length of SST for the k-th alternative optima. Hence let length of SSTk = Etij" ~ if (i, j ) ~ S S T k , with ttj = tiff a n d tij ~-0 otherwise. It is therefore possible to obtain alternate optima for f(i) the optimum 2-level solution from node 1 (say) to node i depending on the value of SST k used, i.e. t h e same optimal value with different trees. If we want to use the value of f(i) to calculate f(j) using arc (i, j), then there are two cases to consider. First, the arc (i, j) ~ SST, then the recurrence will be
f(j)
= [ f ( i ) + T/j -
tij],
(1)
Second, this arc may not be in the SST. Adding (i, j ) to the set of arcs associated with the 2-level solution of node i will create a circuit. One of the arcs must be removed from this circuit to give a 2-level solution for node j, and this can be identified as an arc (m, n) from a path _/_j. _/_/_/_jis a path that links a node on the primary path from 1 to i to node j, and its arcs form a subset of the SST. (m, n) is the arc with largest secondary cost on this path. In this case the recurrence will be
f(j)
= [f(i) + Tomax (tmn)]" / (m,n)~Pj J
(2)
Using now the principle of optimality we obtain the following functional equation of dynamic programming considering all possible nodes i: f(i) + T~j-~j
f(j)
= min i*i
f(i)
+ T/j-
if (i, j ) ~ SST, max
(~n,n)~
(tmn)
otherwise,
(3)
with j = 2, 3 . . . . . N and f(1) = length of SST, i.e. if node 1 is the source node. Because of the fact that the principle of optimality may fail, Eq. (3) gives a suboptimal solution to the problem. This failure of the principle of optimality can be shown as follows. Let g(i) be defined as the cost of another primary path Pg from the source node 1 to node i plus cost of secondary tree paths meeting Pg (which are part of SST) with nodes not in Pg. We will therefore assume by definition that
g(i)
>f(i).
(4)
N.G.F. Sancho/European Journal of Operational Research 83 (1995) 237-244
If from the point i in
239
g(i) we make the decision to go to j and (i, j) ~ SST, then using (4) we have
g(i) + Tij - tij > f ( i ) + T/j - tij
(5)
and Eq. (1) is valid as (5) remains true. On the other hand if (i, j) ~ SST, then the primary link T,.j for arc (i, j) could again form a closed circuit of secondary links from j to a point in Pg (the primary path connected with g(i)). Define such a path as ~ . Hence it may be possible that
g(i) + Tij-
max
(m,n)~ffj
(tmn) < f ( i ) + T/i-
max
(m,n)~Pj
(6)
(tmn),
or
O
max (t,nn)--
(rn,n) e~.
max
(m,n)~Pi
(7)
(-tmn).
If fij ---3, then right hand side of (7) < 0 and this equation is not valid as g(i) > f ( i ) . On the other hand if RHS of ( 7 ) > 0, then it may be possible that this equation is valid. In this case the principle of
Table 1 Primary and secondary arc costs for sample problem 1
Arc (i, j) 1,2 1,3 1,7 2,3 2,8 2,9 3,4 3,6 3,7 4,5 4,6 5,6 5,11 6,7 6,8 6,10 6,11 7,8 8,9 8,10 8,12 8,13 9,12 10,11 10,13 11,12 11,13 11,14 12,13 12,14 13,14 13,15 14,15
Tiy
tij
129 182 297 139 335 422 108 171 152 101 106 111 263 118 181 193 235 156 87 189 327 499 361 100 310 333 257 212 195 342 170 248 185
33 46 75 35 68 211 27 43 38 26 27 28 132 30 91 97 118 78 44 95 164 250 181 50 155 167 129 106 98 171 85 124 93
240
N.G.F. Sancho ~European Journal of OperatiOnal Research 83 (1995) 237-244
optimality may not b e obeyed as the decision to go from any i to j may not be optimal if it depends only on The functional equation for using (6) can now be written as
f(i).
f(j)
rf(i) + T,7-
f(j) =
mini k i~j
if (i, j ) ~ SST,
-tij
((f(i)+'~y.
" |min~
+
max (m,n)E_Pj
-
(tmn)"I
max_ (L.)
,
(8)
otherwise,
(m,n)~Pj
for j = 2, 3 . . . . . N, and with boundary condition f(1) = length of SST. The inside minimum has to be taken in (8) since (6) may be valid. The conditions for which (7) is strictly valid remains under further investigation. As the problem is NP-complete (Magnanti and Mirehandani, 1993), then theoretically one has to compute all the values of g(i) in order to obtain the optimal result.
Algorithm for solution of problem The algorithm used to solve the functional equation (3) to find the suboptimal solution can now be formulated as follows. Define to be the minimum total cost of a primary path P from source node 1 to node j, j 4= 1, in r or fewer arc lengths and cost of secondary paths meeting P with nodes not in P. Hence Eq. (3) can be solved as follows w i t h allowance for i = j:
fr(j)
-fr-l(i) + T/j-tij fr(j)
= m/in f r - l ( i ) _[_
Zij --
if (i, j ) ~ SST or
m a x (tmn), (rn,n)~P_I
otherwise,
Primary Path - S e c o n d a r y Path Total N e t w o r k Cost = 1202
Fig. l. Solutiontosample problem 1.
i=j, (9)
N.G.F. Sancho/European Journal of Operational Research 83 (1995) 237.-:244
241
Table 2 Primary and secondary arc costs for sample problem 2
Arc (i, j) 1,2 1,3 125 2,4 2,9 2,10 3,4 3,6 3,7 4,5 4,9 5,8 7,7 6,11 7,8 7,12 8,9 8,12 8,13 8,17 9,10 10,13 11,12 11,14 12,14 12,15 13,18 14,15 14,19 15,16 15,19 15,20 16,17 16,20 17,18 17,21 18,21 19,20 20,21
T~j
tij
65 103 60 54 85 107 74 79 34 28 76 49 47 55 99 72 46 65 73 79 45 85 52 63 79 65 49 41 65 24 104 50 62 54 49 50 92 6! 90
33 52 30 27 43'
54 37 40 17 14 38 25 24 28 50 36' 23 33 37 40 23 43 26 32 40 33 25 21 33 12 52 25 31 27 25
T
~ 25
46 31 45
for r = 1, 2 , . . . , N - 1; j = 2, 3 . . . . . N, with T/i = tii = 0 a n d b o u n d a r y c o n d i t i o n f ° ( 1 ) = l e n g i h of SST, f ( / ) , ,¢ j ' s a n d r ' s i n N - 1 or fewer steps. This type o f l a b e l - c o r r e c t i n g algorithm, similar t o F o r d ' s shortest p a t h ' m e t h o d (Christofides, 1975) is O ( I N I 3 ) . H o w e v e r D y k s t r a ' s m e t h o d for shortest p a t h s is O ( I N I 2 ) , b u t the a u t h o r f o u n d it m o t e
f o ( j ) = oo i f j ~ 1. C o n v e r g e n c e is o b t a i n e d w h e n f r ( j ) = f r - l ( j ) =
complicated to apply Dykstra's method here.
~
Worked examples
'
:,
i
Example 1. This example is the one given by Current et al. (1986). It is assumed that:the arc Costs are symmetric, i.e. T/j = Tji and tij = tji, See Table 1.
242
N.G.F. Sancho/European Journal of Operational Research 83 (1995) 237-244
19
14i l
6
l \
- --~-~/II
\\
II I 3
i / I
I
\
,7
167
,/
..i_~
\
I
[
21
[_ \
\
\
""
"
" "
9 \713V..- " ~
7
7"
18
,
Primary
Path
Secondary Path Total N e t w o r k Cost = 675
10 Fig. 2. Solutionto sampleproblem 2. Using the algorithm given in Eq. (9) the following values are obtained and shown in Fig. 1, with the predetermined starting and terminal node as 9 and 15 respectively. The primary path cost is 773 given by path 9-8-10-11-14-15 and secondary path cost is 429 given by secondary paths 1-2-8, 2-3-4-5, 4-6-7, 12-13-14. The total network cost for this example is 1202. Example 2. This example is the same sample problem two given by Current et al. (1986) arc costs are again assumed to be symmetric. See Table 2. The predetermined starting and terminal nodes are 2 and 19 respectively. The solution obtained using Eq. (9) is shown in Fig. 2. The primary path cost is 340 given by path 2-4-5-8-12-14-19. The secondary path cost is 335 gi~ren by paths 1-5, 3-7-6-11-12, 10-9-8, 13-18-17-16-15-14, 17-21, 15-20. The total network cost is 675 and this agrees with the solution given by Current et al. (1986). Example 3. This special example had to be constructed to show when the principle of optimality failed. See Table 3. It is again assumed that all arc costs are symmetric, the starting node is 1 and the terminal node is 6. Using the algorithm given by Eq. (9) the following values are obtained, f(4) = 31 with primary path as 1-2-4 and secondary paths as 2-5-6 and 2-3. Finally f(6) = 38 with primary path cost of 30 given by path 1-2-4-6 and secondary path cost of 8 given by paths 3-2 and 2-5. The optimal solution to this problem shown in Fig. 3 is given by a total network cost of 37 with primary cost of 32 given by path 1-3-4-6 and secondary path cost of 5 given by path 3-5-6. In order to obtain optimal value we would have to obtain g(4) = 33 with primary path as 1-3-4 and secondary path as 3-2-5-6. This value of g(4) would have to be
243
N.G.F. Sancho/European Journal of Operational Research 83 (1995) 237-244 Table 3 Primary and secondary arc cost for sample problem 3
Arc (i, j)
Ti.#
tij
1,2 1,3 2,5 2,4 3,2 3,4 4,6 5,6
10 11 12 10 12 11 10 12
7 8 2 7 6 7 7 3
2
/4 / / / / / i p/
i
3
/
l l I
[
I I T i 4
Primary Path Secondary Path Total N e t w o r k
Cost
= 37
Fig. 3. S o ~ t ~ n ~ sample problem 3.
substituted into Eq. (8) to obtain the optimal value given above. This is one example where the principle of optimality fails. Summary and conclusions The hierarchical network design problem (HNDP) was first formulated by Current et al. (1986). Recently a new heuristic solution procedure for the HNDP based upon Lagrangean relaxation was given by Pirkul et al. (1991). The method proposed uses the principle of optimality of dynamic programming to obtain a suboptimal solution. The solution obtained is usually optimal or very near the optimal solution. For other larger problems tried out up to N = 50 the solutions obtained were always optimal. This was compared with the integer programming formulation given by Current et al. (1986) and Pirkul et al. (1991). It is hoped to extend the current research by the method proposed to problems with more than one origin/destination pair connected by primary paths. References Christofides, N. (1975), Graph Theory:An Algorithmic Approach, Academic Press, New York. Current, J.R., ReVelle, C.S., and Cohon, J.L. (1986), "The hierarchical network design problem", European Journal of Operational Research 27, 57-66.
244
N.G.F. Sancho/European Journal of Operational Research 83 (1995) 237-244
Magnanti, T.L., and Mirchandani, P. (1993), "Shortest paths, single origin-destination network design, and associated polyhedra", Networks 23, 103-121. Pirkul, FI., Current, J.R., and Nagarajan, V. (1991), "The hierarchical network design problem: A new formulation and solution procedures,!, Transportation Science 25/3, 175-182.