Вы находитесь на странице: 1из 11

OPTIMIZATION

3A GI

Chapter 3

Network Flow problems

3.1 Introduction
Network flow problems concern the circulation of material on/through the arcs of a given network. Historically, these problems have been studied to represent electrical current circulating on a network of dipoles. Nowadays, there exist a large number of real situations that can be modeled using the concept of network flow: Transportation of merchandise from different distribution sites to different customers through urbain, railway, marine, airway networks, or in some cases a mix of ransportation modes, flow of liquids inside pipelines, flow of information through communication networks, Inventory management, scheduling,

3.2 Definitions
Given a network G = (N,A), we associate with each arc u of A a positive integer number cu called capacity of arc u. The set N contains two special nodes: One node having a zero indegree, called the source S of G, One node having a zero outdegree, called the sink T of G. All other nodes are called transit nodes. One property of such networks is their ability to transport flow on the arcs. A flow vector is defined as = [1, 2, , m]T m with m components such that 0 u cu , u = 1, , m

The flow (vector) is feasible, if it satisfies the following flow conservation equations: u(i) u - u-1(i) u = 0 iX

where (i) : the set of arcs incident out of i, 20

OPTIMIZATION

3A GI

-1(i): the set of arcs incident into, The arc capacity may be interpreted as the maximal flow that can circulate through the arc.

3.3 The maximum value flow problem


3.3.1 Problem definition Consider a network G = (N, A, C). Let S and T be the source and the sink of G, respectively. In order for S and T to verify the flow conservation constraint, one may construct a network G0 by adding to A and arc (T, S) having an infinite capacity, called a reverse flow and having a variable flow denoted by 0. u+(S) u = u-(T) u = 0 The maximum value flow problem consists of determining a feasible flow between S and T in G0 of a maximum value (max 0). 3.3.2 Applications a. Finding the maximum capacity of a roadway network Consider a roadway network composed of m links (arcs). Each link is characterized by a maximum number of vehicles that can traverse it per a unit of time. The problem consists of finding the maximum number of vehicles that can travel between two given points of the network during a time unit. In this case, the similarity with the maximum value flow problem is obvious. b. Preemtive scheduling of tasks on parallel machines A set of n tasks have to be executed on m identical machines. Each task j is reduced to a single operation of a duration pj, having an early start time rj and a deadline dj. Given that it is possible to interrupt the execution of a task and restart it later on another machine (preemption), the problem consists of determining a schedule that respects the temporal constraints or to concluding that such a schedule does not exist.

21

OPTIMIZATION

3A GI

Let E =

j =1

{rj, dj}. Ranking the elements of E results in at most 2n-1 time intervals

[eh, eh+1]. Construct a network by defining: A node associated with each task, A node associated with each time interval [eh, eh+1], Two additional nodes S and T linked, respectively, to all tasks and all time intervals, An arc associated with each possibility of execution of one task during a given time interval. Thus, an arc links task j to time interval [eh, eh+1] if and only if it is possible to execute the task j during that interval. The following condition has to be satisfied: rj eh and eh+1 dj.

The capacity of an arc (S, j) is pj, linking one task to a time interval is (eh+1 - eh), and the capacity of an arc linking a node associated with a time interval to T is m(eh+1 eh). A feasible schedule exists iff the maximum value flow between S and T has a value of P = j=1,n pj. c. Maximum number of disjoint paths in a network Given a network G = [N, A] and two nodes S and T. Two paths joining S and T are said to be disjoint if they do not have any arc in common. The network is said to be pconnex if there exist at least p paths joining every pair of nodes. Finding the maximum number of disjoint paths between two nodes S and T is equivalent to solving a maximum value flow problem. This is achieved by assigning a capacitiy of 1 unit to each arc and finding the maximum value flow between S and T.

3.3.3 Algorithm of Ford-Fulkerson (1959) This is one of the simplest algorithms for solving the the maximum value flow problem. It uses the concept of labeling. It is an iterative algorithm that consists of determining, at each iteration, a chain between S and T that allows for augmenting the flow value while respecting the capacity constraints. Such a chain is called a Flow Augmenting Chain (FC).

22

OPTIMIZATION

3A GI

To identify a chain between S and T, a labeling algorithm is applied. This algorithm consists in constructing a tree rooted at S and which nodes are all labeled (a tree is a partial subnetwork that contains no cycles). At the beginning, only S is labeled, and at each iteration, one labeled node is selected in order to label all its sucessors. Every time a node j is selected, it is included in the tree while noting its predecssor (i), which is the node that was responsible for its labeling. The algorithm stops when: the node T is labeled or all successors of labeled nodes are examined without being able to label the node T. In the latter case, we conclude that there is no chain from S to T in the network. Here we notice that nodes may be in three possible states: (1) unlabeled, (2) labeled and unscanned, and (3) labeled and scanned. At each iteration, a labeled and unscanned node is selected, in order to examine its neighboring nodes. Once this is done, node i becomes scanned but remains labeled until T is labeled or the algorithm stops without labeling T. Given a network G = (N, A, C), de Ford-Fulkerson algorithm, for determining the maximum value flow between S and T, is described as follows: Algorithm of Ford-Fulkerson (1959) : Step 0 : Find a feasible flow vecteur between S and T. One can always start with the zero flow vector. Step 1 : Plant a tree with root at S Let be the current flow vector. Label the node S with (*). S is now labeled and unscanned. Go to step 2. Step 2 : Tree growth Find a labeled and unscanned node i and do the following: If there exists an unlabeled node j such that (i,j) A and (i,j) < c(i,j), label the node j with (+i) : unsaturated forward arc, thus the flow can increase

23

OPTIMIZATION

3A GI

If there exists an unlabeled node j such that (j,i) A and (j,i) > 0, label he node j with (-i) : backward arc and the flow can decrease If such a pair does not exist, there is a nonbreakthrough. The current flow vector is a maximum value flow vector; Terminate. Otherwise, node i is the immediate predecessor of j in a chain starting from S. If j = T, there is a breakthrough, go to step 3. Otherwise repreat this step 2. Step 3 : Flow augmentation Since T is labeled, an FC has just been found (it can be deduced by tracing back the predecessors starting from T). The current flow can be augmented by the amount , which is the minimum value of the residual capacity (capacity-current flow) on forward arcs and the flow values on backward arcs.
= min

uFC,forward

min

(cu u );

uFC,backward

min

Change the current flow vector, , as follows: Increase by the flow on each forward arc of FC, decrease by the flow on each backward arc of FC.

Erase the labels of all nodes and go back to step 1 with the new flow vector. Example: Isopipe Company wants to send the maximum quantity of natural gas (per hour) through its pipelines, from node O to node T of the following network (Figure 4.1).
4 1 3 2 1 2 1 3 1 2 4 2 1 2 3
T

2
S

Figure 4.1: Example of natural gas transportation

24

OPTIMIZATION

3A GI

It is required that the natural gas passes through certain stations: 1, 2, 3, 4 or 5. The different arcs of the network represent pipelines of different diameters. The maximum quantity of gas that can be pumped (per hour) through each arc is show on Figure 4.1. Determine the maximum quantity of gas that can be sent from O to T through this network. Application of Ford-Fulkerson algorithm: Step 1 : Consider the following initial solution : S1 = 13 = 2, S3 = 3, 34 = 1, 4T = 1, 35 = 5T = 4 Label node S with (*) and go to step 2. Step 2 : beginning from node S, consider all arcs : (S, 1) and (S, 3) are are forward and saturated; (S, 4) is not saturated and is not labeled; label node 4 with (+S).
+S 4 1 3 2 (2) 1 (3) 2 (1) -4 3 (2) 1 1 2 4 (1) 2 1 2 3 +3 (1) +4 5 (4) 5 +2
T

2 *
S

-3

Figure 4.2 : Application of Ford-Fulkerson algorithm Node 4 : arc (4, 5) unsaturated and 5 unlabeled; label node 5 with (+4). arc (4, T) saturated. arc (3, 4) is backward and has a positive flow, label node 3 with (4). Node 3 : arc (3, 2) unsaturated and 2 unlabeled; label node 2 with (+3). arc (1, 3) has a positive flow , label node 1 with (3). Node 1 : arc (1, 2) with 2 labeled; Node 2 : arc (2, T) unsaturated and T unlabeled; label node T with (+2). 25

OPTIMIZATION

3A GI

T is labeled; therefore, there is a breakthrough: it is possible to increase the flow. Go to step 3. Step 3 : The FC can be identified by starting from T and going backward: (O, 4), (3, 4), (3, 2), (2, T). = min {2,1,2,3} = 1 . Subtract 1 unit from the flow on (3, 4) and add it to the flow of the remaining forward arcs to obtain the new solution: S1 = 2, 13 = 2, S3 = 3, S4 = 1, 4T = 1, 35 = 5T = 4, 32 = 2T = 1 Erase all labels and go to step 1. Step 1: Label node S with (*) and go to step 2. Step 2 : (S, 1) and (S, 3) are saturated; (S, 4) is an saturated and unlabeled; label node 4 with (+S). Node 4 : arc (4, 5) unsaturated and 5 unlabeled; indicate (+4) on node 5. arc (4, T) saturated. arc (3, 4) has a zero flow. Node 5 : arc (5, T) unsaturated and T unlabeled; indicate (+5) on node T. It is possible to increase the flow since node T is labeled. Go to step 3. Step 3 : The FC is : (S, 4), (4, 5), (5, T) and =1; add 1 unit to flow on forward arcs to obtain the following solution: S1 = 2, 13 = 2, S3 = 3, S4 = 2, 45 = 1, 4T = 1, 35 = 4, 5T = 5, 32 = 2T = 1 Erase the labels and go to step 1. Step 1 : Label node S with (*) and go to step 2. Step 2 : Starting from node S, no node can be labeled since all arcs are saturated. Hence, node T cannot be labeled. The current solution is then optimal, with a flow value equal to 7.

26

OPTIMIZATION

3A GI

3.4 Concept of cuts


A partition of the set of nodes into two subsets X and Xc (where Xc = N\X) defines a cut, denoted by (X,Xc), which is the set of arcs with one node in X and the other in Xc. (X,Xc) is a disconnecting set because deleting the arcs of (X,Xc) from the network G leaves two disconnected components (no chain/path between any two nodes in X and Xc, respectively). For directed networks, if only forward arcs are deleted (i.e., arcs (i,j) such that i X and j Xc) there exists no path from any node in X to any node in Xc (chains may still exist). Special cuts are those that separate the source S from the sink T. By choosing a subset X that contains the source S but not the sink T, the set of arcs (i, j) with i X and j X is a cut of the network. A cut separating S and T is a set of arcs such that if eliminated, flow becomes impossible from S to T (S and T become disconnected). Note: A network may contain many cuts. The capacity of a cut, denoted by C(X,Xc) where S X and T X, is defined as the sum of capacities of its forward arcs. Let F(X,Xc) be the value of the flow across the the cut (X,Xc) and v() be the value of a flow transiting from S to T. Theorem 3.1: If all nodes satisfiy the flow conservation equation then +(X) = -(X) (flow on forward arcs equals flow on backward arcs). Proof: Let A1 = set of arcs (i,j) such that i and j X. Flow leaving nodes of X = + (X) + Flow entering nodes of X = -(X) +
uA!

uA!

Since all nodes satisfy the flow conservation equation, then + (X) +
uA!

=-(X) +

uA!

+ (X) = -(X)

27

OPTIMIZATION

3A GI

Lemma 3.1: The value of any flow is less than or equal to the capacity of any cut: and (X, Xc) separating S and T, we have v() C(X, Xc) Proof: Taking into account the reverse arc: +(X) = -(X) = Then, 0 = v() = 1(X) c

u( X ,X c ),reverse arc u(T,S)

u + 0

u( X ,X ),reverse arc u(T,S)

u 1(X) C(X, X )

As a consequence, the capacity of a cut represents a lower bound on the maximum The maximum flow minimum cut theorem: The maximum value among feasible flow vectors is equal to the minimum capacity of cuts separating S and T : maxfeasible v() = mincuts (X, Xc) C(X, Xc) One consequence of this theorem is that the Ford-Fulkerson algorithm simultaneously finds the maximum value flow and the mimum capacity cut.

3.5 Case of networks having lower bounds


In this case, a flow has to satisfy both lower and upper bounds (capacities): lu u cu, u = 1, , m where lu is a lower bound on u.

The network is then denoted by G = (N, A, L, C). Here, the problem of finding a feasible flow is not as obvious as before. To find the maximum value flow, we apply two phases : Phase I : Find a compatible flow (if it exists) Phase II : Solve for the maximum value flow (for example, by applying an adaptation of Ford-Fulkerson) 3.5.1 Phase I Let L+(i) = j(i) lij : Sum of lower bounds of arcs incident out of i;

28

OPTIMIZATION

3A GI

L-(i) = j1 (i) l ji : Sum of lower bounds of arcs incident into i; Transform G into a network G' having zero lower bounds in order to find an initial compatible flow for G. This is achieved by applying the following : Add the reverse arc (T, S) having a capacity = Replace the capacity cij by cij = cij - lij Add a dummy source S and a dummy sink T For each i such that L+(i) >0, add the arc (i, T) of capacity L+(i) For each i such that L-(i), add the arc (S,i) of capacity L-(i)

Theorem 3.2 There exists a compatible flow vector for G iff G the maximum value flow vector ' of G has a value L+(S) = L-(T). This means that ' saturates the arcs incident out of S and those incident into T. In addition, for each arc (i, j) of G, we have: ij = 'ij + lij

3.5.2 Phase II Once a compatible flow vector is found, Ford-Fulkerson algorithm can be applied with a slight modification: backward arcs are labeled if ji > lji and is computed based on the difference (ji - lji) The rest of the algorithm remains the same. Example:
(1,5)
S

(0,3) 3 (2,4) (2,5)


T

(1,6)

(0,7)

(1,1)

Figure 4.3: Example of network with lower bounds

29

OPTIMIZATION

3A GI

+S (2) 2 4 2 (2)
S

(1)

3 (2) +1 3 5 2 0 (4) (1) 1 3 (2)


T

(2) +3

+T

7 (4) 2 +S

(3)

+2

Figure 4.4: Example of transformed network G An initial compatible flow is then: S1 = 1, S2 = 4, 21 = 1, 13 = 2, 23 = 2, 2T = 1, 3T = 4

3.6 Minimum cost flow problems


3.6.1 Problem definition Consider a connected network G = [N,A, L, K, C], where L is the vector of lower bounds (l1, l2, ,lm)T, K is the vector of capacities (k1, k2, ,km)T, and C is the vector of costs (c1, c2, ,cm)T. The cost of transporting a unit of flow on arc u is cu (notice the change of notation).Therefore if is the flow vector, the total flow cost is :

c uA u u

Hence, the minimum cost flow problem consists in: Finding, among maximum value flows, a feasible flow that minimizes total cost. Or, Find the minimum cost way of transporting a flow of a fixed value v. In this case, if v > maximum value flow, the problem is infeasible.

30

Вам также может понравиться