Inverse Generalized Maximum Flow Problems

: A natural extension of maximum ﬂow problems is called the generalized maximum ﬂow problem taking into account the gain and loss factors for arcs. This paper investigates an inverse problem corresponding to this problem. It is to increase arc capacities as less cost as possible in a way that a prescribed ﬂow becomes a maximum ﬂow with respect to the modiﬁed capacities. The problem is referred to as the generalized maximum ﬂow problem (IGMF). At ﬁrst, we present a fast method that determines whether the problem is feasible or not. Then, we develop an algorithm to solve the problem under the max-type distances in O ( mn · log n ) time. Furthermore, we prove that the problem is strongly NP-hard under sum-type distances and propose a heuristic algorithm to ﬁnd a near-optimum solution to these NP-hard problems. The computational experiments show the accuracy and the efﬁciency of the algorithm.


Introduction
In a capacitated network, the conventional maximum flow problem is to look for maximum flow which can be sent from a source to a sink under arc capacity constraints. The flow is conserved on arcs and the flow that enters any node (except the source and the sink) equals the flow leaving it.
In the generalized network flow problem, we have a gain factor γ(i, j) for every arc. This gain factor represents the amount of flow that arrives at node j if we would send one unit of flow from the node i along arc (i, j). More specifically, if we send f (i, j) units from i to j, then γ(i, j) f (i, j) units arrive at node j. These gains or losses can refer to evaporation, energy dissipation, breeding, theft, interest rates, blending, or currency exchange. The generalized maximum flow problem can be formulated as a linear programming problem [1]. The augmenting path algorithm and its variants are first algorithms to be proposed for solving the problem [2,3]. A close relationship between this problem and the minimum cost flow problem [4] is stated in Truemper [5]. This fact clarifies that many algorithms of generalized maximum flow problems are similar to those of minimum cost flow problems. Tardos and Wayne [6] developed the first efficient primal algorithm for solving the problem and extend the algorithm for generalized minimum cost flow problem. However, a strongly polynomial-time algorithm that is not based on general linear programming techniques is given for the generalized flow maximization problem in [7], which using a new variant of the scaling technique. Then, another strongly polynomial-time algorithm is developed in [8]. It is faster and simpler than the preceding ones. It works almost exclusively with integral flows, in contrast to all previous algorithms.
For any optimization problem, one can define a corresponding inverse problem. It is how to modify some parameters, such as costs or capacities, in a way that a prescribed solution of the optimization problem becomes optimal with respect to the new parameters. The objective function of inverse problems is to minimize the distance between the initial and new parameters. The changes can be calculated by Hamming distances or l p norms. Due to wide range of applications, many researchers have focused on inverse optimization problems in recent years [9][10][11][12][13][14][15][16][17][18][19]. Let us review some papers concerning the inverse maximum flow problem. Yang et al. [20] presented strongly polynomial-time algorithms to solve the inverse maximum flow problem under l 1 norm. In [21][22][23], efficient algorithms are proposed to solve the inverse maximum flow problem with lower and upper bounds, considering the norms l 1 and l ∞ . Inverse maximum flow problems under the bottleneck-type (H ∞ ) and sum-type (H 1 ) Hamming distances are also investigated in [24]. Strongly polynomial algorithms are proposed for these problems. The general result is that the inverse maximum flow problem under l 1 , l 2 , H 1 and H ∞ can be solved in strongly polynomial time.
The reverse problems are another kind of inverse optimization problem. In the reverse maximum flow problem, the goal is to change arc capacities minimally so that the maximum flow value becomes at least a prescribed value v 0 . The problem is studied in [25] under weighted l ∞ norm. The authors presented an efficient algorithm based on the discrete-type Newton method to solve the problem.
In this paper, we study the inverse generalized maximum flow problem (denoted IGMF). First we start with an apriori test with a good complexity of O(mn) which decides whether the problem is feasible or not. Then, we develop an efficient algorithm to solve the problem under the max-type distances l ∞ and H ∞ . By a reduction of the vertex cover problem, we prove that the problem under the sum-type distances l 1 and H 1 is strongly NP-hard. This result is interesting because the (ordinary) inverse maximum flow problems under the sum-type distances are solved in strongly polynomial time [23,24]. Finally, we present a heuristic algorithm to find pseudo-optimal solutions to the problem.
We recall the definitions of weighted l 1 and weighted l ∞ norms for the n-dimensional vector x: where w i ≥ 0 is the per unit cost attached to the i-th component. A natural use of the norms is that they can be applied to measure the distance between two vectors x and y as l k (x − y), k = 1, ∞. For this reason, the word "distance" is also used instead of "norm" for these functions. The definitions of the sum-type and bottleneck-type Hamming distances for two n-dimensional vectors x and y are given as follows: where w i ≥ 0 is the cost of modification associated with the i-th component. The function H measures the Hamming distance between the real values x i and y i which is defined as follows: The rest of the paper is organized as follows: In Section 2, we focus on the generalized maximum flow problem and state its optimality conditions. In Section 3, we introduce the inverse generalized maximum flow problem and we study its feasibility. In Section 4, we present our proposed algorithm to solve the IGMF for the max-type distances. In Section 5, study IGMF under the sum-type distances l 1 and H 1 . We prove that these problems are strongly NP-hard. In Section 6, we present a heuristic algorithm for these problems. In Section 7, we perform several computational experiments to consider the accuracy and efficiency of the heuristic algorithm. Finally, some concluding remarks are given in Section 8.

The Generalized Maximum Flow
We denote by G = (N, A, s, t, u, γ) a generalized network, where N is a set of n-nodes, A is a set of m directed arcs, s and t are special nodes called the source and the sink, respectively. u : A → R ≥0 is the capacity function and γ : A → R ≥0 is the gain function.
The gain of a path P is denoted by γ(P) = ∏ a∈P γ(a). In the same manner, we define the gain of a cycle. A flow-generating cycle is a cycle C whose gain is more than one, i.e., γ(C) > 1.
We assume that G has no parallel arcs. Without loss of generality we also assume that the network is symmetric, which means that for each arc (i, j) ∈ A there is an arc (j, i) ∈ A possibly with zero capacity. The gain function is antisymmetric, i.e., γ(j, i) = 1 γ(i,j) . A function f : A → R that satisfies the capacity constraints f (i, j) ≤ u(i, j) for every (i, j) ∈ A and the antisymmetry constraints f (i, j) = −γ(j, i) f (j, i) for every (i, j) ∈ A is called a generalized pseudoflow. The residual excess of a node i, except s, is e f (i) = − ∑ (i,j)∈A f (i, j) (the negative of the flow that leaves node i). If e f (i) is positive (negative), we say that f has residual excess (deficit) at node i. A pseudoflow f is a flow if it has no residual deficits and residual excesses, except in s and t.
For a flow f , we denote its value v( f ) = e f (t) to be the residual excess at the sink.
For a generalized flow f in G = (N, A, s, t, u, γ) we can define the residual capacity function The residual network is The generalized maximum flow problems in the initial network and the residual network are equivalent together. A path in the residual network from an excess node to the sink is called an augmenting path. A flow-generating cycle together with one path from some nodes of this cycle to the sink is referred to as a generalized augmenting path (GAP). One can increase the flow into the sink by sending flow along GAPs and augmenting paths. We shall take an example now. Example 1. In Figure 1a we have a network flow in a generalized network with the source node 1 and the sink node 4. We suppose that e(1) = 8, e(2) = e(3) = e(4) = 0. It is easy to see that f satisfies the capacity constraints and the antisymmetry constraints, so, it is a pseudoflow. Let us calculate the residual excesses: e f (2) = 0 − (−7 + 3 + 4) = 0, e f (3) = 0 − (5 − 9 + 4) = 0 and e f (4) = 0 − (−1 − 4) = 5. It is clear now that the pseudoflow f have not any residual deficits (excesses) and, so, it is a flow in the generalized network from Figure 1a. Obviously, v( f ) = e f (4) = 5. The corresponding residual network is presented in Figure 1b. In this network, we have a flow-generating cycle: 1 − 2 − 3 − 1 whose gain factor is equal to 1/2 × 3 × 2 = 3 > 1. The following theorem gives us the optimality conditions for the problem (see [3]): Theorem 1. A flow f is optimal in a generalized network G if and only if there is no augmenting path and no GAP in G f .
Assume that each arc (i, j) ∈ A f is associated with a cost of c(i, j) = − log γ(i, j). To find a GAP in the residual network G f , we first apply the BFS algorithm to identify the part of the network with nodes which have paths to t. Then, we look after a negative cost cycle C with respect to the arc costs c(i, j) in this part of the network. Notice since it is guaranteed that C ∪ P is a GAP where P is a path found by the BFS algorithm from some nodes of C to t. The complexity of this process is O(mn) because the complexity of the BFS algorithm is O(m) and we can use the shortest path algorithm due to Bellman-Ford to find a negative cost in O(mn) [1].
Since the computation of logarithms is time-consuming and inexact in computers, it is not customary to calculate logarithms. However, one can work directly with the gain factors (multiplying gain factors of arcs instead of adding costs of arcs). This yields a modified version of Bellman-Ford algorithm which finds a flow-generating cycle in O(mn) time.
Using the fact that the generalized maximum flow problem is a linear programming, the optimality conditions of linear programming problems can be also used to check the optimality of a flow. For this purpose, suppose that a real number π(i) is associated with each node i. Indeed, π(i), called the potential of node i, is the dual variable corresponding to the ith balanced constraint. By noting the dual of the problem, it is easy to see that π(s) = 0 and π(t) = −1. The potential difference of an arc The following theorem gives the optimality conditions of a feasible flow to the generalized maximum flow problem.

Theorem 2.
A flow f is optimal to the generalized maximum flow problem if and only if there are node potentials π such that Proof. See Theorem 15.5 in [1].

Inverse Generalized Maximum Flow Problem
Let G = (N, A, s, t, u, γ) be a generalized network. Let f be a feasible flow in the network G.
It means that f must satisfy the capacity restrictions, the antisymmetry constraints and it must have no residual deficits and residual excesses (except in s and t).
The inverse generalized maximum flow problem is to change the capacity vector u so that the given feasible flow f becomes a maximum flow in G and the distance between the initial vector of capacities u and the modified vector of capacities, denoted byū, is minimized: where α(i, j) and δ(i, j) are the given non-negative numbers to determine bounds on the modifications and δ(i, j) ≤ u(i, j), for each arc (i, j) ∈ A (see notations of [19]). These values show how much the capacities of the arcs can vary.
It is easy to see that to transform the flow f into a maximum flow in the networkḠ, it is useless to increase the capacities of the arcs. Therefore, the conditionsū(i, j) ≤ u(i, j) + α(i, j), for each arc (i, j) ∈ A have no effect and, instead of (8), we consider the following mathematical model: When solving IGMF, if the capacity is changed on arc (i, j), then it is decreased exactly with the amount of u(i, j) − f (i, j) units. If not so, the flow is not stopped from being increased on an augmenting path from s to t or in a GAP that contains the arc (i, j) and the modification of the capacity of (i, j) is useless. This implies that when solving IGMF, it is no need to change the capacities of the arcs from the following set: The The above argument together with Theorem 2 suggest a zero-one formulation for IGMF: in which the zero-one variable y(i, j) is defined as y(i, j) = 1 if and only ifū(i, j) = f (i, j). A simple statement of the formulation (11) is that some arcs belonging to F\ A have to be transported to U by settingū(i, j) = f (i, j). Consequently, their corresponding constraint, namely c π (i, j) = 0, is relaxed to c π (i, j) ≤ 0 (see the constraints (11c) and (11e)). Furthermore, settingū(i, j) = 0, (i, j) ∈ L\ A, removes (i, j) from the network, so the constraint c π (i, j) ≥ 0 is also relaxed (see the constraint (11g)). The formulation (11) is a zero-one linear programming under all the norms l k and the Hamming distances H 1 and H ∞ . So, one can use the zero-one programming technique to solve the problem.
To verify the feasibility of IGMF we construct the network G = (N, A, γ) in which A is defined in (10). Proof. If IGMF is a feasible problem, then it means that there is a vectorū with u(i, j) − δ(i, j) ≤ u(i, j), f (i, j) ≤ū(i, j), ∀(i, j) ∈ A and for which the flow f is a maximum flow in the network G = (N, A, s, t,ū, γ). Since A ⊆Ā f , if there exists a directed s-t path in G, it corresponds to a directed path inḠ f , which leads to an augmentation to the flow f in G (contradiction). If there is a GAP in G, then it is a GAP in G f (contradiction). Now, for the inverse implication we construct the following capacity vector: It is easy to see that In the residual network G f = (N, A f , r ) corresponding to G = (N, A, t, u , γ) with respect to the flow f , we have r (i, j) = 0, for every (i, j) ∈ (N × N)\ A. Hence, A = A f . Since there is no directed path from s to t and no GAP in G, it follows that there is no directed path from s to t and no GAP in G f . So f is a maximum flow in G (N, A, t, u , γ). Consequently, u is a feasible solution for IGMF.

Algorithms for Solving IGMF under Max-Type Distances
Now we study IGMF under max-type distances (denoted IGMFM). This means that in the problem (9) dist is defined as follows: where D : R ≥0 × R ≥0 → R ≥0 . It is easy to see that the bottleneck-type Hamming distance defined in (4) is a particular case of (12) because where w(i, j) ≥ 0 is the cost of modification of the capacity on the arc (i, j). IGMF under weighted l ∞ norm (denoted IGMF ∞ ) can be also treated as a particular case of IGMFM. For IGMF ∞ , we define where w(i, j) ≥ 0 is per unit cost of modification of the capacity on the arc (i, j) ∈ A.
Suppose that IGMFM is feasible. The algorithm for IGMFM begins with a set H = A f \ A. So, the elimination of all arcs from H transforms the flow f into a maximum flow in the resulting network. So, we have to find a subset J of H so that if the arcs of J are eliminated then f becomes a maximum flow in the resulting network and the modified capacity vector is optimum for IGMFM. To do this, arcs (i, j) of H are sorted in nondecreasing order by their value D(u(i, j),ū(i, j)). Arcs are eliminated sequentially from H (from arc with the lowest value to the highest) until the arcs of A ∪ H form a graph in which there is no directed path from s to t and there are no GAPs. The arcs that leave the set H are the arcs where the capacities are modified to the value f (i, j). Based on Theorem 1, the flow f is a maximum flow in the resulting network. Let us write the algorithm, formally.
Theorem 4 (the correctness). The vector u * found by Algorithm 1 is the optimal solution of IGMFM.
Proof. Assume that u is an optimal solution of IGMF with the optimal value z * = max (i,j)∈A D(u(i, j), u (i, j)). By contradiction, we suppose that max (i,j)∈A D(u(i, j), u * (i, j)) > z * .
We construct the capacity vector u as follows: It is easy to see that u is also optimal solution for IGMF. On the other hand, due to (13), u is constructed and tested before constructing u * . This test failed because the algorithm does not terminate in that iteration. Therefore, u is not optimal solution for IGMF which is a contradiction.

If The problem is not feasible (there is an s-t directed path or a GAP in G)
Stop.

End If
Set u * = u and H = A f \ A. Sort arcs of H in nondecreasing order with respect to u(i, j). While f is not a maximum flow in G * = (N, A, s, t, u * , γ) Let (i, j) the first arc from H. H = H\{(i, j)}. u * (i, j) = f (i, j).

End While
We can improve the running time of the IGMFM algorithm by using a "Divide and Conquer" approach. We test the optimality of f after we removed the arcs from the first half of H. We have two situations: The "Divide and Conquer" technique continues until no division can be done any more. The "Divide and Conquer" version of Algorithm 1 is as Algorithm 2.
Since the algorithm deals with the same idea as Algorithm 1, its correctness is obvious. Then, we discuss only about its complexity. Theorem 6. The time complexity of the improved IGMFM algorithm is O(mn · log(n)).
Proof. The feasibility test can be performed in O(mn) time. The vector H can be sorted in O(m · log(n)). Instead of O(m) iterations, the "Divide and Conquer" version has O(log(m)) = O(log(n)) iterations. Therefore, the time complexity of "Divide and Conquer" algorithm is O(mn · log(n)), since each iteration takes at most O(mn) time.

Algorithm 2:
The "Divide and Conquer" version of Algorithm 1 Input: The generalized network G (N, A, s, t, u, γ) and flow f . Output: u * is the optimal solution of the IGMFM problem.
Construct the residual network G f = (N, A f , s, t, g, γ, e f ). Set u(i, j) = D(u(i, j), f (i, j)), ∀(i, j) ∈ A f . Construct the network G = (N, A, u, γ). If The problem is not feasible (there is an s-t directed path or a GAP in G) Stop.

End If
Set u * = u and H = A f \ A. Sort the arcs (i, j) of H in nondecreasing order with respect to u(i, j): let H = (a 1 , a 2 , . . . , a n ) is the sorted list. Set L = 1 and R = n.

IGMF under Sum-Type Distance
In this section, we consider IGMF under the sum-type distances l 1 and H 1 . We prove that IGMF under these distances is strongly NP-hard. The proof is based on a reduction from the node cover problem. Let us first recall this problem.

The node cover problem:
Instance, an undirected networkḠ(N,Ā) and a given number k. Question, is there a set S ⊆N so that |S| ≤ k and S is a node cover ofḠ, i.e., either i ∈ S or j ∈ S for every (i, j) ∈Ā? Theorem 7. The inverse generalized maximum flow problem under the l 1 norm is strongly NP-hard.
Proof. Suppose that an instance of the node cover problem defined on an undirected graphḠ(N,Ā) is given, whereN = {1, 2, . . . , n} is the node set andĀ is the arc set. We introduce a bipartite directed network G (N, A, u, γ) as follows: • The network contains two nodes i and i , for each i ∈N. Additionally, we add three nodes s, s , t to the network. Using the notationN = {1 , 2 , . . . , n }, we have N =N ∪N ∪ {s, s , t}. • For each undirected arc (i, j) ∈Ā, we add two directed arcs (j , i) and (i , j) to G. We also add (s , i) for i ∈N and (i , t) for i ∈N . We call all these arcs the natural arcs. Then the set of natural arcs is: We associate with each i ∈N ∪ {s}, one arc (i, i ) ∈ A. Such arcs are referred to as the artificial arcs, denoted by A 2 . Thus, A = A 1 ∪ A 2 . Please note that the underlying undirected graph of G is bipartite.

•
The gain of each natural arc is equal to 1 while the gain of each artificial arcs is 2.
• The capacity of each natural arc is equal to +∞. The capacity of each artificial arc is 1. Figure 2 shows an example of how to construct G from G . Let f = 0 be the initial flow. Since the data are polynomially bounded with respect to the problem size, i.e., the similarity assumption is satisfied, we prove the following claim to establish the desired result. Proof. Proof of Claim 1. Suppose that S is a solution to a given yes instance of the node cover problem. We introduce the solutionū as follows: It is easy to see that the objective value ofū is less than or equal to k + 1 2 . Thus, it is sufficient to prove that the residual network with respect to the flow f = 0 and the capacity vectorū contains no st-path and no GAP. Because (s, s ) is not in the residual network, we imply that any st-path does not exists in the residual network. Since all gain factors are greater than or equal to 1 and any cycle contains at least an arc (i, i ) with γ(i, i ) = 2, it follows that any cycle in the residual network is a part of a GAP. Then, we must prove that the residual network contains no cycle. Any cycle has at least two arcs fromN toN and at least two arcs fromN toN. Then it contains a path i − i − j − j − k. Due to this and that (i, j) ∈Ā, we imply that i ∈ S or j ∈ S. Equivalently,ū(i, i ) = 0 orū(j, j ) = 0. Therefore, the residual network does not contain at least one of two the arcs (i, i ) and (j, j ). Then, any cycle cannot exist in the residual network. Now suppose thatū is a feasible solution to the inverse generalized maximum flow problem with the objective value k < +∞. The assumption k < +∞ guarantees thatū(i, j) = u(i, j) for each arc (i, j) which has infinity capacity. Hence, only the capacity of artificial arcs can be modified. Consider S = {i ∈N : u(i, i ) = 0}. We prove that S is a cover ofḠ with |S| ≤ k − 1. Any st-path in G is Since the residual network contains no st-path, two cases may occur: 1. (s, s ) is not in the residual network. 2. Each arc (i, i ) , i ∈N, is not in the residual network.
The first case imposes a cost of 1 on the objective while the second imposes a cost of n > 1. Then, due to the optimality ofū, the first case occurred, namelyū(s, s ) = 0. On the other hand, we know that the residual network contains no cycle (GAP). Then, u(i, i ) = 0 or u(j, j ) = 0 for each cycle i − i − j − j − i. This implies that i ∈ S or j ∈ S for each (i, j) ∈Ā. Then, S is a cover ofḠ with |S| = |{(i, i ) : u(i, i ) = 0}\{(s, s )}| ≤ k − 1. This completes the proof.
A completely similar proof proves that IGMF under H 1 is NP-hard. In the proof. it is sufficient to define the capacity of all arcs equal to 1 and the weight vector w as Thus, we have the following result.
Theorem 8. The inverse generalized maximum flow problem under the sum-type Hamming distance is strongly NP-hard.

A Heuristic Algorithm
In this section, we present a heuristic algorithm to obtain pseudo-optimal solutions of IGMF under the sum-type distances.
To remove a GAP C, we must remove an arc (i, j) ∈ C by settingū(i, j) = f (i, j). We use the five following observations to design our algorithm.
1. An arc (i, j) ∈Ã cannot be removed from the residual network because settingū(i, j) = f (i, j) violates the bound constraint. 2. A necessary condition for removing arc (i, j) ∈ A f \Ã is that it belongs to at least one GAP.
3. An arc (i, j) belonging to several GAPs has a high priority to be removed because several GAPs are annihilated whenever we remove such an arc. 4. Removing of an arc (i, j) imposes the cost of u(i, j) − f (i, j) (w(i, j) ) to the objective function under l 1 (H 1 ). 5. If an arc (i, j) ∈ A f \Ã is on a GAP C so that the other arcs of C belong toÃ, then the arc (i, j) has the greatest priority to be removed because we can eliminate C only by removing (i, j).
We now introduce a preference index p(i, j), (i, j) ∈ A, to determine which one of arcs has high priority to be removed. Based on Observations 3 and 4, an arc is eligible to be removed if

•
it is on a greater number of GAPs, and • it imposes a smaller value of the cost on the objective function.
So, we define for every (i, j) ∈ A in which v(i, j) is a value to underestimate how many GAPs pass through (i, j).
To compute v(i, j)'s, we use a successive negative-cycle subroutine. The subroutine initializes v(i, j) = 0 for each (i, j) ∈ A. In each iteration, it detects a GAP by using the Reverse Bellman-Ford (RBF) algorithm which has the same process of the standard Bellman-Ford algorithm with this difference which it starts from t and traverses arcs in the opposite direction. The RBF algorithm detects a negative-cycle C with respect to the arc lengths c(i, j) = − log γ(i, j) in residual network. The output of the RBF algorithm is a negative-cycle C together with a path P from some nodes of C to t. Since any negative cycle with respect to c(i, j) is also a generating flow cycle (see (7)), it follows that C = C ∪ {P} is a GAP. After detecting a GAP C by the RBF algorithm, the subroutine determines its capacity, i.e., g C = min (i,j)∈C {g(i, j)}. Then, it updates g(i, j) = g(i, j) − g C and v(i, j) = v(i, j) + 1 for each (i, j) ∈ C and it removes arcs with g(i, j) = 0. The process is repeated until any negative cycle is not detected by the RBF algorithm. It is notable that if a GAP C contains no arc of A f \Ã, then the problem is infeasible (see Theorem 3). To handle this situation, another output In f is defined for the subroutine which is a Boolean variable and takes the value of True if the subroutine detects this situation. According to Observation 5, another specific situation may occur in which all arcs of the successive negative-cycle GAP belong toÃ, except one arc (i 0 , j 0 ). In this situation, the subroutine sets v(i 0 , j 0 ) = M which is a very big number. Algorithm 3 states the process of the subroutine, formally. Notice that if v(i, j) = 0, then there is not any GAP passing through (i, j) (Observation 1). Therefore, the arc (i, j) has the lowest priority to be removed. The main algorithm in each iteration calls the subroutine for computing v(i, j). Then, it calculates the priority index p(i, j) for each arc (i, j) ∈ A. Finally, it chooses one arc of A with the maximum priority index p(i, j) and remove it from the residual network by settingū(i, j) = f (i, j). This process is repeated until the residual network contains no GAP. Our proposed algorithm is given in Algorithm 4.

Algorithm 3:
The successive negative-cycle algorithm Input: The network G (N, A f , t, g, c), the arc setÃ. Output: The priority degrees v as well as the Boolean variable In f which is True if the algorithm detects the infeasibility.
Apply the Reverse Bellman-Ford algorithm starting t to find a negative-cycle C with respect to the arc lengths c.
If There is no negative cycle Break.

End If
%M is a very big integer Break.
%(i 0 , j 0 ) is the only arc that can cancel C End If End While Remark 1. If we define the priority index as follows: then Algorithm 4 is a heuristic algorithm to obtain a pseudo-optimal solution to the problem under H 1 .  N, A, s, t, u, γ) and flow f . Output: The modified capacity vectorū.

End If End For While True
Apply Algorithm 3. Suppose that the output is (v, In f ).

End If End If End For
If p Max = 0 Break.

Computational Experiments
In this section, we have conducted a computational study to observe the performance of Algorithm 4. To study its accuracy, we compared the results obtained by Algorithm 4 with the exact optimal solution which is computed by solving the model (11).
The following computational tools were used to develop Algorithm 4 and to solve model (11): Python 2.7.5, Matplotlib 1.3.1, Pulp 1.6.0, and NetworkX 1.8.1. All computational experiments were conducted on a 64-bit Windows 10 with Processor Intel(R) Core(TM) i5 − 3210M CPU @2.50GHz and 4 GB of RAM.
In experiments, we have applied random binomial graphs introduced in [27]. These graphs are determined by two parameters n, the number of nodes, and p ∈ [0, 1] which is the probability of existing any edge in the graph. In experiments, we have first generated an undirected graph G(V, A) and then have converted it into a directed one by directing any edge (i, j) from i to j if i < j. In all experiments, we have assumed that nodes s = 0 and t = n − 1 are respectively the source and the sink.    Error chart: X-axis is the intervals containing the optimal value z * and Y-axis is z−z * z .

Conclusions
In this paper, we have studied two classes of inverse problems: IGMF under max-type distances and under sum-type distances. We have provided a fast initial test of feasibility of IGMF. For the first class we presented polynomial algorithms to solve IGMF in O(m 2 n) running time and even in O(mn · log(n))) time. We proved that the second class of problems are NP-hard and we presented a heuristic algorithm to solve this kind of problems.
As future works, it will be meaningful that other types of inverse generalized maximum flow problem are investigated. Specifically, one may consider a type of the inverse problem for which gain factors are modified, instead of capacities. This problem can be used to simulate a wide range of real-world applications because gain factor modifications are performed by network restorations.