Lecture 8 Why do we need residual networks? • Residual networks allow one to reverse flows if necessary. If we have taken a bad path then residual networks allow one to detect the condition and reverse the flow. A bad path is one which overlaps with too many other paths. Example a Source 1 1 Destination 1 1 b 1 Paths source, a, destinations and source, b destination gives a flow of 2 units. Path source, a, b, destination overlaps with both the optimal paths. If we initially choose source, a, b, destination as our path, then no greedy strategy will be able to augment the network flow any further (unless we use residual edges which allows recovery) Verify how we recover in spite of the initial bad choice, if we use the residual network to augment flows. Defects of Augmenting Path Algorithm Sending flow along a path requires O(V) complexity. 1 1 1 2 1 1 . Since there are n separate paths, we need to 1 . 1 push flow through n paths separately. . Every time complexity is O(V) n How about if we push flow through edges separately without caring about flow conversation? If there is excess flow at a node, then the excess is sent to downstream nodes. Finally, all excess flow is routed back to the source, so that flow conservation is maintained. 1 1 1 2 1 1 . 1 . . n 1 Generic Pre-flow Push Algorithm Augmenting path algorithms maintain feasibility at every stage, and gradually strive towards optimality Pre-flow push algorithm initially pushes the maximum possible amount of flow, and strives towards feasibility. Initially, flow in every edge originating from the source is set to the link capacity. Distance label of every node is initially their distance to the destination. Set distance label of source node s, d(s)=V A node (which is not source nor destination), with excess flow is called an active node. If a node has excess flow, send the flow along an admissible edge (end node of an admissible edge has less distance than the source node of the edge, and hence is closer to the destination). Let the excess flow at a node u be e(u). Let the capacity of admissible edge (u, v) in residual graph be ruv Then flow routed along (u, v) is min(e(u), ruv ) If a node u with excess flow does not have an admissible edge in the residual network, then it is relabelled: d(u) is upgraded to d(v) + 1, where v is the node with minimum distance label amongst all nodes which have edges from u in the residual network. The algorithm terminates when there are no active nodes. Intuition Edges are like water pipes Nodes are joints Distance is like height from the ground. Destination is at the ground. Initially source is at the heighest level and sends water to all adjacent nodes. Whenever a node has accumulated water, it sends water to nodes at lower label. So water moves towards the destination. Sometimes water gets locally trapped as all neighboring nodes are at a greater height (no admissible arc). Then, the node label is raised (relabelling). Push 4 units along 1-3 and 2 units along 1-2 source 1 2 E=2 source 3 E=4 4 1 2 12 Push 4 unit along 3-4, and then 1 unit along 1-4 1 2 3 5 2 1 0 E = 11 4 3 4 3 5 0 destination 1 2 1 4 destination Original Network/Residual Network with 0 flow source source 1 2 2 12 E=1 1 3 4 3 1 1 4 1 2 Relabel node 2 to 2 0 destination 4 2 22 E=1 3 4 3 1 1 4 1 Route 1 unit through 2-3 0 destination 4 source 1 4 3 E=1 2 2 22 source 1 4 1 2 1 1 4 1 Route 1 unit through 3-4 2 2 40 destination Now no node has any excess Total flow out of source is 6 2 1 3 1 5 4 destination Proof for Optimality Distance labels always maintain requisite properties. Initially, d(s) = V. Any difficulty in maintaining requisite properties? At termination d(s) is V or greater. So there is no path from the source to destination in the residual network (no augmenting path). At termination, no node except the source and destination has excess flow. No node ever has any deficit flow. So, flow allocation is feasible at termination Since the residual network does not have an augmenting path, the flow is a maxflow. Complexity is O(V2E) Specific Implementations of Generic Preflow-Push algorithm Order of selection of active nodes has not been nailed down in the generic version (FIFO)This algorithm pushes flow out of the active nodes in first in first out order. The algorithm initially orders the active nodes in some manner. It pushes flow from the first active node in the list, till the active node is no longer active or till it needs to be relabelled While pushing flow from this active node, the newly created active nodes are added to the back of the list In the latter case, the node is relabelled and added to the back of the list and picks the second node from the list. The algorithm terminates when the list is empty Clearly, FIFO is a specific order for selecting the active nodes, and hence the proof for correctness is the same as that for generic preflow push algorithm O(V3) complexity Problem with FIFO Source 1 1 2 1 1 1 n -1 Destination 1 Highest Label Preflow push Pushes flow from the active node with the highest label Terminates when there are no more active nodes O(V2E0.5) Multicommodity network flow We have several source destination pairs. Refer to each as a separate commodity. Need to maximize a weighted sum of the different flows Flow allocation must be feasible: Capacity Constraints Total flow in any link is between 0 and the link capacity Flow Conservation Input flow for any commodity at a node equals the output flow of the commodity, for every node except the source/destination for the commodity. Solution techniques use optimization ideas However, we may not have integral flows even if link capacities are integers In fact, unlike the single commodity flow problem, multicommodity flow problem with the constraint that flows in the links are integers is NP-hard Example Application Wireless nodes have low battery power and hence limited lifetime. Every transmission consumes energy. Reception consumes less energy. Lifetime of a node is related to the total energy spent in transmission. Transmission energy increases with increase in distance to the receiving node. Signal strength decreases as distance increases. So if the node needs to transmit to a distant node, it needs to use greater power. Power increases as d4 where d is the distance between the two nodes. It would be interesting to ask the question that given a particular transmission requirement what is the maximum lifetime of a network? Lifetime of a network is the maximum time in which all nodes are active. Energy Conserving Routing in Wireless Ad-hoc Networks J.H. Chang and L. Tassiulas, INFOCOM 2000 Clearly, routing strategy will affect the network lifetime. For example, if all traffic is routed through a single node, it will die in a short time, and according to our definition network dies as well. Routing strategy will depend on traffic requirements, and the node energies. Problem Formulation Node i has energy Ei Transmission energy from node i to j is eij for each transmission (depends on the distance between the two nodes) Let there be C sessions Let Qic be the rate of packet generation in node i for session c Let qijc be the rate of information transmission in link i, j for session c under the current routing (routing determines the qijc ) Every node has a maximum power. So there is a set of neighbors Si of node i. Lifetime of a node i under flow q is Ti(q)= Ei/j Si eijc Cqijc Lifetime of a system is minimum of all its nodes Tsys (q) = mini Ti (q) Let Dc be the set of destinations of session C Session c information must reach some node in Dc Lifetime Maximization Objective Maximize Tsys (q) = mini Ei/j Si eijc Cqijc Subject to: qijc0 i Sj qjic + Qic= j Si qijc session c, and all nodes i Dc Reformulation Maximize Tsys (q) Subject to: j Si eijc CqijcTsys (q) Ei session c, and all nodes i qijc0 i Sj qjic + Qic= j Si qijc session c, and all nodes i Dc Let qijc = qijcTsys (q) Reformulation Maximize Tsys (q) Subject to: j Si eijc Cqijc Ei session c, and all nodes i qijc0 i Sj qjic + Tsys (q) Qic= j Si qijc session c, and all nodes i Dc Special Case Consider the special case where every session has a single source, i.e., Qic = 0 at all nodes except the source of session i. Thus, Qc is the input rate for session c. Also, eij = ei neighbors j of i. Also, pijc = qijcTsys (q)/ Qc The problem can be reformulated as follows: Reformulation Maximize Tsys (q) Subject to: j Si c Cpijc Ei /ei session c, and all nodes i pijc0 i Sj pjic = j Si pijc session c, and all nodes i except source and destination of session c. i Sj pjic + Tsys (q) = j Si pijc • This is the multi-commodity flow problem with node capacities, i.e., there is an additional constraint that sum of the output flow through a node must not exceed the node capacity. – Problem with node capacity can be reduced to the problem without node capacity, replacing each node by two nodes with a link between them with capacity equal to the node capacity – Note that there is no link capacity in this problem (equivalently all link capacities are infinity). • Object of this multi-commodity flow problem is to find the minimum flow supported for each session. In general, eij may not be the same for all neighbors of node i, since all neighbors may not be equidistant from node i. The paper suggests several heuristics for the purpose. Minimum Cut Consider the augmenting path algorithm. The set S reachable from the source node in the residual network when the algorithm terminates and the remaining nodes V-S constitute a minimum cut. Why? Thus we know how to find a minimum cut. How about finding the edges of all minimum cuts? Why do we need the above? Consider an edge (u, v) in the residual network corresponding to the max-flow. Let such an edge satisfy the following properties: Edge (u, v) is filled to capacity. Node v is not reachable from source s in the residual network. Node u can not reach destination t in the residual network. There is no path from u to v in the residual network. A non-zero capacity edge (u, v) belongs to some minimum cut if and only if it satisfies all the above properties in the residual network corresponding to a max flow. Prove the above. Your grade for the second homework is the maximum of your grade in this problem, and the second homework! I need the answer by Nov 14th