INTRODUCTION TO OPERATIONS RESEARCH Maximum Flow Problem MAXIMUM FLOW PROBLEM Maximum flow problem description All flow through a directed and connected network originates at one node (source) and terminates at one another node (sink) All the remaining nodes are transshipment nodes Flow through an arc is allowed only in the direction indicated by the arrowhead, where the maximum amount of flow is given by the capacity of that arc. At the source, all arcs point away from the node. At the sink, all arcs point into the node The objective is to maximize the total amount of flow from the source to the sink (measured as the amount leaving the source or the amount entering the sink) MAXIMUM FLOW PROBLEM Typical applications Maximize the flow through a company’s distribution network from its factories to its customers Maximize the flow through a company’s supply network from its vendors to its factories Maximize the flow of oil through a system of pipelines Maximize the flow of water through a system of aqueducts Maximize the flow of vehicles through a transportation network MAXIMUM FLOW ALGORITHM Some Terminology The residual network shows the remaining arc capacities for assigning additional flows after some flows have been assigned to the arcs The residual capacity for assigning some flow from node B to node O O 2 The residual capacity for flow from node O to Node B 5 B MAXIMUM FLOW ALGORITHM An augmenting path is a directed path from the source to the sink in the residual network such that every arc on this path has strictly positive residual capacity The residual capacity of the augmenting path is the minimum of these residual capacities (the amount of flow that can feasibly be added to the entire path) Basic idea Repeatedly select some augmenting path and add a flow equal to its residual capacity to that path in the original network. This process continues until there are no more augmenting paths, so that the flow from the source to the sink cannot be increased further MAXIMUM FLOW ALGORITHM The Augmenting Path Algorithm Assume that the arc capacities are either integers or rational numbers 1. Identify an augmenting path by finding some directed path from the source to the sink in the residual network such that every arc on this path has strictly positive residual capacity. If no such path exists, the net flows already assigned constitute an optimal flow pattern 2. Identify the residual capacity c* of this augmenting path by finding the minimum of the residual capacities of the arcs on this path. Increase the flow in this path by c* MAXIMUM FLOW EXAMPLE During the peak season the park management of the Seervada park would like to determine how to route the various tram trips from the park entrance (Station O) to the scenic (Station T) to maximize the number of trips per day. Each tram will return by the same route it took on the outgoing trip so the analysis focuses on outgoing trips only. To avoid unduly disturbing the ecology and wildlife of the region, strict upper limits have been imposed on the number of outgoing trips allowed per day in the outbound direction on each individual road. For each road the direction of travel for outgoing trips is indicated by an arrow in the next slide. The number at the base of the arrow gives the upper limit on the number of outgoing trips allowed per day. MAXIMUM FLOW EXAMPLE Consider the problem of sending as many units from node O to node T for the following network (current flow, capacity): (0,3) A (0,9) D (0,5) (0,1) (0,4) T (0,1) (0,7) (0,6) B O (0,5) (0,4) (0,2) (0,4) C E MAXIMUM FLOW EXAMPLE Iteration 1: one of the several augmenting paths is OBET, which has a residual capacity of min{7, 5, 6} = 5. By assigning the flow of 5 to this path, the resulting network is shown above (0,3) A (0,9) D (0,5) (0,1) (0,4) T (0,1) (5,7) (5,6) B O (5,5) (0,4) (0,2) (0,4) C E MAXIMUM FLOW EXAMPLE Iteration 2: Assign a flow of 3 to the augmenting path OADT. The resulting residual network is (3,3) A (3,9) D (3,5) (0,1) (0,4) T (0,1) (5,7) (5,6) B O (5,5) (0,4) (0,2) (0,4) C E MAXIMUM FLOW EXAMPLE Iteration 3: Assign a flow of 1 to the augmenting path OABDT. The resulting residual network is (3,3) A (4,9) D (4,5) (1,1) (1,4) T (0,1) (5,7) (5,6) B O (5,5) (0,4) (0,2) (0,4) C E MAXIMUM FLOW EXAMPLE Iteration 4: Assign a flow of 2 to the augmenting path OBDT. The resulting residual network is (3,3) A (6,9) D (4,5) (1,1) (3,4) T (0,1) (7,7) (5,6) B O (5,5) (0,4) (0,2) (0,4) C E MAXIMUM FLOW EXAMPLE Iteration 5: Assign a flow of 1 to the augmenting path OCEDT. The resulting residual network is (3,3) A (7,9) D (4,5) (1,1) (3,4) T (1,1) (7,7) (5,6) B O (5,5) (1,4) (0,2) (1,4) C E MAXIMUM FLOW EXAMPLE Iteration 6: Assign a flow of 1 to the augmenting path OCET. The resulting residual network is (3,3) A (7,9) D (4,5) (1,1) (3,4) T (1,1) (7,7) (6,6) B O (5,5) (2,4) (0,2) (2,4) C E MAXIMUM FLOW EXAMPLE There are no more flow augmenting paths, so the current flow pattern is optimal 3 A 7 D 1 4 T 13 3 O 1 B 6 7 5 2 C 13 2 E MAXIMUM FLOW EXAMPLE Recognizing optimality Max-flow min-cut theorem can be useful A cut is defined as any set of directed arcs containing at least one arc from every directed path from the source to the sink For any particular cut, the cut value is the sum of the arc capacities of the arcs of the cut The theorem states that, for any network with a single source and sink, the maximum feasible flow from the source to the sink equals the minimum cut value for all cuts of the network MAXIMUM FLOW PROBLEM Many situations can be modeled by a network in which the arcs may be thought of as having a capacity that limits the quantity of a product that may be shipped through the arc. In these situations, it is often desired to transport the maximum amount of flow from a starting point (called the source) to a terminal point (called the sink). Such problems are called maximum flow problems. MAXIMUM FLOW PROBLEM Sunco Oil wants to ship the maximum possible amount of oil (per hour) via pipeline from node so to node si as shown in the figure below. Arc Capacity a0 (1)3 so (2)2 1 (1)3 (1)4 2 3 (2)2 (1)1 si (so,1) 2 (so,2) 3 (1,2) 3 (1,3) 4 (3,si) 1 (2,si) 2 The various arcs represent pipelines of different diameters. The maximum number of barrels of oil that can be pumped through each arc is shown in the table above (also called arc capacity). MAXIMUM FLOW PROBLEM Xij = Millions of barrels of oil per hour that will pass through arc(i,j) of pipeline. For a flow to be feasible it needs to be in the following range: 0 <= flow through each arc <= arc capacity and Flow into node i = Flow out from node i MAXIMUM FLOW PROBLEM Let X0 be the flow through the artificial arc, the conservation of flow implies that X0 = total amount of oil entering the sink. Thus, Sunco’s goal is to maximize X0. Max Z= X0 S.t. Xso,1<=2 Xso,2<=3 X12<=3 X2,si<=2 X13<=4 X3,si<=1 X0=Xso,1+Xso,2 Xso,1=X12+X13 Xso,2+X12=X2,si X13=X3,si X3,si+X2,si=X0 Xij>=0 (Arc Capacity constraints) (Node so flow constraints) (Node 1 flow constraints) (Node 2 flow constraints) (Node 3 flow constraints) (Node si flow constraints) One optimal solution to this LP is Z=3, Xso,1=2, X13=1, X12=1, Xso,2=1, X3,si=1, X2,si=2, Xo=3. MINIMUM SPANNING TREE A spanning tree of a graph is just a sub-graph that contains all the vertices. A graph may have many spanning trees The minimum spanning tree of a graph defines the cheapest subset of edges that keeps the graph in one connected component. Telephone companies are particularly interested in minimum spanning trees, because the minimum spanning tree of a set of sites defines the wiring scheme that connects the sites using as little wire as possible. MINIMUM SPANNING TREE the complete graph on four vertices has sixteen spanning trees: MINIMUM SPANNING TREE Minimum spanning trees prove important for several reasons: They can be computed quickly and easily, and they create a sparse sub-graph that reflects a lot about the original graph. They provide a way to identify clusters in sets of points. Deleting the long edges from a minimum spanning tree leaves connected components that define natural clusters in the data set They can be used to give approximate solutions to hard problems As an educational tool, minimum spanning tree algorithms provide graphic evidence that greedy algorithms can give provably optimal solutions. MINIMUM SPANNING TREE PROBLEM Suppose that each arc (i,j) in a network has a length associated with it and that arc (i,j) represents a way of connecting node i to node j. For example, if each node in a network represents a computer in a computer network, arc(i,j) might represent an underground cable that connects computer i to computer j. In many applications, we want to determine the set of arcs in a network that connect all nodes such that the sum of the length of the arcs is minimized. APPLICATIONS Design of telecommunication networks (fiber-optic, computer, telephone, cable television) Design of lightly used transportation network to minimize the total cost of providing the links (rail lines, roads, etc.) Design of a network of high-voltage electrical transmission lines Design of a network of wiring on electrical equipment (e.g., a digital computer system) to minimize the total length of the wire Design of a network of pipelines to connect a number of locations DESCRIPTION For a network with n nodes, a spanning tree is a group of n-1 arcs that connects all nodes of the network and contains no loops. 12 1 2 (1,2)-(2,3)-(3,1) is a loop 4 7 (1,3)-(3,2) is the minimum spanning tree 3 MINIMUM SPANNING TREE You are given the nodes of the network but not the links. Instead you are given the potential links and the positive length for each if it is inserted into the network (alternative measures for length of a link include distance, cost, and time) You wish to design the network by inserting enough links to satisfy the requirement that there be a path between every pair of nodes The objective is to satisfy this requirement in a way that minimizes the total length of links inserted into the network MINIMUM SPANNING TREE ALGORITHM Greedy Algorithm 1) 2) 3) Select any node arbitrarily, and then connect (i.e., add a link) to the nearest distinct node Identify the unconnected node that is closest to a connected node, and then connect these two nodes (i.e., add a link between them). Repeat the step until all nodes have been connected Tie breaking: Ties for the nearest distinct node (step 1) or the closest unconnected node (step 2) may be broken arbitrarily, and the algorithm will still yield an optimal solution. MINIMUM SPANNING TREE EXAMPLE The State University campus has five computers. The distances between computers are given in the figure below. What is the minimum length of cable required to interconnect the computers? 1 1 2 2 6 4 5 3 2 4 4 5 2 3 MINIMUM SPANNING TREE EXAMPLE Iteration 1: Following the MST algorithm discussed before, we arbitrarily choose node 1 to begin. The closest node is node 2. Now C={1,2}, Ć={3,4,5}, and arc(1,2) will be in the minimum spanning tree. 1 1 2 2 6 4 5 3 2 4 4 5 2 3 MINIMUM SPANNING TREE EXAMPLE Iteration 2: Node 5 is closest to C since node 5 is two blocks from node 1 and node 2, we may include either arc(2,5) or arc(1,5) in the minimum spanning tree. We arbitrarily choose to include arc(2,5). Then C={1,2,5} and Ć={3,4}. 1 1 2 2 6 4 5 3 2 4 4 5 2 3 MINIMUM SPANNING TREE EXAMPLE Iteration 3: Since node 3 is two blocks from node 5, we may include arc(5,3) in the minimum spanning tree. Now C={1,2,5,3} and Ć={4}. 1 1 2 2 6 4 5 3 2 4 4 5 2 3 MINIMUM SPANNING TREE EXAMPLE Iteration 4: Node 5 is the closest node to node 4. Thus, we add arc(5,4) to the minimum spanning tree. We now have a minimum spanning tree consisting of arcs(1,2), (2,5), (5,3), and (5,4). The length of the minimum spanning tree is 1+2+2+4 = 9 blocks. 1 1 2 2 6 4 5 3 2 4 4 5 2 3 NOTES The number of links in a spanning tree are one less than the number of nodes. Each node is directly connected by a single link to at least one other node. It is possible to have multiple minimum spanning trees.