Journal of Applied Mathematics

Volume 2013 (2013), Article ID 847317, 8 pages

http://dx.doi.org/10.1155/2013/847317

## Algorithms for the Shortest Path Improvement Problems under Unit Hamming Distance

^{1}Department of Mathematics and Physics, Hohai University, Changzhou 213022, China^{2}Department of Mathematics, Southeast University, Nanjing 210096, China

Received 1 July 2013; Accepted 19 August 2013

Academic Editor: Frank Werner

Copyright © 2013 Bingwu Zhang et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

In a shortest path improvement problem under unit Hamming distance (denoted by SPIUH), an edge weighted graph with a set of source-terminal pairs is given; we need to modify the lengths of edges by a minimum cost under unit Hamming distance such that the modified distances of the shortest paths are upper bounded by given values. The SPIUH problem on arborescent network is formulated as a 0-1 integer programming model. Some strongly polynomial time algorithms are designed for the problems on some special arborescent networks. Firstly, two greedy algorithms are proposed for problems on chain networks and special star-tree networks, respectively. Secondly, a strongly polynomial time algorithm is presented for the problem with a single source and constrained paths. Finally, a heuristic algorithm and its computational experiments are given for the SPIUH problem on general graphs.

#### 1. Introduction

Due to theoretical and practical importance, the inverse shortest path problems and the shortest path improvement problems have been extensively studied in recent years. In such problems, an edge weighted graph with a set of source-terminal pairs is given; we need to modify the lengths of edges by a minimum cost under a given norm. In an inverse shortest path problem, the aim is to make a set of given paths become the shortest source-terminal paths, while in a shortest path improvement problem the aim is to make the modified distances of the shortest paths upper bounded by given values. Burton and Toint [1] solved the inverse shortest path problem under norm by the nonlinear programming technique. Zhang et al. [2] proposed a column generation method for the inverse shortest path problem under norm. Zhang and Lin [3] showed that the shortest path improvement problem under norm is NP-complete and proposed polynomial time algorithms for the case of trees and the case of single source-terminal. Guan and Zhang [4, 5] studied network improvement problems for a tree-path system or a multicut by upgrading nodes in a directed tree. For detail of inverse optimization problems, the readers may refer to the survey paper by Heuberger [6].

Since the inverse optimization problems under Hamming distance were first studied by He et al. [7], it has been investigated by many researchers (see, e.g., Zhang et al. [8–10], Duin and Volgenant [11], Guan and Zhang [12], Liu and Yao [13], and Jiang et al. [14]). Zhang et al. [8] showed that the shortest path improvement problem under Hamming distance (denoted by SPIH) is strongly NP-hard on general graphs and is still NP-hard even if the network is a chain network. So it is meaningful to design polynomial time algorithms for some special cases of the problems and to propose approximation and/or heuristic algorithms for the SPIH and the shortest path improvement problem under unit Hamming distance (denoted by SPIUH) on general graphs. That is the objective of this paper.

Let be a connected undirected network, where is the vertex set, is the edge set. Let be the length of edge and the lower bound on the modified length of , where . Let be the set of source-terminal pairs of vertices. Denote by the shortest distance connecting to under the length vector . Let be the upper bound of the shortest distance connecting the source-terminal pair . The SPIUH problem is to find a new edge length vector satisfying such that the modified shortest distance is upper bounded by , and the total edge modification cost is minimized under unit Hamming distance, which can be formulated as a mathematical model shown below: where the Hamming distance is defined as

Zhang et al. show in [8] that SPIH problem can be transformed into a 0-1 knapsack problem in the special case when the given network is a chain network and .

Lemma 1 (see [8]). *The SPIH problem is NP-hard even if the network is a chain network.*

The shortest path improvement problems under Hamming distance have practical background. For example, a large earthquake happened in some towns. The relief supplies need to be quickly handed out to the people in the stricken area. However, many roads were badly damaged, and we have to repair the roads as soon as possible. Consider the network of towns, where denotes a town, denotes a road connecting to . Let and be the travelling time through the road before/after is repaired. Note that some points of the road are damaged (rather than every point of the road being destroyed), so the repair time for the road may be a fixed amount instead of . We need to transport the relief goods from some supplier town to some stricken town within the stipulated time. Our objective is to design a repair scheme satisfying the above transportation requirement such that the total repair time of repaired roads is minimized, which is just the shortest path improvement problem under Hamming distance.

The rest of this paper is organized as follows. A 0-1 integer programming model of the SPIUH problem on arborescent networks is constructed in Section 2. Some polynomial time algorithms are proposed for some special cases of the SPIUH problem on arborescent networks in Section 3. A heuristic algorithm and its computational experiment of the SPIUH problem on general graphs are given in Section 4. Conclusion and further research are given in Section 5.

For convenience, we denote by a path from to and by the length of under . In Sections 2 and 3, we use the following useful notations. For the unique path from to in , if and appears before in the path , then we denote it by .

#### 2. The SPIUH Problems on Arborescent Networks

In this section, we construct a 0-1 integer programming model for the SPIUH problem on arborescent networks (denoted by SPIUH-AN).

The SPIUH-AN problem can be reformulated by the definition of as follows:

We can check the feasibility of problem (3) based on the following lemma.

Lemma 2. *Problem (3) is feasible if and only if for each .*

*Proof**Sufficiency*. Suppose that for each . Denote by the union of given paths. Define a vector as follows:
It is easy to see that for each . Furthermore, for each , we have
and thus is a feasible solution of problem (3).*Necessity*. Suppose that is a feasible solution of problem (3). Note that is the unique path from to and ; then we have

Obviously, we have the following property on optimal solutions of (3).

Lemma 3. *If is an optimal solution of problem (3), then defined below is also an optimal solution of problem (3):
*

By Lemma 3, the constraints () in problem (3) are equivalent to that is,

For each edge , if we define a 0-1 variable as follows: and let , , then problem (3) is equivalent to solving the problem below:

As a conclusion, we have the following theorem.

Theorem 4. *The SPIUH-AN problem is equivalent to solving the 0-1 integer programming problem (11). An optimal solution of the SPIUH-AN problem can be given by (12), and the optimal objective value is , where is an optimal solution of problem (11):
*

#### 3. Some Special Cases of the SPIUH-AN Problem

In this section, we consider some special cases of SPIUH problem on arborescent networks. In Section 3.1, we design greedy algorithms for the SPIUH problems on chain networks and special star-tree networks. In Section 3.2, we present a strongly polynomial time algorithm for the SPIUH problem with a single source and a special constraint on paths.

##### 3.1. The SPIUH Problem on Special Star-Tree Networks

In this subsection, we first study the SPIUH problem on a chain network, where is a chain network and is the only source-terminal pair. We design a greedy algorithm for the SPIUH problem on a chain network. The main idea is to reduce the length of the edge with the current largest value to in each iteration.

*Algorithm 5 (a greedy algorithm). *Consider the following. *Input*: A chain with a source-terminal pair , two edge length vectors and a value . *Step 1*: If , then output that the instance is infeasible, stop. *Step 2*: Let . Rearrange the values of in a non-increasing order, that is, . *Step 3*: Let , and . *Step 4*: While do Put , and . *Step 5*: Output an optimal solution defined below:

It is easy to see that the main computation is to sort the values of , and hence the time complexity of Algorithm 5 is .

Next, we consider the SPIUH problem on a special star-tree network , where any two source-terminal paths of have no common edges. Such a problem is denoted by SPIUH-ST. See Figure 1 for example; there are three source-terminal paths , , and .

Obviously, the set of source-terminal paths is the union of edge-disjoint chains in the SPIUH-ST problem. Now we extend the greedy algorithm for SPIUH problem on a chain network to the SPIUH-ST problem.

*Algorithm 6. *Consider the following. *Input*: A star-tree network with a set of source-terminal pairs, two edge length vectors and a set of values. *Step 1*: Let and . Rearrange the values of in a non-increasing order, that is, . *Step 2*: For to do If , then output that the instance is infeasible, stop. Else run Steps 3, 4, 5 in Algorithm 5 to solve the problem on the chain network . Denote the optimal solution on by , and let .* **Step 3*: Output the optimal solution and the optimal objective value of the SPIUH-ST problem, where
Now we analyze the time complexity of Algorithm 6. Sorting the values of in Step 1 can be done in operations. In Step 2, there are iterations and there are operations in each iteration. Let . Then Algorithm 6 can be done in
operations. We sum up the above results in the following theorem.

Theorem 7. *The shortest path improvement problems on star-tree networks under unit Hamming distance can be solved by Algorithm 6 in time, where is the number of source-terminal pairs.*

*Remark 8. *There is a special case of the SPIUH-ST problem in which is a star-tree network with a central vertex such that there are no common edges on the paths from to all leaves of the tree, and the central vertex is the common source of all the source-terminal pairs; that is, for each . Hence, we only need to call Algorithm 5 in times to solve the problem, and its time complexity is also .

##### 3.2. The SPIUH Problem with a Single Source and Constrained Paths

In this subsection, we consider the SPIUH problem with a single source and a special constraint on paths, where for each , and the path satisfies the following constraint: where is the set of terminals of path which passes through . We call such a network an arborescent network with a single source and a special constraint on paths, which is denoted by SSCP. Such a problem is denoted by SPIUH-SSCP. The SPIUH problem with a single source and without the constraint condition (16) is denoted by SPIUH-SS.

For example, given is a network in Figure 2, where , , and for each . If , , and (see Figure 2(a)), then it is an instance of SPIUH-SSCP problem. However, if , , and (see Figure 2(b)), then we have and , but . Hence it is an instance of SPIUH-SS problem, but not an instance of SPIUH-SSCP problem. Next we give a polynomial time algorithm to solve the SPIUH-SSCP problem.

*Algorithm 9. *Consider the following. *Input:* An arborescent network with a single source and constrained paths from to , two edge length vectors and a set of values. *Step *1: Let and . *Step *2: For to do If , then output that the instance is infeasible, stop. Else let and let if and if . Call Algorithm 5 to solve the problem on the chain network with respect to the length vector and . In Step 2 of Algorithm 5, we let , then for all , rearrange the values in a non-increasing order, and if there are two values are equal (let's say and ), and appears before in the direct path from to , then will always appear before in the non-increasing order. (This sorting method is called *stable sorting method*).

Denote by the optimal solution to the problem on . Put . *Step *3: Output the optimal solution and optimal objective value of the SPIUH-SSCP problem, where

Lemma 10. *If the SPIUH-SSCP problem is feasible, then there is an optimal solution of the SPIUH-SSCP problem satisfying the following.*(1)*If there exists path , and , such that , , and , then we have .*(2)*If there exists path , , and such that , , and , then we have .*

*Proof. *Suppose is an optimal solution of the SPIUH-SSCP problem. By Lemma 3, defined below is also an optimal solution of the SPIUH-SSCP problem:
(1)If there exists a path , and , such that , , , and , because and reducing the weight of first is better, or at least not worse, than reducing that of , then we can get that is also an optimal solution of the SPIUH-SSCP problem, where
(2)If there exists a path , and , such that , , , and , because by (16) we know that and reducing the weight of first is better, or at least not worse, than reducing that of , then we can get that is also an optimal solution of the SPIUH-SSCP problem, where
Thus repeating the above operations, we can get an optimal solution of the SPIUH-SSCP problem that satisfies the property in Lemma 10.

Theorem 11. *If the SPIUH-SSCP problem is feasible, then Algorithm 9 outputs an optimal solution of the SPIUH-SSCP problem in time.*

*Proof. *If the SPIUH-SSCP problem is feasible, then it is not difficult to show that the solution obtained by Algorithm 6 is a feasible solution of the SPIUH-SSCP problem.

Next we show that obtained by Algorithm 9 satisfies properties (1) and (2) in Lemma 10. Note that we run Step 2 of Algorithm 5 for the path by using stable sorting method in the th iteration of for-loop in Algorithm 9 for any . When is added to in the th iteration of for-loop in Algorithm 9, we consider the following two cases.

(1) If there is an satisfying and , then by the greedy property of Algorithm 9 (i.e., if and , then is added to before is added to ), we have . Hence, for any (i.e., ), if , , then we have (i.e., ).

(2) If there is an such that , , then by the greedy property of Algorithm 9 (i.e., if , , then is added to before is added to ), we have . Hence, we have .

Hence, obtained by Algorithm 9 is a feasible solution of the SPIUH-SSCP problem that satisfies properties (1) and (2) in Lemma 10.

Suppose that is the optimal solution of the SPIUH-SSCP problem which satisfies the property (1) and (2) in Lemma 10. Now we show that for each , if and , then . Suppose (i.e., ); we consider the following three cases.*Case 1*. If there exist a path and an edge such that , , and , then because the optimal solution of the SPIUH-SSCP problem satisfies property (1) in Lemma 10, we can get that .*Case 2*. If there exist a path and an edge such that , , and , then because the optimal solution of the SPIUH-SSCP problem satisfies property (2) in Lemma 10, we can get that .*Case 3*. If for each and for each such that (1) , or (2) , , we have . Note that (i.e., ); suppose is added to in the th iteration of for-loop in Algorithm 9; let , , , where ; then (otherwise, ). Note that we have the assumption that for each , if ; then
This contradicts that is an optimal solution of the SPIUH-SSCP problem, so .

Hence, for each , if and , then . That is, the objective value of is not greater than the objective value of . Note that is an optimal solution of the SPIUH-SSCP problem, so is an optimal solution of the SPIUH-SSCP problem.

The time complexity analysis is similar to that of Theorem 7.

*Example 12. *As shown in Figure 2(a), let , , and . The optimal solution of the SPIUH-SSCP problem generated by Algorithm 9 is , and the optimal objective value is 2.

*Remark 13. *Note that Algorithm 9 cannot always obtain an optimal solution of the SPIUH-SS problem. For example, as shown in Figure 2(b), let , , and . In this case, it is an instance of SPIUH-SS problem, but not an instance of SPIUH-SSCP problem. The solution generated by Algorithm 9 is , whose objective value is 3. But the optimal solution is , and the optimal objective value is 2.

So it is meaningful to design efficient algorithms for the SPIUH-SS problem. We guess that the SPIUH-SS problem has strongly polynomial time algorithms.

#### 4. A Heuristic Algorithm for the General SPIUH Problem

In this section, we design a heuristic algorithm to solve the general SPIUH problem (1) and give computational experiments to test effectiveness of the algorithm.

Lemma 14 (see [8]). *The SPIUH problem is strongly NP-hard even if for each edge of the network. *

Similar to Lemma 2, we can use the next lemma to check the feasibility of SPIUH problem.

Lemma 15. *The SPIUH problem (1) is feasible if and only if , for each . *

We design a heuristic algorithm to solve the SPIUH problem. The main idea is as follows.

Suppose the SPIUH problem is feasible. Initialize . Define . First compute a shortest path from to under for each . Let and . Then find a specific edge , and update and . Next we check if the SPIUH problem is feasible or not under the current weight . If not, modify to the original value . Repeat the above process until . Note that there is an edge deleted from in each iteration and the cardinality of the original set is at most , and hence the algorithm can be done in iterations.

*Algorithm 16. *Consider the following. *Input:* A network with a set of source-terminal pairs, two edge length vectors and a set of values. *Step 1*: For each , compute and . If there exists a shortest path from to under such that , then output that the SPIUH problem has no feasible solution, stop. Otherwise, let and . For each , compute a shortest path from to under . *Step 2*: Let . For each edge , let . Let . *Step 3*: While , do Find the edge such that , and let and . Compute a shortest path from to under in the set of paths. Call the new path as , if , then (and ignore ); otherwise, let (i.e., delete the previous ), and for each edge . *Step 4*: Let , output an approximation solution and its objective value of the SPIUH problem, where
Now we analyze the time complexity of Algorithm 16. For each , there are operations to compute a shortest path ; and hence there are operations in Step 1, where . Step 2 requires operations. Step 3 requires operations. Furthermore, there are at most iterations in Algorithm 16. Hence Algorithm 16 runs in operations in the worst case, and it is a strongly polynomial time heuristic algorithm.

Next we first give an example to explain detailed computation process of the heuristic Algorithm 16, and then we present its computational experiments.

Given is a network shown in Figure 3, where , . Let , , the set of source-terminal pairs of vertices is , and .

When calling Algorithm 16 for the instance given by Figure 3, we obtain an approximation solution , and its objective value is , where

See Table 1 for the details of iterations in running Algorithm 16.

Note that when Algorithm 16 is applied to solve the SPIUH-SSCP problem, similar to the proof of Theorem 11, it is not difficult to show that Algorithm 16 can obtain an optimal solution of the SPIUH-SSCP problem.

The heuristic Algorithm 16 is coded in Matlab 7.0 and run on a PC Pentium D, 2.8 GHz, under Windows XP. We have tested the heuristic algorithm on ten classes of network configurations which differ from the number of nodes, varying from 30 to 100, and the number of source-terminal pairs, being 5 or 15. There are 50 or 100 random instances generated for each class of network configuration. In all instances of the configurations, the length range of is 0–37 for each edge , and the length range of lower bound is 0–15. In order to avoid solving a big number of nonfeasible instances, we assume that is between and for each source-terminal pair .

Computational results are shown in Table 2. It displays the average approximation objective values and the average CPU-time in seconds of Algorithm 16 and implicit enumeration algorithm by using 50 or 100 instances in each class of network configuration. Table 2 shows that the average running time of Algorithm 16 is far less than that of implicit enumeration algorithm, and if and optimal objective value is greater than 5, then the running time of implicit enumeration algorithm is unbearable.

#### 5. Conclusion and Further Research

The shortest path improvement problems under unit Hamming distance are studied. Firstly, the problem on arborescent networks is formulated as a 0-1 integer programming model. Secondly, two greedy algorithms are proposed for problems on chain networks and special star-tree networks. Thirdly, a strongly polynomial time algorithm is designed for the problem on arborescent networks with a single source and a special constraint on paths. Finally, a heuristic algorithm and corresponding computational experiments are presented for the SPIUH problem on general graphs.

For further research, it is meaningful to design exact algorithms or approximate algorithms for the shortest path improvement problems on arborescent networks with a single source under unit Hamming distance and to propose approximate or heuristic algorithms for the shortest path improvement problems under general Hamming distance.

#### Acknowledgments

The authors would like to thank the anonymous referees for their valuable comments and suggestions. This research is supported by NSFC (10801031), the project sponsored by SRF for ROCS, SEM (BZX/11H002) and Chinese Universities Scientific Fund (2012B14114, 2013B10014).

#### References

- D. Burton and Ph. L. Toint, “On an instance of the inverse shortest paths problem,”
*Mathematical Programming*, vol. 53, no. 1, pp. 45–61, 1992. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - J. Z. Zhang, Z. F. Ma, and C. Yang, “A column generation method for inverse shortest path problems,”
*Zeitschrift für Operations Research. Mathematical Methods of Operations Research*, vol. 41, no. 3, pp. 347–358, 1995. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - J. Z. Zhang and Y. X. Lin, “Computation of the reverse shortest-path problem,”
*Journal of Global Optimization*, vol. 25, no. 3, pp. 243–261, 2003. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - X. C. Guan and J. Z. Zhang, “A class of node based bottleneck improvement problems,”
*European Journal of Operational Research*, vol. 174, no. 3, pp. 1540–1552, 2006. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - X. C. Guan and J. Z. Zhang, “Improving multicut in directed trees by upgrading nodes,”
*European Journal of Operational Research*, vol. 183, no. 3, pp. 971–980, 2007. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - C. Heuberger, “Inverse combinatorial optimization: a survey on problems, methods, and results,”
*Journal of Combinatorial Optimization*, vol. 8, no. 3, pp. 329–361, 2004. View at Publisher · View at Google Scholar · View at MathSciNet - Y. He, B. W. Zhang, and E. Y. Yao, “Weighted inverse minimum spanning tree problems under Hamming distance,”
*Journal of Combinatorial Optimization*, vol. 9, no. 1, pp. 91–100, 2005. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - B. W. Zhang, J. Z. Zhang, and L. Q. Qi, “The shortest path improvement problems under Hamming distance,”
*Journal of Combinatorial Optimization*, vol. 12, no. 4, pp. 351–361, 2006. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - B. W. Zhang, J. Z. Zhang, and Y. He, “The center location improvement problem under the Hamming distance,”
*Journal of Combinatorial Optimization*, vol. 9, no. 2, pp. 187–198, 2005. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - B. W. Zhang, J. Z. Zhang, and Y. He, “Constrained inverse minimum spanning tree problems under the bottleneck-type Hamming distance,”
*Journal of Global Optimization*, vol. 34, no. 3, pp. 467–474, 2006. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - C. W. Duin and A. Volgenant, “Some inverse optimization problems under the Hamming distance,”
*European Journal of Operational Research*, vol. 170, no. 3, pp. 887–899, 2006. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - X. C. Guan and J. Z. Zhang, “Inverse bottleneck optimization problems on networks,” in
*Algorithmic Aspects in Information and Management*, vol. 4041 of*Lecture Notes in Computer Science*, pp. 220–230, 2006. View at Publisher · View at Google Scholar - L. C. Liu and E. Y. Yao, “Inverse min-max spanning tree problem under the weighted sum-type Hamming distance,”
*Theoretical Computer Science*, vol. 396, no. 1–3, pp. 28–34, 2008. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet - Y. W. Jiang, L. C. Liu, B. Wu, and E. Y. Yao, “Inverse minimum cost flow problems under the weighted Hamming distance,”
*European Journal of Operational Research*, vol. 207, no. 1, pp. 50–54, 2010. View at Publisher · View at Google Scholar · View at Zentralblatt MATH · View at MathSciNet